/* ============================================================
   ELECTRICITY BILLING ANALYTICS DASHBOARD â€” STYLES
   Premium Dark-Mode Glassmorphism Design
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ==========================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================== */
:root {
  /* Backgrounds */
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-sidebar: #0b0f19;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-active: rgba(99, 102, 241, 0.12);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-strong: rgba(255, 255, 255, 0.14);

  /* Brand */
  --primary: #6366f1;
  --primary-rgb: 99, 102, 241;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #38bdf8;
  --secondary-rgb: 56, 189, 248;
  --accent: #d946ef;
  --accent-rgb: 217, 70, 239;

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Semantic */
  --success: #10b981;
  --success-rgb: 16, 185, 129;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 62px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-glow-primary: 0 0 20px rgba(var(--primary-rgb), 0.25);
  --shadow-glow-secondary: 0 0 20px rgba(var(--secondary-rgb), 0.25);
  --shadow-glow-accent: 0 0 20px rgba(var(--accent-rgb), 0.25);

  /* Glass */
  --glass-blur: 16px;
  --glass-bg: rgba(30, 41, 59, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================
   2. RESET & BASE
   ========================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--secondary); }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================================
   3. CUSTOM SCROLLBAR
   ========================================================== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ==========================================================
   4. APP CONTAINER â€” Root Layout
   ========================================================== */
.app-container {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(var(--primary-rgb), 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(var(--accent-rgb), 0.04) 0%, transparent 55%),
    var(--bg-dark);
}

/* ==========================================================
   5. SIDEBAR
   ========================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: 100;
  position: relative;
  overflow: hidden;
}

/* Subtle gradient line on the right edge */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--primary-rgb), 0.3) 30%,
    rgba(var(--accent-rgb), 0.2) 70%,
    transparent 100%
  );
  pointer-events: none;
}

/* --- Sidebar Brand --- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-primary);
}

.sidebar-brand .brand-text h2 {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.sidebar-brand .brand-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

/* --- Sidebar Filters Container --- */
.sidebar-filters-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 12px;
}

/* --- Filters Header --- */
.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.filters-header h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.filters-header .btn-link {
  font-size: 0.75rem;
  color: var(--primary-light);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-weight: 500;
}
.filters-header .btn-link:hover {
  color: var(--secondary);
  background: rgba(var(--primary-rgb), 0.1);
}

/* --- Filter Group --- */
.filter-group {
  margin-bottom: 14px;
}

