/* ============================================================
   ULF MIS Portal — Design System
   Palette: Forest Green #323f2f (Primary) + Gold #ffd700 (Secondary)
   Fonts: Bricolage Grotesque (display) + Plus Jakarta Sans (body)
   ============================================================ */

:root {
  /* Core Palette — Forest Green Primary */
  --indigo-950: #1a2118;
  --indigo-900: #323f2f;
  --indigo-800: #3d4e39;
  --indigo-700: #4a5e44;
  --indigo-600: #5a7254;
  --indigo-500: #7a9a72;
  --indigo-400: #9ab892;
  --indigo-200: #c8dcc4;
  --indigo-100: #e4efe2;
  --indigo-50:  #f2f8f1;

  /* Gold Secondary */
  --amber-600: #c9a800;
  --amber-500: #ffd700;
  --amber-400: #ffe033;
  --amber-300: #ffea66;
  --amber-100: #fff8cc;
  --amber-50:  #fffde8;

  --surface-0: #FAFAF9;
  --surface-1: #F4F5F2;
  --surface-2: #E6E9E4;
  --surface-3: #D2D8CF;

  --text-primary: #1a2118;
  --text-secondary: #3d4e39;
  --text-muted: #7a8a76;
  --text-inverse: #FAFAF9;

  --green-500: #22C55E;
  --green-100: #DCFCE7;
  --red-500: #EF4444;
  --red-100: #FEE2E2;
  --orange-500: #F97316;
  --orange-100: #FFEDD5;
  --blue-500: #3B82F6;
  --blue-100: #DBEAFE;

  /* Spacing */
  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --topbar-h: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,33,24,0.08), 0 1px 2px rgba(26,33,24,0.04);
  --shadow-md: 0 4px 12px rgba(26,33,24,0.10), 0 2px 4px rgba(26,33,24,0.06);
  --shadow-lg: 0 12px 32px rgba(26,33,24,0.14), 0 4px 8px rgba(26,33,24,0.08);
  --shadow-glow: 0 0 0 3px rgba(50,63,47,0.25);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--surface-1);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bricolage Grotesque', sans-serif;
  line-height: 1.2;
  font-weight: 700;
}

a { text-decoration: none; cursor: pointer; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.hidden { display: none !important; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--indigo-950);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.login-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #4a5e44, transparent);
  top: -150px; left: -100px;
  animation: orb-float 8s ease-in-out infinite;
}

.login-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #ffd700, transparent);
  bottom: -100px; right: -80px;
  animation: orb-float 10s ease-in-out infinite reverse;
}

.login-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #7a9a72, transparent);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orb-float 12s ease-in-out infinite;
}

@keyframes orb-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.login-card {
  position: relative;
  z-index: 10;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(123,104,238,0.15);
  animation: card-in 0.6s var(--ease) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.logo-mark {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--indigo-600), var(--amber-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-inverse);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #FCA5A5;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-size: 0.95rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}

.form-input::placeholder { color: rgba(255,255,255,0.3); }

.form-input:focus {
  border-color: var(--indigo-400);
  box-shadow: var(--shadow-glow);
}

.input-wrap { position: relative; }

.input-wrap .form-input { padding-right: 3rem; }

.eye-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  padding: 0.25rem;
  transition: color var(--dur);
}

.eye-btn:hover { color: rgba(255,255,255,0.8); }

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-900));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--dur) var(--ease);
  margin-top: 0.5rem;
  box-shadow: 0 4px 16px rgba(50,63,47,0.45);
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(50,63,47,0.55);
}

.btn-login:active { transform: translateY(0); }

.login-demo {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
}

.demo-label { margin-right: 0.25rem; }

.login-demo code {
  background: rgba(255,255,255,0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--amber-300);
  font-size: 0.82rem;
}

.login-badges {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.badge-item {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--indigo-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--dur) var(--ease);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.logo-mark-sm {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--indigo-600), var(--amber-500));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  overflow: hidden;
}

.sb-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  line-height: 1.2;
}

.sb-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: all var(--dur);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0.75rem 0.5rem 0.35rem;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
  position: relative;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(90,114,84,0.45), rgba(74,94,68,0.25));
  color: white;
  border: 1px solid rgba(255,215,0,0.25);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--amber-400);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  white-space: nowrap;
}

.nav-badge.ai {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: white;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--indigo-600), var(--amber-500));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
}

.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  transition: all var(--dur);
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.15);
  color: #FCA5A5;
}

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

.sidebar.collapsed ~ .main-content,
.main-content.expanded {
  margin-left: var(--sidebar-collapsed);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
}

.breadcrumb {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  color: var(--text-muted);
}

