/* ============================================================
   ATHENA FLEET MANAGEMENT — css/style.css  (Colorful Theme)
   Athena Global School Fleet Portal
   Google Fonts: Nunito + Fira Code
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Fira+Code:wght@400;500&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --primary:        #6366F1;
  --primary-dark:   #4F46E5;
  --primary-light:  #EEF2FF;
  --accent:         #F59E0B;
  --accent2:        #EC4899;
  --success:        #10B981;
  --success-bg:     #ECFDF5;
  --success-border: #6EE7B7;
  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --warning-border: #FCD34D;
  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FCA5A5;
  --info:           #3B82F6;
  --info-bg:        #EFF6FF;

  --bg:             #F0F4FF;
  --card:           #FFFFFF;
  --surface:        #F8FAFF;
  --border:         #E0E7FF;
  --border-strong:  #C7D2FE;

  --text:           #1E1B4B;
  --text-muted:     #6B7280;
  --text-light:     #9CA3AF;

  /* Navbar: deep indigo gradient */
  --nav-bg:         #312E81;
  --nav-h:          64px;

  --shadow-sm: 0 1px 3px rgba(99,102,241,0.08);
  --shadow:    0 2px 8px rgba(99,102,241,0.10), 0 4px 20px rgba(99,102,241,0.06);
  --shadow-lg: 0 8px 24px rgba(99,102,241,0.14), 0 20px 40px rgba(99,102,241,0.08);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font:      'Nunito', sans-serif;
  --mono:      'Fira Code', monospace;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse at 20% 0%, rgba(99,102,241,0.06) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 100%, rgba(236,72,153,0.04) 0%, transparent 60%);
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C7D2FE; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════ */
.navbar {
  background: linear-gradient(135deg, #312E81 0%, #4338CA 60%, #6366F1 100%);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 4px 24px rgba(49,46,129,0.5);
  margin-left: 240px;
  transition: margin-left 0.25s ease;
}
.sidebar.collapsed ~ .navbar,
.sidebar.collapsed ~ * .navbar {
  margin-left: 60px;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-right: 20px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: #FCD34D;
  letter-spacing: 0.04em;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.nav-link.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.25);
}

/* Nav Actions (right side) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* User info */
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.15);
}

.user-info .icon { font-size: 15px; }

/* Alerts bell button */
.btn-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.85);
  font-size: 17px;
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.btn-icon .icon { font-size: 18px; line-height: 1; }

/* Badge on icon */
.badge-dot, .notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: #EF4444;
  border-radius: 99px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #4338CA;
  font-family: var(--font);
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #3730A3 100%);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
  transform: translateY(-1px);
}

.btn-primary .icon { font-size: 14px; }

/* Secondary button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: var(--primary);
  border: 2px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99,102,241,0.15);
}

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════ */
.main-content {
  max-width: none;
  margin: 0;
  padding: 28px 24px 48px;
  margin-left: 240px;
  transition: margin-left 0.25s ease;
}
.sidebar.collapsed ~ * .main-content,
.sidebar.collapsed ~ .main-content {
  margin-left: 60px;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.15;
  background: linear-gradient(135deg, #1E1B4B 0%, #4338CA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .subtitle,
.page-header p.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  -webkit-text-fill-color: var(--text-muted);
}

/* ── Critical Alert Banner ───────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  border-left: 5px solid var(--danger);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 22px;
}

.alert-banner .icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }

.alert-banner .alert-title {
  font-size: 15px;
  font-weight: 800;
  color: #7F1D1D;
  margin-bottom: 2px;
}

.alert-banner .alert-subtitle {
  font-size: 13px;
  color: #B91C1C;
}

/* ══════════════════════════════════════════════════════════
   METRICS GRID  (the KPI cards)
══════════════════════════════════════════════════════════ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

/* Each metric card */
.metric-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  opacity: 0.06;
}

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