.filter-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group input[type="search"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.filter-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: rgba(var(--primary-rgb), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.filter-group select option {
  background: #1e293b;
  color: var(--text-primary);
  padding: 8px;
}

/* --- Divider --- */
.divider {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-footer p {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

/* ==========================================================
   6. MAIN CONTENT
   ========================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  background: transparent;
}

/* --- Main Header (sticky top bar) --- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.main-header h1 {
  font-size: 1.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.main-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-header .header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary-light);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.header-badge .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

/* --- Tab Content Container --- */
.tab-content-container {
  padding: 24px 28px 32px;
  flex: 1;
}

/* ==========================================================
   7. KPI GRID
   ========================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

/* --- KPI Card --- */
.kpi-card {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: default;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0.9;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color-strong);
  box-shadow: var(--shadow-md);
}

.kpi-card .kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card .kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.kpi-card .kpi-label {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-card .kpi-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.kpi-card .kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* KPI Variants */
.kpi-card.outstanding::before { background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.kpi-card.outstanding .kpi-icon { background: rgba(var(--primary-rgb), 0.15); color: var(--primary-light); }
.kpi-card.outstanding .kpi-value { color: var(--primary-light); }

.kpi-card.consumers::before { background: linear-gradient(90deg, var(--secondary), #67e8f9); }
.kpi-card.consumers .kpi-icon { background: rgba(var(--secondary-rgb), 0.15); color: var(--secondary); }
.kpi-card.consumers .kpi-value { color: var(--secondary); }

.kpi-card.collections::before { background: linear-gradient(90deg, var(--success), #34d399); }
.kpi-card.collections .kpi-icon { background: rgba(var(--success-rgb), 0.15); color: var(--success); }
.kpi-card.collections .kpi-value { color: var(--success); }

.kpi-card.load::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.kpi-card.load .kpi-icon { background: rgba(var(--warning-rgb), 0.15); color: var(--warning); }
.kpi-card.load .kpi-value { color: var(--warning); }

.kpi-card.disconnected::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.kpi-card.disconnected .kpi-icon { background: rgba(var(--danger-rgb), 0.15); color: var(--danger); }
.kpi-card.disconnected .kpi-value { color: var(--danger); }

.kpi-card.defaulters::before { background: linear-gradient(90deg, var(--accent), #e879f9); }
.kpi-card.defaulters .kpi-icon { background: rgba(var(--accent-rgb), 0.15); color: var(--accent); }
.kpi-card.defaulters .kpi-value { color: var(--accent); }

/* ==========================================================
   8. DASHBOARD SPLIT CONTAINER
   ========================================================== */
.dashboard-split-container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  min-height: 0;
}

/* ==========================================================
   9. GLASS CARD BASE (shared by visuals-panel & table-panel)
   ========================================================== */
.glass-card,
.visuals-panel,
.table-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

/* ==========================================================
   10. VISUALS PANEL (Left Column)
   ========================================================== */
.visuals-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  max-height: calc(100vh - 230px);
}

/* --- Panel Tab Header --- */
.panel-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.panel-tab-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font-display);
}

/* --- Visual Tabs (pill tabs) --- */
.visual-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 3px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.visual-tabs::-webkit-scrollbar { display: none; }

.visual-tab {
  padding: 6px 14px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  outline: none;
}

.visual-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.visual-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

/* --- Visuals Content Wrapper --- */
.visuals-content-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  padding: 16px 18px;
}

/* --- Visual Panel Content (tab panels) --- */
.visual-panel-content {
  display: none;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.35s ease-out;
}

.visual-panel-content.active {
  display: flex;
  flex-direction: column;
}

/* --- Chart Wrapper --- */
.chart-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 300px;
  max-height: 440px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

/* --- Map View (Embedded inside Visuals Panel) --- */
.map-view-layout-embed {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 350px;
}

.map-controls-embed {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.map-controls-embed select {
  padding: 6px 28px 6px 10px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.map-controls-embed select:focus {
  border-color: rgba(var(--primary-rgb), 0.5);
}

.map-container-embed {
  flex: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 300px;
  border: 1px solid var(--border-color);
}

/* ==========================================================
   11. TABLE PANEL (Right Column)
   ========================================================== */
.table-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  max-height: calc(100vh - 230px);
}

.table-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 10px;
}

.table-panel-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font-display);
  white-space: nowrap;
}

.table-panel-header .table-search {
  flex: 1;
  max-width: 220px;
  padding: 6px 12px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.table-panel-header .table-search:focus {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: rgba(var(--primary-rgb), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

.table-panel-header .table-search::placeholder {
  color: var(--text-muted);
}

/* --- Table Responsive Wrapper --- */
.table-responsive {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* --- Data Table --- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
}

.data-table thead th.sortable:hover {
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.06);
}

.data-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Numeric cells right-aligned */
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   12. BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.3;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: var(--border-color-strong);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.74rem;
  border-radius: var(--radius-sm);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-light);
  padding: 4px 8px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.btn-link:hover {
  color: var(--secondary);
}

.btn-danger {
  background: rgba(var(--danger-rgb), 0.15);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.25);
}
.btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.25);
}

.btn-success {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border-color: rgba(var(--success-rgb), 0.25);
}
.btn-success:hover {
  background: rgba(var(--success-rgb), 0.25);
}

.btn-icon-sm {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================
   13. BADGES
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.2);
}

.badge-danger {
  background: rgba(var(--danger-rgb), 0.15);
  color: var(--danger);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
}

.badge-warning {
  background: rgba(var(--warning-rgb), 0.15);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.2);
}

.badge-primary {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* ==========================================================
   14. MODAL OVERLAY & CARD
   ========================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  z-index: 5;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-family: var(--font-display);
  font-weight: 700;
}

.modal-close, .btn-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--danger);
  background: #ffffff !important;
  border-radius: var(--radius-sm);
  color: var(--danger) !important;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  line-height: 1;
}

.modal-close:hover, .btn-modal-close:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  color: var(--danger) !important;
  border-color: var(--danger);
  transform: scale(1.05);
}

.modal-body {
  padding: 20px 24px 24px;
}

/* --- Modal Section Grid --- */
.modal-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.detail-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.detail-section h4 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-sans);
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 0.8rem;
}

.detail-item .detail-label {
  color: var(--text-muted);
  font-weight: 400;
}

.detail-item .detail-value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Highlight Variants */
.highlight-arrears {
  color: var(--danger) !important;
  font-weight: 700 !important;
}

.highlight-payments {
  color: var(--success) !important;
  font-weight: 700 !important;
}

/* ==========================================================
   15. UPLOAD CARD / DROP ZONE
   ========================================================== */
