/* ==========================================================================
   EXPIRYY DESIGN SYSTEM v2.0
   Modern Document & Subscription Management
   ========================================================================== */

/* ---------- CSS Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

/* Global thin scrollbar styling */
html, body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

@media (min-width: 1200px) {
  html { font-size: 16px; }
}

/* ---------- Design Tokens ---------- */
:root {
  /* Colors - Dark Theme (Default) */
  --bg: #0a0e14;
  --bg-secondary: #0f1419;
  --bg-elevated: #151b23;
  --bg-hover: #1a222d;
  --bg-active: #232d3b;
  
  --fg: #ecf0f5;
  --fg-secondary: #a0aec0;
  --fg-muted: #718096;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.15);
  
  /* Brand Colors */
  --primary: #6366f1;
  --primary-hover: #7c7ff7;
  --primary-muted: rgba(99, 102, 241, 0.15);
  --primary-glow: rgba(99, 102, 241, 0.3);
  
  --accent: #22c55e;
  --accent-muted: rgba(34, 197, 94, 0.15);
  
  /* Status Colors */
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.4);
  
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(245, 158, 11, 0.4);
  
  --success: #10b981;
  --success-muted: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.4);
  
  --info: #0ea5e9;
  --info-muted: rgba(14, 165, 233, 0.15);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px var(--primary-glow);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  
  /* Glass effect */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: blur(20px);
}

/* Light Theme */
html[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;
  
  --fg: #0f172a;
  --fg-secondary: #475569;
  --fg-muted: #94a3b8;
  
  --border: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-strong: rgba(0, 0, 0, 0.12);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.06);
}

/* ---------- Body & Background ---------- */
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 800px 600px at 10% 0%, var(--primary-muted), transparent 50%),
    radial-gradient(ellipse 600px 400px at 90% 100%, var(--accent-muted), transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ---------- App Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-slow);
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
  color: var(--fg);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-sm);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  gap: var(--space-xs);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  color: var(--fg-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
}

.nav-item i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.nav-item.active {
  background: var(--primary-muted);
  color: var(--primary);
}

.nav-item.active i {
  color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-muted);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-details {
  min-width: 0;
}

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

.user-role {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--fg-muted);
  padding: var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: var(--danger-muted);
  color: var(--danger);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.sidebar-backdrop.show {
  display: block;
}

/* ---------- Main Wrapper ---------- */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 991.98px) {
  .main-wrapper {
    margin-left: 0;
  }
}

/* ---------- Top Header ---------- */
.top-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-lg);
  z-index: 100;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
}

.header-search {
  flex: 1;
  max-width: 480px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-md);
  color: var(--fg-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-md) 0 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--fg);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

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

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

.search-shortcut {
  position: absolute;
  right: var(--space-md);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--fg-secondary);
  font-size: 1.25rem;
  padding: var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
}

/* ---------- Notifications Panel ---------- */
.notifications-wrapper {
  position: relative;
}

.notifications-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.notifications-panel.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.notifications-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.notifications-body {
  max-height: 400px;
  overflow-y: auto;
}

.notifications-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--fg-muted);
}

.notifications-loading .spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--fg);
  transition: background var(--transition-fast);
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.notification-icon.urgent {
  background: var(--danger-muted);
  color: var(--danger);
}

.notification-icon.warning {
  background: var(--warning-muted);
  color: var(--warning);
}

.notification-icon.info {
  background: var(--primary-muted);
  color: var(--primary);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-meta {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.notification-item.unread {
  background: var(--primary-muted);
  position: relative;
}

.notification-unread-dot {
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.notification-item.unread .notification-content {
  padding-left: 8px;
}

.notifications-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--fg-muted);
}

.notifications-empty i {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  display: block;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  padding: var(--space-xl);
  max-width: 1400px;
}

@media (max-width: 767.98px) {
  .main-content {
    padding: var(--space-md);
  }
}

/* ---------- Toast Notifications ---------- */
.toast-notification {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  animation: slideIn 0.3s ease;
}

.toast-success {
  background: var(--success-muted);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.toast-error {
  background: var(--danger-muted);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

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

/* ---------- Page Headers ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-subtitle {
  color: var(--fg-muted);
  margin: var(--space-xs) 0 0;
}

.page-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border: none;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
}

.btn-primary-soft {
  background: var(--primary-muted);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-primary-soft:hover {
  background: rgba(99, 102, 241, 0.25);
  color: var(--primary);
}

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--fg-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

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

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.8rem;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-hover);
}

/* ---------- Document Cards (Wallet-Style) ---------- */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.wallet-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.wallet-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle at 70% 30%, var(--primary-muted), transparent 60%);
  pointer-events: none;
}

.wallet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.wallet-card-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
}

