/* ─────────────────────────────────────────────────────────────
   GLOBAL.CSS - Complete Design System for InsuraTrack
   Includes: Variables, Reset, Layout, Components, Utilities
   ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────────────────────────────────────────
   CSS VARIABLES (Enhanced Color Scheme)
   ───────────────────────────────────────────────────────────── */

:root {
  /* Light Theme Colors */
  --bg-base: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #eef2ff;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-active: #3b82f6;
  
  --text-primary: #0a0f1c;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;
  
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.08);
  --accent-soft: rgba(59, 130, 246, 0.12);
  
  --green: #10b981;
  --green-dark: #059669;
  --green-soft: rgba(16, 185, 129, 0.1);
  --green-glow: rgba(16, 185, 129, 0.2);
  
  --red: #ef4444;
  --red-dark: #dc2626;
  --red-soft: rgba(239, 68, 68, 0.1);
  
  --yellow: #f59e0b;
  --yellow-dark: #d97706;
  --yellow-soft: rgba(245, 158, 11, 0.1);
  
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --purple-soft: rgba(139, 92, 246, 0.1);
  
  --cyan: #06b6d4;
  --cyan-dark: #0891b2;
  --cyan-soft: rgba(6, 182, 212, 0.1);
  
  --orange: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.1);
  
  --pink: #ec4899;
  --pink-soft: rgba(236, 72, 153, 0.1);
  
  /* Spacing & Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --navbar-height: 70px;
  
  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.05), 0 8px 20px -6px rgba(0,0,0,0.08);
  --shadow-elevated: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.02);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-base: #0a0f1c;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --bg-card: #1e293b;
  --bg-hover: #2d3a4f;
  --bg-active: #1e3a8a;
  
  --border: #2d3a4f;
  --border-light: #1f2937;
  
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  
  --accent: #60a5fa;
  --accent-dark: #3b82f6;
  --accent-glow: rgba(96, 165, 250, 0.1);
  --accent-soft: rgba(96, 165, 250, 0.15);
  
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 20px -6px rgba(0, 0, 0, 0.2);
  --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   GLOBAL RESETS & BASE STYLES
   ───────────────────────────────────────────────────────────── */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-dark);
}

/* Selection */
::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────
   LAYOUT - SIDEBAR & NAVBAR
   ───────────────────────────────────────────────────────────── */

#app {
  display: contents;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
  transition: opacity var(--transition-base);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: transform var(--transition-fast);
}