.topbar-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 180px;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-btn {
  background: none;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  color: var(--text-secondary);
  transition: all var(--dur);
  position: relative;
}

.topbar-btn:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red-500);
  border-radius: 50%;
  border: 2px solid white;
}

.fy-badge {
  background: var(--indigo-100);
  color: var(--indigo-700);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* ============================================================
   MODULE PANELS
   ============================================================ */
.module-panel {
  display: none;
  padding: 1.75rem;
  flex: 1;
  animation: panel-in 0.3s var(--ease) both;
}

.module-panel.active { display: block; }

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

/* ============================================================
   DASHBOARD
   ============================================================ */
.panel-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.wave { display: inline-block; animation: wave 2s ease-in-out infinite; }

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-10deg); }
}

.hero-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.kpi-income::before { background: linear-gradient(90deg, var(--green-500), #86EFAC); }
.kpi-expense::before { background: linear-gradient(90deg, var(--red-500), #FCA5A5); }
.kpi-team::before { background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400)); }
.kpi-projects::before { background: linear-gradient(90deg, var(--amber-500), var(--amber-300)); }

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

.kpi-icon {
  font-size: 1.5rem;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.kpi-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 500;
}

.kpi-delta {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.kpi-delta.positive { color: var(--green-500); }
.kpi-delta.warning { color: var(--orange-500); }
.kpi-delta.neutral { color: var(--text-muted); }

/* AI ENTRY PANEL */
.ai-entry-panel {
  background: linear-gradient(135deg, var(--indigo-900), var(--indigo-800));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(90,114,84,0.4);
  box-shadow: 0 8px 32px rgba(26,33,24,0.2);
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ai-badge {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.ai-panel-desc {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 1rem;
}

.ai-textarea {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border-color var(--dur);
}

.ai-textarea::placeholder { color: rgba(255,255,255,0.3); }
.ai-textarea:focus { border-color: var(--indigo-400); }

.ai-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.ai-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--dur);
}

.ai-btn:hover {
  background: rgba(255,255,255,0.14);
  color: white;
}

.ai-btn-primary {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  border: none;
  color: white;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  margin-left: auto;
  transition: all var(--dur);
}

.ai-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,166,35,0.4);
}

.ai-result {
  margin-top: 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* DASHBOARD GRID */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.dash-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.dash-card-wide {
  grid-column: span 3;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

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

.card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-badge.live {
  background: var(--green-100);
  color: var(--green-500);
}

.card-badge.green {
  background: var(--green-100);
  color: var(--green-500);
}

.card-badge.ai {
  background: var(--amber-100);
  color: var(--amber-600);
}

.card-link {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--indigo-500);
  font-weight: 600;
  transition: color var(--dur);
}

.card-link:hover { color: var(--indigo-700); }

/* DEPT BARS */
.dept-bars { display: flex; flex-direction: column; gap: 0.85rem; }

.dept-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dept-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.dept-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface-1);
  border-radius: 4px;
  overflow: hidden;
}

.dept-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo-600), var(--indigo-400));
  border-radius: 4px;
  transition: width 1s var(--ease);
}

.dept-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  width: 36px;
  text-align: right;
}

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

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

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

.dot-green { background: var(--green-500); }
.dot-blue { background: var(--blue-500); }
.dot-amber { background: var(--amber-500); }
.dot-purple { background: var(--indigo-500); }

.activity-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* INSIGHTS GRID */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.insight-card {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.insight-positive {
  background: var(--green-100);
  border-color: rgba(34,197,94,0.2);
}

.insight-warning {
  background: var(--amber-100);
  border-color: rgba(245,166,35,0.2);
}

.insight-alert {
  background: var(--red-100);
  border-color: rgba(239,68,68,0.2);
}

.insight-neutral {
  background: var(--indigo-100);
  border-color: rgba(123,104,238,0.2);
}

.insight-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.insight-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.insight-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0.15rem 0;
}

.insight-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* HEALTH GRID */
.health-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.health-item {
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.health-val {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.health-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* QUICK GRID */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--dur);
}

.quick-btn span { font-size: 1.1rem; }

.quick-btn:hover {
  background: var(--indigo-100);
  border-color: var(--indigo-200);
  color: var(--indigo-700);
  transform: translateY(-2px);
}

/* ============================================================
   PANEL HEADER
   ============================================================ */
.panel-header {
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.panel-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: white;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.filter-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-primary);
  background: var(--surface-1);
  outline: none;
  cursor: pointer;
  transition: border-color var(--dur);
}

.filter-select:focus { border-color: var(--indigo-400); }

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.chart-card.chart-wide {
  grid-column: span 3;
}