.wallet-card-thumb-placeholder {
  width: 100%;
  height: 180px;
  display: grid;
  place-items: center;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-muted);
  font-size: 3rem;
}

.wallet-card-content {
  padding: var(--space-lg);
}

.wallet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.wallet-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.wallet-card-meta {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.wallet-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-md);
}

.wallet-card-countdown {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.wallet-card-countdown-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wallet-card-owner {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.wallet-card-shared {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  background: var(--info);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.owner-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--space-xs);
}

/* ---------- Status Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.pill-warning {
  background: var(--warning-muted);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.pill-success {
  background: var(--success-muted);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.pill-info {
  background: var(--info-muted);
  color: var(--info);
  border: 1px solid rgba(14, 165, 233, 0.4);
}

/* ---------- Stats Cards ---------- */
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at 80% 20%, var(--primary-muted), transparent 70%);
  pointer-events: none;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
}

.stat-icon-primary {
  background: var(--primary-muted);
  color: var(--primary);
}

.stat-icon-danger {
  background: var(--danger-muted);
  color: var(--danger);
}

.stat-icon-warning {
  background: var(--warning-muted);
  color: var(--warning);
}

.stat-icon-success {
  background: var(--success-muted);
  color: var(--success);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.upload-zone-icon {
  font-size: 3rem;
  color: var(--fg-muted);
  margin-bottom: var(--space-md);
}

.upload-zone-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.upload-zone-subtitle {
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.upload-zone-formats {
  margin-top: var(--space-md);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* Small Upload Zone Variant */
.upload-zone.upload-zone-sm {
  padding: var(--space-md);
}

.upload-zone-sm .upload-zone-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.upload-zone-sm .upload-zone-content i {
  font-size: 1.25rem;
  color: var(--fg-muted);
}

.upload-zone-sm .upload-zone-content div {
  font-size: 0.875rem;
}

/* Upload Progress */
.upload-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.upload-item-preview {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-hover);
}

.upload-item-info {
  flex: 1;
  min-width: 0;
}

.upload-item-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item-size {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.upload-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-xs);
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width var(--transition-fast);
}

.upload-item-options {
  flex-shrink: 0;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.upload-status {
  min-height: 1.2em;
}

/* ---------- File Gallery ---------- */
.file-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
}

.file-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all var(--transition-fast);
}

.file-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.file-item-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.file-item-placeholder {
  width: 100%;
  height: 120px;
  display: grid;
  place-items: center;
  background: var(--bg-hover);
  color: var(--fg-muted);
  font-size: 2rem;
}

.file-item-info {
  padding: var(--space-sm) var(--space-md);
}

.file-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-meta {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.file-item-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.file-item-actions {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-item:hover .file-item-actions {
  opacity: 1;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: var(--space-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-xl) + 7px);
  top: 4px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

.timeline-item-danger::before {
  background: var(--danger);
}

.timeline-item-warning::before {
  background: var(--warning);
}

.timeline-item-success::before {
  background: var(--success);
}

.timeline-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: var(--space-xs);
}

.timeline-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--fg-secondary);
}

/* ---------- Wizard / Steps ---------- */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--border);
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  z-index: 1;
}

.wizard-step-number {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--fg-muted);
  transition: all var(--transition-fast);
}

