/* ============================================================
   PENSION REPORTS — main.css
   Aesthetic: Refined Financial Luxury
   Palette: Deep navy + electric lime + ivory
   Typography: Playfair Display (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&family=DM+Mono:wght@300;400;500&display=swap');

/* ─────────────────────────────────────────────
   CSS CUSTOM PROPERTIES
───────────────────────────────────────────── */
:root {
  /* Core palette */
  --navy-950:   #060c1a;
  --navy-900:   #0b1426;
  --navy-800:   #0f1d38;
  --navy-700:   #162447;
  --navy-600:   #1e3460;
  --navy-500:   #264878;
  --navy-400:   #3a6399;
  --navy-300:   #5a83b8;
  --navy-200:   #8aadd4;
  --navy-100:   #c2d5eb;
  --navy-50:    #eaf0f8;

  --gold-900:   #1a3600;
  --gold-800:   #2e5c00;
  --gold-700:   #3f7a00;
  --gold-600:   #55a300;
  --gold-500:   #76f11f;
  --gold-400:   #92f445;
  --gold-300:   #aef76e;
  --gold-200:   #cefaa4;
  --gold-100:   #e4fcd0;
  --gold-50:    #f2fde8;

  --ivory:      #f8f5ef;
  --ivory-dark: #ede8df;
  --cream:      #faf7f2;

  --slate-800:  #1e2533;
  --slate-700:  #2d3548;
  --slate-600:  #3d4760;
  --slate-500:  #5a6480;
  --slate-400:  #7d8ba8;
  --slate-300:  #a8b3c8;
  --slate-200:  #d0d8e8;
  --slate-100:  #eaecf5;
  --slate-50:   #f4f5fa;

  --success:    #1a7a4a;
  --success-bg: #e8f5ee;
  --warning:    #b8720a;
  --warning-bg: #fef3e0;
  --danger:     #9b2335;
  --danger-bg:  #fceaed;
  --info:       #1a5f8a;
  --info-bg:    #e5f2fa;

  /* Semantic tokens */
  --bg-base:        var(--cream);
  --bg-surface:     #ffffff;
  --bg-surface-alt: var(--ivory);
  --bg-sidebar:     var(--navy-900);
  --bg-sidebar-alt: var(--navy-800);

  --text-primary:   var(--navy-900);
  --text-secondary: var(--slate-500);
  --text-muted:     var(--slate-400);
  --text-inverse:   #ffffff;
  --text-gold:      var(--gold-500);

  --border-light:   var(--slate-200);
  --border-medium:  var(--slate-300);
  --border-strong:  var(--slate-400);

  --accent:         var(--gold-500);
  --accent-hover:   var(--gold-400);
  --accent-dark:    var(--gold-700);

  /* Layout */
  --sidebar-width:      260px;
  --sidebar-collapsed:  72px;
  --topbar-height:      64px;
  --content-max-width:  1440px;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

  /* Elevation / Shadows */
  --shadow-xs:  0 1px 2px rgba(6, 12, 26, 0.06);
  --shadow-sm:  0 1px 4px rgba(6, 12, 26, 0.08), 0 1px 2px rgba(6, 12, 26, 0.04);
  --shadow-md:  0 4px 12px rgba(6, 12, 26, 0.10), 0 2px 4px rgba(6, 12, 26, 0.06);
  --shadow-lg:  0 8px 24px rgba(6, 12, 26, 0.12), 0 4px 8px rgba(6, 12, 26, 0.06);
  --shadow-xl:  0 16px 48px rgba(6, 12, 26, 0.16), 0 8px 16px rgba(6, 12, 26, 0.08);
  --shadow-gold: 0 4px 20px rgba(118, 241, 31, 0.22);

  /* Border radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* 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);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ─────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--navy-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--accent); }

img, svg { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-6) 0;
}


/* ─────────────────────────────────────────────
   TYPOGRAPHY
───────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-weight: 300;
  margin-top: var(--space-1);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.text-gold {
  color: var(--gold-500);
  font-family: var(--font-display);
  font-style: italic;
}

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }


/* ─────────────────────────────────────────────
   APP SHELL LAYOUT
───────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

.content-area {
  flex: 1;
  padding: var(--space-8);
  max-width: var(--content-max-width);
  width: 100%;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}


/* ─────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-base);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* Subtle noise texture overlay for depth */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

/* Brand / Logo area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: var(--topbar-height);
  text-decoration: none;
}

.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--navy-900);
  box-shadow: var(--shadow-gold);
}

.brand-text {
  overflow: hidden;
  transition: opacity var(--transition-base), width var(--transition-base);
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.brand-tagline {
  font-size: var(--text-xs);
  color: var(--navy-300);
  white-space: nowrap;
  font-weight: 300;
  letter-spacing: 0.04em;
}

/* Nav sections */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
}