.chart-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chart-header h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.chart-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.leader-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.leader-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* ============================================================
   MODULE TOOLBAR
   ============================================================ */
.module-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
}

.toolbar-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 200px;
}

/* ============================================================
   KPI MINI
   ============================================================ */
.kpi-mini-grid {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.kpi-mini {
  background: white;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-sm);
  flex: 1;
  min-width: 120px;
}

.km-val {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.km-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--surface-2);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--surface-1);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--surface-1); }

.full-table {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
  overflow: hidden;
}

.full-table th:first-child,
.full-table td:first-child { padding-left: 1.25rem; }

.full-table th:last-child,
.full-table td:last-child { padding-right: 1.25rem; }

.empty-row {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem !important;
}

/* ============================================================
   TAGS & BADGES
   ============================================================ */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-csr { background: var(--blue-100); color: var(--blue-500); }
.tag-gov { background: var(--green-100); color: var(--green-500); }
.tag-fcra { background: var(--orange-100); color: var(--orange-500); }
.tag-ind { background: var(--indigo-100); color: var(--indigo-600); }
.tag-yes { background: var(--green-100); color: var(--green-500); }
.tag-no { background: var(--surface-2); color: var(--text-muted); }

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.status-received { background: var(--green-100); color: var(--green-500); }
.status-pending { background: var(--amber-100); color: var(--amber-600); }
.status-critical { background: var(--red-100); color: var(--red-500); }

.tbl-btn {
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--dur);
}

.tbl-btn:hover {
  background: var(--indigo-100);
  border-color: var(--indigo-200);
  color: var(--indigo-700);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-900));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
  box-shadow: 0 2px 8px rgba(50,63,47,0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(50,63,47,0.45);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.btn-secondary:hover {
  background: var(--surface-1);
  border-color: var(--surface-3);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background: none;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--dur);
}

.btn-ghost:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background: var(--red-100);
  color: var(--red-500);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--dur);
}

.btn-danger:hover {
  background: var(--red-500);
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.78rem !important;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--dur);
  line-height: 1;
}

.close-btn:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

/* ============================================================
   BACKUP & SECURITY
   ============================================================ */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.backup-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.backup-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.backup-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.backup-stat {
  flex: 1;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.bs-val {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bs-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.backup-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* SECURITY TOGGLES */
.security-list { display: flex; flex-direction: column; gap: 0.85rem; }

.security-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
}

.sec-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sec-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--dur);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--dur);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--indigo-600);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ORG FORM */
.org-form .form-group { margin-bottom: 1rem; }

.org-form .form-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.org-form .form-input {
  background: var(--surface-1);
  border: 1px solid var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
}

.org-form .form-input:focus {
  border-color: var(--indigo-400);
  box-shadow: var(--shadow-glow);
  outline: none;
}

/* ============================================================
   SETUP GRID
   ============================================================ */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.setup-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.setup-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.setup-card-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   ADMIN GRID
   ============================================================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.admin-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-2);
}

.admin-card-wide { grid-column: span 2; }

.admin-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-card-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.count-badge {
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.count-red {
  background: var(--red-100);
  color: var(--red-500);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem;
  font-style: italic;
}

/* ============================================================
   PERMISSIONS NOTE
   ============================================================ */
.permissions-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  color: var(--indigo-700);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,7,32,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 0.2s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.3s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--surface-2);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-card-wide { grid-column: span 2; }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-card.chart-wide { grid-column: span 2; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 72px; }
  .sidebar-brand, .nav-item span, .nav-badge, .nav-section-label,
  .user-info, .sb-name, .sb-sub { display: none; }
  .nav-item { justify-content: center; padding: 0.7rem; }
  .nav-item.active::before { display: none; }
  .sidebar-header { justify-content: center; }
  .sidebar-toggle { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar.mobile-open { transform: translateX(0); width: 260px !important; }
  .sidebar.mobile-open .sidebar-brand,
  .sidebar.mobile-open .nav-item span,
  .sidebar.mobile-open .nav-badge,
  .sidebar.mobile-open .nav-section-label,
  .sidebar.mobile-open .user-info { display: flex; }
  .sidebar.mobile-open .nav-item { justify-content: flex-start; padding: 0.6rem 0.75rem; }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .topbar-search { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card-wide { grid-column: span 1; }
  .insights-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.chart-wide { grid-column: span 1; }
  .leaderboard-grid { grid-template-columns: 1fr; }
  .backup-grid { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card-wide { grid-column: span 1; }
  .module-panel { padding: 1rem; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-mini-grid { flex-direction: column; }
  .hero-title { font-size: 1.35rem; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
}