.wizard-step.active .wizard-step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.wizard-step.completed .wizard-step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.wizard-step-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.wizard-step.active .wizard-step-label {
  color: var(--fg);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.form-control::placeholder {
  color: var(--fg-muted);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-hint {
  margin-top: var(--space-xs);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23718096' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: 40px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.form-check-input {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
}

.form-check-input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

/* Password Input with Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-control {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: calc(100% - 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.password-toggle:hover {
  color: var(--fg);
  background: var(--bg-hover);
}

.password-toggle:focus {
  outline: none;
}

.password-toggle i {
  font-size: 1.1rem;
}

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: var(--bg-elevated);
}

.table td {
  color: var(--fg);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

/* ---------- Status Filter Buttons ---------- */
.status-filter-btn {
  transition: all var(--transition-fast);
}

.status-filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.status-filter-btn.active {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--fg-muted);
  margin-bottom: var(--space-lg);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-state-desc {
  color: var(--fg-muted);
  max-width: 400px;
  margin: 0 auto var(--space-lg);
}

/* ---------- Lightbox / Modal ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.lightbox.show {
  opacity: 1;
  visibility: visible;
}

.lightbox-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* ---------- Dropdown ---------- */
/* Custom dropdown - prefixed to avoid Bootstrap conflicts */
.ex-dropdown {
  position: relative;
  display: inline-block;
}

.ex-dropdown .ex-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xs);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  display: block;
  transform: translateY(-10px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

.ex-dropdown.open .ex-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
  pointer-events: auto;
}

.ex-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ex-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.ex-dropdown-item.active {
  background: var(--primary-muted);
  color: var(--primary);
}

.ex-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xs) 0;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--fg);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- Filters & View Toggle ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.view-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background: var(--primary-muted);
  color: var(--primary);
}

.view-toggle-btn:hover:not(.active) {
  background: var(--bg-hover);
}

/* ---------- Priority Cards ---------- */
.priority-section {
  margin-bottom: var(--space-xl);
}

.priority-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.priority-title-urgent {
  color: var(--danger);
}

.priority-title-warning {
  color: var(--warning);
}

.priority-title-upcoming {
  color: var(--info);
}

.priority-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-md);
  scroll-snap-type: x mandatory;
}

.priority-scroll::-webkit-scrollbar {
  height: 6px;
}

.priority-scroll::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}

.priority-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.priority-card {
  flex: 0 0 280px;
  scroll-snap-align: start;
}

/* ---------- Ring Chart ---------- */
.ring-chart {
  position: relative;
  width: 120px;
  height: 120px;
}

.ring-chart-svg {
  transform: rotate(-90deg);
}

.ring-chart-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.ring-chart-progress {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-slow);
}

.ring-chart-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-chart-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.ring-chart-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

/* ---------- Activity Feed ---------- */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* ---------- Utilities ---------- */
.text-muted { color: var(--fg-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-success { color: var(--success) !important; }

.bg-primary-muted { background: var(--primary-muted) !important; }
.bg-danger-muted { background: var(--danger-muted) !important; }
.bg-warning-muted { background: var(--warning-muted) !important; }
.bg-success-muted { background: var(--success-muted) !important; }

.gap-xs { gap: var(--space-xs) !important; }
.gap-sm { gap: var(--space-sm) !important; }
.gap-md { gap: var(--space-md) !important; }
.gap-lg { gap: var(--space-lg) !important; }

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   AUTH PAGES STYLING
   ========================================================================== */

/* Auth Card Container */
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-xl);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-lg);
  background: var(--primary-muted);
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--primary);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 var(--space-sm);
  color: var(--fg);
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin: 0;
}