.nav-section {
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy-400);
  padding: var(--space-4) var(--space-3) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-base);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--navy-200);
  font-size: var(--text-sm);
  font-weight: 400;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(118, 241, 31, 0.12);
  color: var(--gold-300);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--gold-400);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.nav-item.active .nav-item-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(118, 241, 31, 0.22);
  color: var(--gold-300);
  white-space: nowrap;
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.user-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--navy-500), var(--navy-400));
  border: 2px solid rgba(118, 241, 31, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold-300);
  overflow: hidden;
}

.user-info { overflow: hidden; }

.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--navy-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ─────────────────────────────────────────────
   TOPBAR
───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.breadcrumb-sep {
  color: var(--border-medium);
  font-size: var(--text-xs);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-btn:hover {
  background: var(--slate-50);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.topbar-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--gold-500);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--bg-surface);
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 var(--space-2);
}


/* ─────────────────────────────────────────────
   CARDS
───────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface-alt);
}

/* KPI / Stat cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-pct   { font-size:11px; font-weight:bold; color:#3b414b; }

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover::after { opacity: 1; }

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-value-sm {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1;
}

.stat-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-delta.up {
  color: var(--success);
  background: var(--success-bg);
}

.stat-delta.down {
  color: var(--danger);
  background: var(--danger-bg);
}

.stat-icon {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-50);
  color: var(--navy-600);
}

.stat-icon.gold {
  background: var(--gold-100);
  color: var(--gold-700);
}


/* ─────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  height: 38px;
}

.btn:focus-visible {
  outline: 2px solid var(--gold-400);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--navy-800);
  color: #ffffff;
  border-color: var(--navy-800);
}

.btn-primary:hover {
  background: var(--navy-700);
  border-color: var(--navy-700);
  box-shadow: var(--shadow-md);
  color: #ffffff;
}

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
  font-weight: 600;
}

.btn-gold:hover {
  background: var(--gold-400);
  border-color: var(--gold-400);
  box-shadow: var(--shadow-gold);
  color: var(--navy-900);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-outline:hover {
  background: var(--slate-50);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #7a1a28;
  color: #ffffff;
}

.btn-sm {
  height: 30px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 46px;
  padding: var(--space-3) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
}

.btn-icon.btn-sm { width: 30px; height: 30px; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
}

.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-group .btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-right-width: 1px;
}


/* ─────────────────────────────────────────────
   FORMS
───────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--navy-400);
  box-shadow: 0 0 0 3px rgba(30, 52, 96, 0.08);
}

.form-control::placeholder { color: var(--slate-300); }

.form-control:disabled {
  background: var(--slate-50);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  height: auto;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a6480' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-1);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(155, 35, 53, 0.08);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* Filter bar used in report pages */
.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }


/* ─────────────────────────────────────────────
   TABLES
───────────────────────────────────────────── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--bg-surface);
}

.table thead {
  background: var(--navy-900);
  color: #ffffff;
}

.table thead th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  border: none;
  color: var(--navy-100);
}

.table thead th:first-child { border-radius: var(--radius-xl) 0 0 0; }
.table thead th:last-child  { border-radius: 0 var(--radius-xl) 0 0; }

.table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.table tbody tr:last-child { border-bottom: none; }

.table tbody tr:hover { background: var(--navy-50); }

.table tbody td {
  padding: var(--space-3) var(--space-5);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody td.text-muted { color: var(--text-muted); }

.table-striped tbody tr:nth-child(even) {
  background: var(--ivory);
}

.table-striped tbody tr:nth-child(even):hover {
  background: var(--navy-50);
}

/* Table cell badges */
.table .cell-number {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: right;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pagination {
  display: flex;
  gap: var(--space-1);
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.page-link:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
  color: var(--navy-700);
}

.page-link.active {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #ffffff;
}


/* ─────────────────────────────────────────────
   BADGES & TAGS
───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-navy    { background: var(--navy-100);   color: var(--navy-800); }
.badge-gold    { background: var(--gold-100);   color: var(--gold-800); }
.badge-success { background: var(--success-bg); color: var(--success);  }
.badge-warning { background: var(--warning-bg); color: var(--warning);  }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);   }
.badge-info    { background: var(--info-bg);    color: var(--info);     }
.badge-neutral { background: var(--slate-100);  color: var(--slate-600);}

.badge-dot::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────
   ALERTS & MESSAGES
───────────────────────────────────────────── */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
}

.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

.alert-success { background: var(--success-bg); color: var(--success);  border-color: #b5ddc9; }
.alert-warning { background: var(--warning-bg); color: var(--warning);  border-color: #f5d49a; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);   border-color: #f0b8c0; }
.alert-error  { background: var(--danger-bg);  color: var(--danger);   border-color: #f0b8c0; }
.alert-info    { background: var(--info-bg);    color: var(--info);     border-color: #a8d0e8; }


/* ─────────────────────────────────────────────
   MODALS
───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 26, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.modal-backdrop.open { opacity: 1; }

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-spring);
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  background: var(--bg-surface-alt);
}


/* ─────────────────────────────────────────────
   LOADING STATES
───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--slate-100) 25%,
    var(--slate-50)  50%,
    var(--slate-100) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--navy-700);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ─────────────────────────────────────────────
   CHART CONTAINERS
───────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────
   EMPTY STATES
───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--slate-100);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: var(--space-6);
}


/* ─────────────────────────────────────────────
   DROPDOWN MENUS
───────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  z-index: 150;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: all var(--transition-base);
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--slate-50);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-2) 0;
}


/* ─────────────────────────────────────────────
   TOOLTIPS
───────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-900);
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 300;
}

[data-tooltip]:hover::after { opacity: 1; }


/* ─────────────────────────────────────────────
   UTILITY CLASSES
───────────────────────────────────────────── */
.d-flex         { display: flex; }
.d-grid         { display: grid; }
.d-none         { display: none; }
.d-block        { display: block; }

.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.justify-center { justify-content: center; }

.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }

.text-left    { text-align: left; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }

.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.font-light   { font-weight: 300; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.italic       { font-style: italic; }

.text-primary   { color: var(--text-primary);   }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted);     }
.text-success   { color: var(--success);        }
.text-danger    { color: var(--danger);         }
.text-warning   { color: var(--warning);        }

.w-full   { width: 100%; }
.h-full   { height: 100%; }
.min-w-0  { min-width: 0; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.overflow-hidden { overflow: hidden; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-6) 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* ─────────────────────────────────────────────
   PAGE TRANSITIONS
───────────────────────────────────────────── */
.page-enter {
  animation: page-in var(--transition-slow) ease forwards;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fade-in var(--transition-base) ease forwards;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.slide-up {
  animation: slide-up var(--transition-base) ease forwards;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: var(--space-6); }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: var(--sidebar-collapsed);
  }

  .sidebar .brand-text,
  .sidebar .nav-section-label,
  .sidebar .nav-item span,
  .sidebar .user-info {
    display: none;
  }

  .nav-badge { display: none; }
}

@media (max-width: 768px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .content-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
}


/* main.css — icon sizing to match old SVG nav-item-icon behaviour */
.nav-item-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.topbar-btn i,
.topbar-btn .fa-solid {
  font-size: 15px;
}

/* Dark mode toggle — show moon in light, sun in dark */
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: inline; }