.upload-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  border: 2px dashed rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius-lg);
  background: rgba(var(--primary-rgb), 0.03);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: rgba(var(--primary-rgb), 0.6);
  background: rgba(var(--primary-rgb), 0.08);
  box-shadow: var(--shadow-glow-primary);
}

.drop-zone .drop-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.drop-zone p strong {
  color: var(--primary-light);
}

.drop-zone .drop-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-file-details {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(var(--success-rgb), 0.06);
  border: 1px solid rgba(var(--success-rgb), 0.15);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.upload-file-details .file-icon {
  font-size: 1.4rem;
}

.upload-file-details .file-info {
  flex: 1;
}

.upload-file-details .file-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-file-details .file-size {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================
   16. MAP / LEAFLET DARK THEME OVERRIDES
   ========================================================== */

/* Dark tiles filter */
.leaflet-tile-pane {
  filter: brightness(0.7) contrast(1.15) saturate(0.8);
}

/* Popup overrides */
.leaflet-popup-content-wrapper {
  background: rgba(30, 41, 59, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-color-strong) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-family: var(--font-sans) !important;
  font-size: 0.8rem !important;
  line-height: 1.55 !important;
  color: var(--text-secondary) !important;
}

.leaflet-popup-content b,
.leaflet-popup-content strong {
  color: var(--text-primary) !important;
  font-weight: 600;
}

.leaflet-popup-tip {
  background: rgba(30, 41, 59, 0.95) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 18px !important;
  width: 24px !important;
  height: 24px !important;
  padding: 4px !important;
}
.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

/* Attribution */
.leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.6rem !important;
  border-radius: var(--radius-sm) 0 0 0 !important;
}
.leaflet-control-attribution a {
  color: var(--text-muted) !important;
}

/* Zoom control */
.leaflet-control-zoom a {
  background: rgba(30, 41, 59, 0.9) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
  backdrop-filter: blur(8px) !important;
  transition: all var(--transition-fast) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(var(--primary-rgb), 0.2) !important;
  color: var(--text-primary) !important;
}

/* --- Legend --- */
.map-legend,
.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-red { background: var(--danger); box-shadow: 0 0 6px rgba(var(--danger-rgb), 0.4); }
.legend-yellow { background: var(--warning); box-shadow: 0 0 6px rgba(var(--warning-rgb), 0.4); }
.legend-green { background: var(--success); box-shadow: 0 0 6px rgba(var(--success-rgb), 0.4); }

/* ==========================================================
   17. KEYFRAME ANIMATIONS
   ========================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(var(--success-rgb), 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ==========================================================
   18. UTILITY CLASSES
   ========================================================== */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }

.text-primary { color: var(--primary-light) !important; }
.text-secondary-color { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }

.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.font-medium { font-weight: 500 !important; }

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-sm { font-size: 0.78rem !important; }
.text-xs { font-size: 0.7rem !important; }

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

.full-width { width: 100% !important; }

.hidden { display: none !important; }
.invisible { visibility: hidden !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================
   19. CHART.JS GLOBAL OVERRIDES
   ========================================================== */
canvas {
  max-width: 100%;
}

/* ==========================================================
   20. RESPONSIVE â€” â‰¤ 1200px (Stack split)
   ========================================================== */
@media (max-width: 1200px) {
  .dashboard-split-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .visuals-panel,
  .table-panel {
    max-height: none;
    min-height: 400px;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
  }
}

/* ==========================================================
   21. RESPONSIVE â€” â‰¤ 768px (Sidebar collapses to top bar)
   ========================================================== */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar::after {
    display: none;
  }

  .sidebar-brand {
    padding: 12px 16px;
  }

  .sidebar-filters-container {
    display: none;
    padding: 12px 16px;
    max-height: 50vh;
    overflow-y: auto;
  }

  .sidebar-filters-container.mobile-open {
    display: block;
    animation: fadeIn 0.25s ease-out;
  }

  .sidebar-footer {
    display: none;
  }

  /* Filter groups in horizontal layout on mobile */
  .sidebar-filters-container .filter-group {
    margin-bottom: 10px;
  }

  .main-content {
    height: auto;
    overflow-y: auto;
  }

  .main-header {
    padding: 10px 16px;
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .main-header h1 {
    font-size: 1rem;
  }

  .tab-content-container {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-card .kpi-value {
    font-size: 1.3rem;
  }

  .dashboard-split-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .visuals-panel,
  .table-panel {
    min-height: 350px;
    max-height: none;
  }

  .panel-tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .visual-tabs {
    width: 100%;
  }

  .table-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .table-panel-header .table-search {
    max-width: 100%;
    width: 100%;
  }

  /* Modal responsive */
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .modal-section-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-header {
    padding: 16px 18px 12px;
  }

  .modal-body {
    padding: 16px 18px 20px;
  }
}

/* ==========================================================
   22. RESPONSIVE â€” â‰¤ 480px (Small mobile)
   ========================================================== */
@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 12px;
  }

  .kpi-card .kpi-value {
    font-size: 1.15rem;
  }

  .kpi-card .kpi-icon {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
  }

  .tab-content-container {
    padding: 12px;
  }

  .data-table {
    font-size: 0.72rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 7px 10px;
  }
}