/* 2FA Code Input - Individual Boxes */
.code-input-container {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.code-input-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--fg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.code-input-box:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

.code-input-box::-webkit-inner-spin-button,
.code-input-box::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.code-input-box[type=number] {
  -moz-appearance: textfield;
}

/* Auth Form Elements */
.auth-card .form-control {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.auth-card .form-control:focus {
  background: var(--bg-secondary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
  color: var(--fg);
}

.auth-card .form-label {
  font-weight: 500;
  color: var(--fg-secondary);
  margin-bottom: var(--space-xs);
}

.auth-card .form-check-label {
  color: var(--fg-secondary);
}

.auth-card .btn-primary {
  padding: 0.875rem 1.5rem;
  font-weight: 600;
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Auth Mobile Responsive */
@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-lg);
    margin: var(--space-md);
    max-width: calc(100vw - var(--space-xl));
  }

  .auth-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .code-input-box {
    width: 40px;
    height: 48px;
    font-size: 1.25rem;
  }
}

/* ==========================================================================
   MOBILE OVERFLOW FIXES
   ========================================================================== */

/* Prevent horizontal overflow on mobile */
html, body {
  overflow-x: hidden;
}

.main-wrapper {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Mobile responsive cards and containers */
@media (max-width: 767.98px) {
  /* Ensure cards don't overflow */
  .card {
    max-width: 100%;
    overflow-x: hidden;
  }

  .card-body {
    padding: var(--space-md);
  }

  /* Page header mobile layout */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .page-actions .btn span {
    display: none;
  }

  .page-actions .btn i {
    margin: 0;
  }

  .page-title {
    font-size: 1.35rem;
  }

  /* Toolbar mobile */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar .btn {
    flex: 1;
    padding: var(--space-sm);
  }

  /* File gallery grid for mobile */
  .file-gallery {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-sm);
  }

  .file-item {
    padding: var(--space-sm);
  }

  .file-item-preview {
    height: 80px;
  }

  .file-item-actions {
    top: var(--space-xs);
    right: var(--space-xs);
    gap: 2px;
  }

  .file-item-actions .btn {
    padding: 2px 4px;
    font-size: 0.7rem;
  }

  /* Table responsive */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .table {
    min-width: 600px;
  }

  /* Document cards mobile */
  .doc-card {
    padding: var(--space-md);
  }

  .doc-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .doc-card-thumbnail {
    width: 100%;
    height: 120px;
    margin-bottom: var(--space-sm);
  }

  /* Stat cards mobile */
  .stat-card {
    padding: var(--space-md);
  }

  .stat-value {
    font-size: 1.5rem;
  }

  /* Form controls mobile */
  .form-control,
  .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Modal/dropdown positioning */
  .ex-dropdown-menu {
    position: fixed;
    left: var(--space-md) !important;
    right: var(--space-md) !important;
    width: auto !important;
    max-width: calc(100vw - var(--space-xl));
  }

  /* Upload zone mobile */
  .upload-zone {
    padding: var(--space-lg);
  }

  .upload-zone-icon i {
    font-size: 2rem;
  }

  .upload-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .upload-item-preview {
    width: 100%;
    height: 100px;
  }

  /* Row adjustments */
  .row {
    margin-left: calc(var(--space-sm) * -1);
    margin-right: calc(var(--space-sm) * -1);
  }

  .row > * {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  /* Notifications panel mobile */
  .notifications-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - var(--header-height));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  /* Document wallet cards mobile */
  .wallet-card {
    padding: var(--space-md);
  }

  .wallet-card-photo {
    width: 70px;
    height: 90px;
  }
}

/* Extra small devices */
@media (max-width: 375px) {
  .main-content {
    padding: var(--space-sm);
  }

  .card-header,
  .card-body {
    padding: var(--space-sm);
  }

  .file-gallery {
    grid-template-columns: 1fr !important;
  }

  .code-input-box {
    width: 36px;
    height: 44px;
    font-size: 1rem;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   VISUAL ENHANCEMENTS
   ========================================================================== */

/* ---------- Micro-interactions & Animations ---------- */

/* Card hover effects */
.card {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

/* Document cards enhanced hover */
.doc-card,
.wallet-card {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.doc-card:hover,
.wallet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-muted);
}

/* Button interactions */
.btn {
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px var(--primary-muted);
}

/* Ripple effect base */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.btn:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
}

/* Stat card animations */
.stat-card {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
}

.stat-value {
  transition: transform var(--transition-normal);
}

.stat-card:hover .stat-value {
  transform: scale(1.05);
}

/* File item hover effects */
.file-item {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.file-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.file-item-actions {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-item:hover .file-item-actions {
  opacity: 1;
}

/* Nav item transitions */
.nav-item {
  transition: background var(--transition-fast), color var(--transition-fast), padding-left var(--transition-fast);
}

.nav-item:hover {
  padding-left: calc(var(--space-lg) + 4px);
}

/* ---------- Enhanced Cards ---------- */

/* Gradient border on status cards */
.stat-card-danger {
  background: linear-gradient(135deg, var(--danger-muted), transparent 50%);
  border-left: 3px solid var(--danger);
}

.stat-card-warning {
  background: linear-gradient(135deg, var(--warning-muted), transparent 50%);
  border-left: 3px solid var(--warning);
}

.stat-card-success {
  background: linear-gradient(135deg, var(--success-muted), transparent 50%);
  border-left: 3px solid var(--success);
}

.stat-card-primary {
  background: linear-gradient(135deg, var(--primary-muted), transparent 50%);
  border-left: 3px solid var(--primary);
}

/* Glassmorphism cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

/* Document type icon backgrounds */
.doc-type-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.doc-type-icon.passport {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: white;
}

.doc-type-icon.id {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
}

.doc-type-icon.license {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
}

.doc-type-icon.insurance {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
}

.doc-type-icon.certificate {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: white;
}

/* ---------- Better Empty States ---------- */

.empty-state {
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--fg-muted);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--fg);
}

.empty-state-description {
  color: var(--fg-muted);
  margin-bottom: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Improved Navigation ---------- */

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  color: var(--fg-muted);
}

.breadcrumb-item a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

.breadcrumb-item.active {
  color: var(--fg);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--fg-muted);
  margin: 0 var(--space-xs);
}

/* Sticky table headers */
.table-sticky thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elevated);
}