/* Colorful top borders per card */
.metric-card:nth-child(1) { border-top-color: #6366F1; }
.metric-card:nth-child(1)::after { background: #6366F1; }

.metric-card:nth-child(2) { border-top-color: #10B981; }
.metric-card:nth-child(2)::after { background: #10B981; }

.metric-card:nth-child(3) { border-top-color: #F59E0B; }
.metric-card:nth-child(3)::after { background: #F59E0B; }

.metric-card:nth-child(4) { border-top-color: #3B82F6; }
.metric-card:nth-child(4)::after { background: #3B82F6; }

.metric-card:nth-child(5) { border-top-color: #8B5CF6; }
.metric-card:nth-child(5)::after { background: #8B5CF6; }

.metric-card:nth-child(6) { border-top-color: #EC4899; }
.metric-card:nth-child(6)::after { background: #EC4899; }

.metric-card.alert-card { border-top-color: var(--danger); }

/* Metric header row */
.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.metric-header h3 {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-header .icon {
  font-size: 24px;
  line-height: 1;
}

/* Big number */
.metric-value {
  font-size: 42px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.metric-value .unit {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* Subtitle under value */
.metric-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Warning text inside metric card */
.metric-warning {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--warning);
  background: var(--warning-bg);
  padding: 4px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--warning-border);
}

/* Branch breakdown inside fleet card */
.branch-breakdown {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.branch-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.branch-breakdown-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  display: inline-block;
}

/* Alert breakdown badges */
.alert-breakdown {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.badge-critical {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--danger-border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-critical::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid #BFDBFE;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-info::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--info);
  display: inline-block;
}

/* ══════════════════════════════════════════════════════════
   SECTION CARD
══════════════════════════════════════════════════════════ */
.section-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 24px;
}

.section-card > h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Branch Grid ─────────────────────────────────────────── */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.branch-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.branch-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366F1, #8B5CF6);
}

.branch-card:nth-child(2)::before { background: linear-gradient(90deg, #10B981, #06B6D4); }
.branch-card:nth-child(3)::before { background: linear-gradient(90deg, #F59E0B, #EC4899); }

.branch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.branch-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.branch-curriculum {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 14px;
}

.branch-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.branch-stat {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.branch-stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.04em;
}

.branch-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.branch-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  margin-top: 12px;
}

.branch-status.active {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.branch-status.active::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.branch-status.partial {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.branch-status.partial::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ══════════════════════════════════════════════════════════
   ALERTS DROPDOWN
══════════════════════════════════════════════════════════ */
.dropdown {
  position: absolute;
  top: 70px;
  right: 70px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(99,102,241,0.2);
  border: 1px solid var(--border);
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 9999;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
}

.dropdown-header h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.link-primary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}

.link-primary:hover { text-decoration: underline; }

.alerts-list { padding: 8px; }

.alert-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  cursor: pointer;
}

.alert-item:hover { background: var(--surface); }

/* ══════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════ */
.table-container,
.table-wrapper {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

thead tr {
  background: linear-gradient(135deg, #EEF2FF 0%, #F0F4FF 100%);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: #F5F7FF; }

td {
  padding: 13px 16px;
  color: var(--text);
  vertical-align: middle;
}

/* Plate number */
.plate, .vehicle-plate {
  font-family: var(--mono);
  font-size: 12.5px;
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  border: 1px solid var(--border-strong);
  color: var(--primary-dark);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  font-weight: 700;
}

/* Driver avatar */
.driver-avatar, .avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #C7D2FE, #DDD6FE);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
  margin-right: 10px;
  vertical-align: middle;
}

.emp-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

a[href^="tel:"] {
  color: var(--primary);
  font-family: var(--mono);
  font-size: 12.5px;
}
a[href^="tel:"]:hover { text-decoration: underline; }

/* Fuel bar */
.fuel-bar-wrap {
  width: 64px; height: 6px;
  background: var(--surface);
  border-radius: 99px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.fuel-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #10B981, #34D399);
  transition: width 0.5s ease;
}

.fuel-bar.low    { background: linear-gradient(90deg, #EF4444, #F87171); }
.fuel-bar.medium { background: linear-gradient(90deg, #F59E0B, #FCD34D); }

.fuel-pct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════════════════════════ */
.badge, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-success, .status-active, .status-operational {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-warning, .status-pending, .status-service {
  background: var(--warning-bg);
  color: #B45309;
  border: 1px solid var(--warning-border);
}

.badge-danger, .status-inactive, .status-expired {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* ══════════════════════════════════════════════════════════
   FORMS & INPUTS
══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

label, .form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #4338CA;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="search"],
select,
textarea,
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus, .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

input::placeholder, textarea::placeholder { color: var(--text-light); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366F1' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Filter bar */
.filter-bar {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.filter-bar input,
.filter-bar select {
  width: auto; flex: 1;
  min-width: 140px; max-width: 220px;
}

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tab-bar, .tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab, .tab-item {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border: none;
  background: none;
}

.tab:hover, .tab-item:hover { color: var(--text); background: rgba(99,102,241,0.06); }

.tab.active, .tab-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

/* ══════════════════════════════════════════════════════════
   CARDS (generic)
══════════════════════════════════════════════════════════ */
.card, .panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, #F0F4FF 100%);
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.card-body { padding: 22px; }

.card-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   ALERTS PAGE
══════════════════════════════════════════════════════════ */
.alert-item-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  margin-bottom: 12px;
  transition: all 0.15s;
}

.alert-item-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.alert-item-card.critical {
  border-left: 4px solid var(--danger);
  background: var(--danger-bg);
}

.alert-item-card.warning {
  border-left: 4px solid var(--warning);
  background: var(--warning-bg);
}

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay, .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(30,27,75,0.55);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.modal, .modal-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(99,102,241,0.25);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, #EEF2FF 100%);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-body  { padding: 22px 24px; }

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  transition: all 0.15s;
  background: none; border: none;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  cursor: pointer;
  background: var(--card);
  transition: all 0.15s;
  text-decoration: none;
}

.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-color: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(99,102,241,0.3); }

/* ══════════════════════════════════════════════════════════
   SKELETON LOADER
══════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -500px 0; }
  100% { background-position: 500px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #EEF2FF 25%, #E0E7FF 50%, #EEF2FF 75%);
  background-size: 500px 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}

.empty-state .icon { font-size: 40px; margin-bottom: 14px; opacity: 0.45; }

.empty-state h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 280px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   GRID LAYOUTS
══════════════════════════════════════════════════════════ */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.text-muted      { color: var(--text-muted); }
.text-sm         { font-size: 12px; }
.font-bold       { font-weight: 800; }
.font-mono       { font-family: var(--mono); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.hidden { display: none !important; }
hr, .divider { border: none; border-top: 2px solid var(--border); margin: 16px 0; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR (Dashboard)
══════════════════════════════════════════════════════════ */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(49,46,129,0.4);
  overflow-y: auto;
  transition: width 0.25s ease, transform 0.25s ease;
}

/* ── Sidebar Collapse Toggle Button ── */
.sidebar-collapse-btn {
  position: absolute;
  top: 12px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #4338CA;
  border: 2px solid #fff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 610;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.25s ease;
}
.sidebar-collapse-btn:hover { background: #6366F1; }
.sidebar-collapse-btn svg { width: 14px; height: 14px; transition: transform 0.25s ease; }

/* ── Collapsed sidebar state ── */
.sidebar.collapsed {
  width: 60px;
}
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .branch-selector,
.sidebar.collapsed .nav-group-toggle span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-logo-sub,
.sidebar.collapsed .user-info-sidebar,
.sidebar.collapsed .logout-btn span,
.sidebar.collapsed .logout-btn {
  display: none;
}
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 8px;
}
.sidebar.collapsed .nav-group-toggle {
  justify-content: center;
  padding: 6px 8px;
}
.sidebar.collapsed .nav-group-items {
  padding-left: 0;
}
.sidebar.collapsed .sidebar-footer {
  padding: 12px 8px;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
}
.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* ── Offset main content when sidebar is collapsed ── */
.sidebar.collapsed ~ .dashboard-content,
.sidebar.collapsed ~ .main-wrapper {
  margin-left: 60px;
}
.sidebar.collapsed ~ .main-wrapper .topbar,
.sidebar.collapsed ~ .dashboard-content .topbar {
  left: 60px;
}

/* ── Overlay for mobile sidebar ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 590;
}
.overlay.active { display: block; }

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

.sidebar-logo {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span {
  font-size: 13px;
  font-weight: 700;
  color: #FCD34D;
}

.sidebar-nav { flex: 1; padding: 16px 10px; }

.nav-section {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  font-weight: 700;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.nav-item .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 99px;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
}

/* ── Collapsible nav groups ──────────────────────────────────── */
.nav-group {
  margin-bottom: 2px;
}
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-group-toggle:hover {
  color: rgba(255,255,255,0.7);
}
.nav-group-chevron {
  width: 12px; height: 12px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.nav-group.open .nav-group-chevron {
  transform: rotate(90deg);
}
.nav-group-items {
  display: none;
  padding-left: 8px;
}
.nav-group.open .nav-group-items {
  display: block;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-user:hover { background: rgba(255,255,255,0.08); }

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #818CF8, #A78BFA);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
}

.sidebar-user-role {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD LAYOUT (sidebar + content)
══════════════════════════════════════════════════════════ */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.dashboard-content {
  flex: 1;
  margin-left: 240px;
  min-width: 0;
  padding-top: var(--nav-h);
}

/* ══════════════════════════════════════════════════════════
   TOPBAR (dashboard-specific)
══════════════════════════════════════════════════════════ */
.topbar {
  height: var(--nav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0; right: 0;
  left: 240px;
  z-index: 400;
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .metrics-grid  { grid-template-columns: repeat(3, 1fr); }
  .branch-grid   { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .metrics-grid  { grid-template-columns: repeat(2, 1fr); }
  .branch-grid   { grid-template-columns: 1fr; }
  .nav-container { padding: 0 16px; }
}

@media (max-width: 768px) {
  .main-content  { padding: 16px; }
  .metrics-grid  { grid-template-columns: 1fr 1fr; gap: 12px; }
  .nav-links     { display: none; }
  .metric-value  { font-size: 32px; }
  .page-header h1{ font-size: 22px; -webkit-text-fill-color: var(--text); }
  .grid-2, .grid-3, .grid-4, .grid-2-1 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  td, th { padding: 9px 10px; }
}

@media (max-width: 480px) {
  .metrics-grid  { grid-template-columns: 1fr; }
  .metric-value  { font-size: 28px; }
  .nav-actions   { gap: 4px; }
  .user-info     { display: none; }
}