/* ==========================================================
   23. PRINT STYLES
   ========================================================== */
@media print {
  .sidebar,
  .main-header,
  .modal-overlay {
    display: none !important;
  }

  .app-container {
    display: block;
  }

  .main-content {
    overflow: visible;
  }

  .kpi-card,
  .visuals-panel,
  .table-panel {
    break-inside: avoid;
    backdrop-filter: none;
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
  }
}

/* ==========================================================
   24. SELECTION & FOCUS STYLES
   ========================================================== */
::selection {
  background: rgba(var(--primary-rgb), 0.35);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), 0.5);
  outline-offset: 2px;
}

/* ==========================================================
   25. MISC / SUPPLEMENTARY COMPONENTS
   ========================================================== */

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  opacity: 0.3;
}

.empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 1000;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Progress bar (for upload or KPIs) */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width var(--transition-slow);
}

/* Chip / Tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Sidebar mobile toggle button */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
  }
}

/* Table row click highlight */
.data-table tbody tr.selected {
  background: rgba(var(--primary-rgb), 0.1) !important;
}

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--border-color);
  font-size: 0.74rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.table-pagination .pagination-info {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.table-pagination .pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-pagination .page-indicator {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.table-pagination .btn-page {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.table-pagination .btn-page:hover:not(:disabled) {
  background: rgba(var(--primary-rgb), 0.25);
  color: #fff;
  border-color: rgba(var(--primary-rgb), 0.5);
}

.table-pagination .btn-page:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.table-pagination .btn-page.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Animated entrance for KPI cards */
.kpi-card {
  animation: fadeInUp 0.4s ease-out both;
}
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }
.kpi-card:nth-child(7) { animation-delay: 0.35s; }
.kpi-card:nth-child(8) { animation-delay: 0.4s; }
.kpi-card:nth-child(9) { animation-delay: 0.45s; }

/* Animated entrance for panels */
.visuals-panel,
.table-panel {
  animation: fadeInUp 0.45s ease-out 0.2s both;
}

/* Hover glow effect on glass cards */
.visuals-panel:hover,
.table-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* Dropdown Multiselect Styles */
.dropdown-multiselect {
  position: relative;
  width: 100%;
}

.dropdown-multiselect-toggle {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.dropdown-multiselect-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.dropdown-multiselect-content {
  display: none; /* Toggle this class with JS */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 4px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
}

.dropdown-multiselect-content.active {
  display: block;
}

.dropdown-multiselect-actions {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.btn-link-sm {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 4px;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.btn-link-sm:hover {
  color: var(--secondary);
  text-decoration: underline;
}

/* Multi-select checkboxes container */
.multiselect-container {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.multiselect-item:hover {
  color: var(--text-primary);
}

.multiselect-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Substation & Feeder Hierarchical Summary Styles */
.summary-hierarchy-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.summary-hierarchy-table th {
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  z-index: 5;
  border-bottom: 2px solid var(--border-color-strong);
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.summary-hierarchy-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.summary-hierarchy-table tr.substation-row {
  background: rgba(99, 102, 241, 0.12) !important;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-hierarchy-table tr.substation-row td {
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
}

.summary-hierarchy-table tr.feeder-row td:first-child {
  padding-left: 36px;
  color: var(--text-secondary);
}

.summary-hierarchy-table tr.substation-row:hover {
  background: rgba(99, 102, 241, 0.2) !important;
}

.summary-hierarchy-table tr.feeder-row:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

.text-right {
  text-align: right;
}

/* Login Screen Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 400px;
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: fadeInScale 0.5s ease-out;
}

.login-brand {
  text-align: center;
  margin-bottom: 30px;
}

.login-brand .brand-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 15px;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.login-brand h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.password-wrapper {
  position: relative;
  display: flex;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.btn-toggle-password:hover {
  color: var(--text-primary);
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.remember-me input {
  accent-color: var(--primary);
  cursor: pointer;
}

.login-error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--danger);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================
   END OF STYLESHEET
   ======================================================== */