.table-sticky thead th {
  box-shadow: 0 1px 0 var(--border);
}

/* ---------- Floating Action Button (FAB) ---------- */

.fab {
  position: fixed;
  bottom: calc(var(--space-xl) + 70px); /* Account for bottom nav */
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  display: none;
  place-items: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 900;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl), 0 0 20px var(--primary-glow);
}

.fab:active {
  transform: scale(0.95);
}

@media (max-width: 767.98px) {
  .fab {
    display: grid;
  }
}

/* ---------- Mobile Bottom Navigation ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: none;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  min-width: 64px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.bottom-nav-item span {
  font-size: 0.65rem;
  font-weight: 500;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item:hover {
  color: var(--primary);
}

@media (max-width: 767.98px) {
  .bottom-nav {
    display: block;
  }
  
  /* Add padding to main content to account for bottom nav */
  .main-wrapper {
    padding-bottom: 80px;
  }
}

/* ---------- Accessibility Improvements ---------- */

/* Enhanced focus states */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-muted);
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}

/* Ensure minimum touch targets on mobile */
@media (max-width: 767.98px) {
  .btn,
  .nav-item,
  .form-check-input,
  .form-control,
  .form-select,
  a[href] {
    min-height: 44px;
  }
  
  .form-check-input {
    width: 20px;
    height: 20px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 255, 255, 0.3);
    --border-strong: rgba(255, 255, 255, 0.5);
  }
  
  html[data-theme="light"] {
    --border: rgba(0, 0, 0, 0.3);
    --border-strong: rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Loading Skeleton ---------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-hover) 25%,
    var(--bg-active) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 200px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Pull to Refresh Indicator ---------- */

.pull-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal);
  z-index: 1001;
}

.pull-refresh.active {
  transform: translateX(-50%) translateY(0);
}

.pull-refresh i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Swipe Action Hints ---------- */

.swipe-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-sm);
  color: white;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.swipe-hint-delete {
  right: 0;
  background: var(--danger);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.swipe-hint-archive {
  left: 0;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- Status Indicators ---------- */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.status-dot-success {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot-warning {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: status-pulse 2s ease-in-out infinite;
}

.status-dot-danger {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: status-pulse 1s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Progress Ring ---------- */

.progress-ring {
  width: 120px;
  height: 120px;
  position: relative;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-hover);
  stroke-width: 8;
}

.progress-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-slow);
}

.progress-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-ring-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.progress-ring-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
}