.logo-icon:hover {
  transform: scale(1.05);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
  stroke: white;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-text span:first-child {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-logo-text span:last-child {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.nav-item:hover svg,
.nav-item.active svg {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.user-avatar:hover {
  transform: scale(1.05);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.logout-btn:hover {
  background: var(--red-soft);
  color: var(--red);
  transform: scale(1.05);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.navbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  background: transparent;
  border: none;
}

.nav-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.notif-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.hamburger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  background: var(--bg-base);
  padding: 24px;
  transition: margin-left var(--transition-slow);
}

/* ─────────────────────────────────────────────────────────────
   NOTIFICATION DROPDOWN (FIXED POSITION)
   ───────────────────────────────────────────────────────────── */

.notif-dropdown {
  position: fixed;
  top: calc(var(--navbar-height) + 8px);
  right: 24px;
  width: 380px;
  max-height: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 95;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown var(--transition-base);
}

.notif-dropdown.hidden {
  display: none;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notif-item:hover {
  background: var(--bg-hover);
}

.notif-item.unread {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notif-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  word-break: break-word;
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.notif-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: all var(--transition-fast);
}

.notif-item:hover .notif-delete {
  opacity: 1;
}

.notif-delete:hover {
  background: var(--red-soft);
  color: var(--red);
}

.notif-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.notif-empty svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 4px 12px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-dark);
  transform: translateY(-1px);
  border-color: var(--red);
}

.btn-success {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green-dark);
  transform: translateY(-1px);
  border-color: var(--green);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  gap: 6px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  aspect-ratio: 1;
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ─────────────────────────────────────────────────────────────
   CARDS & STATS GRID (FIXED)
   ───────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-4deg);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Charts Row */
.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-card);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  padding: 14px 20px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon.danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* ─────────────────────────────────────────────────────────────
   BADGES (Removed Payment Badges)
   ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-active {
  background: var(--green-soft);
  color: var(--green);
}

.badge-expired {
  background: var(--red-soft);
  color: var(--red);
}

.badge-expiring {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.badge-purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.badge-info,
.badge-gray {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.badge-cyan {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.badge-orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge-pink {
  background: var(--pink-soft);
  color: var(--pink);
}

/* Role Badges for Users */
.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.role-admin {
  background: var(--purple-soft);
  color: var(--purple);
}

.role-user {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.status-active {
  background: var(--green-soft);
  color: var(--green);
}

.status-inactive {
  background: var(--red-soft);
  color: var(--red);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 12px 16px;
  transition: all var(--transition-fast);
  width: 100%;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--accent-light);
}

.form-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
  padding: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

/* Upload Box */
.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-surface);
  position: relative;
}

.upload-box:hover,
.upload-box.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-box.has-file {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ub-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.ub-label {
  font-size: 12px;
  color: var(--text-muted);
}

.ub-chosen {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  margin-top: 8px;
  word-break: break-all;
}

/* Form Section Title */
.form-section-title {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.req-badge {
  display: inline-block;
  font-size: 9px;
  color: var(--red);
  background: var(--red-soft);
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* Renew Banner */
.renew-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}

/* Pincode Styles */
.pincode-success {
  border-color: var(--green) !important;
  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='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 36px center;
  background-size: 16px;
}

.pincode-error {
  border-color: var(--red) !important;
  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='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 36px center;
  background-size: 16px;
}

/* ─────────────────────────────────────────────────────────────
   SEARCH BAR
   ───────────────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  min-width: 260px;
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.875rem;
  color: var(--text-primary);
  width: 100%;
  padding: 0;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar svg {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* ─────────────────────────────────────────────────────────────
   TABS
   ───────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────
   SECTION HEADER
   ───────────────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  animation: slideUp var(--transition-base);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--red);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  bottom: 0;
}

/* ─────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInRight var(--transition-base);
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }
.toast.warning::before { background: var(--yellow); }
.toast.info::before { background: var(--accent); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.toast.removing {
  animation: slideOutRight var(--transition-base);
}

@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(100px); }
}

/* ─────────────────────────────────────────────────────────────
   SPINNER / LOADING
   ───────────────────────────────────────────────────────────── */

.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.empty-state svg {
  opacity: 0.5;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 0.875rem;
}

/* ─────────────────────────────────────────────────────────────
   EXPORT MENU
   ───────────────────────────────────────────────────────────── */

.export-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.export-item:hover {
  background: var(--bg-hover);
}

.export-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.export-format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.export-format-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.export-format-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-format-label {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.export-format-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   REMINDER ITEM
   ───────────────────────────────────────────────────────────── */

.reminder-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--border);
}

.reminder-item.high {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.reminder-item.medium {
  border-left-color: var(--yellow);
  background: var(--yellow-soft);
}

.reminder-item.low {
  border-left-color: var(--green);
  background: var(--green-soft);
}

/* ─────────────────────────────────────────────────────────────
   UTILITY CLASSES
   ───────────────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.p-4 { padding: 4px; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--yellow); }

.font-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  letter-spacing: -0.01em;
}

.hidden { display: none !important; }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ───────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  
  .main-content {
    padding: 20px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile Landscape */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-elevated);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .navbar {
    left: 0;
    padding: 0 16px;
  }
  
  .navbar-title {
    font-size: 1rem;
  }

  .hamburger {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .search-bar {
    width: 100%;
  }
  
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab {
    white-space: nowrap;
  }
  
  .notif-dropdown {
    left: 16px;
    right: 16px;
    width: auto;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .modal-content {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
    max-height: 90vh;
  }
}

/* Mobile Portrait */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  .btn-sm {
    padding: 4px 8px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
  
  .badge {
    padding: 2px 7px;
    font-size: 0.65rem;
  }
  
  .section-title {
    font-size: 1.125rem;
  }
  
  .card-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
  
  .toast {
    width: 100%;
    max-width: 100%;
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }
  
  .export-grid {
    grid-template-columns: 1fr;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .navbar,
  .btn,
  .modal,
  .toast-container,
  .spinner-overlay,
  .action-buttons,
  .nav-icon-btn,
  .hamburger,
  .notif-dropdown {
    display: none !important;
  }
  
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .data-table {
    border: 1px solid #ccc;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .stat-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}