@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@300;400;500;600;700;800&family=Manjari:wght@400;700&family=Chilanka&display=swap');

/* ============================================
   ROOT VARIABLES - DARK THEME (DEFAULT)
   ============================================ */
:root {
  /* Brand Colors */
  --primary: #ffffff;
  --primary-hover: #f0f0f0;
  --primary-light: rgba(255, 255, 255, 0.08);
  --primary-gradient: linear-gradient(135deg, #818cf8, #ec4899);
  --primary-gradient-hover: linear-gradient(135deg, #6366f1, #db2777);

  /* Background Colors */
  --bg-main: #0a0a0f;
  --bg-card: #14141a;
  --bg-hover: #1e1e28;
  --bg-input: #14141a;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-elevated: #1a1a24;

  /* Text Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #0a0a0f;
  --text-secondary: #cbd5e1;

  /* Border Colors */
  --border-light: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-heavy: rgba(255, 255, 255, 0.18);

  /* Status Colors */
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.12);

  /* Shadows - User Friendly Soft Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-modal: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 64px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 9999px;

  /* Overlays */
  --overlay-bg-90: rgba(10, 10, 15, 0.92);
  --overlay-bg-70: rgba(10, 10, 15, 0.75);
  --overlay-bg-50: rgba(10, 10, 15, 0.5);

  /* Transitions - Smooth & User Friendly */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Fonts */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --font-malayalam: 'Noto Sans Malayalam', 'Manjari', 'Inter', sans-serif;

  /* Spacing - Consistent Scale */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Z-Index Scale */
  --z-base: 1;
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-max: 9999;

  color-scheme: dark;
}

/* ============================================
   LIGHT THEME OVERRIDES - Warm & Friendly
   ============================================ */
[data-theme="light"] {
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-light: rgba(15, 23, 42, 0.05);
  --primary-gradient: linear-gradient(135deg, #6366f1, #ec4899);
  --primary-gradient-hover: linear-gradient(135deg, #4f46e5, #db2777);

  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --bg-input: #f8fafc;
  --bg-surface: rgba(0, 0, 0, 0.02);
  --bg-elevated: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;
  --text-secondary: #334155;

  --border-light: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.10);
  --border-heavy: rgba(0, 0, 0, 0.18);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 24px 64px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.08);

  --overlay-bg-90: rgba(255, 255, 255, 0.92);
  --overlay-bg-70: rgba(255, 255, 255, 0.80);
  --overlay-bg-50: rgba(255, 255, 255, 0.50);

  color-scheme: light;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  line-height: 1.6;
  -webkit-overscroll-behavior: contain;
  overscroll-behavior: contain;
}

/* Better focus states for accessibility */
:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  transition: color var(--transition-base);
  line-height: 1.3;
}

a {
  color: var(--info);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

img,
svg {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   SCROLLBAR - Clean & Minimal
   ============================================ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-dim {
  color: var(--text-dim);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-info {
  color: var(--info);
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

/* ============================================
   BUTTONS - User Friendly & Responsive
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.6rem 1.4rem;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 42px;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button - Gradient with Glow */
.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(236, 72, 153, 0.35);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

/* Success Button */
.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.2);
}

.btn-success:hover:not(:disabled) {
  background: var(--success);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(52, 211, 153, 0.3);
}

/* Danger Button */
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(248, 113, 113, 0.3);
}

/* Info Button */
.btn-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.2);
}

.btn-info:hover:not(:disabled) {
  background: var(--info);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(96, 165, 250, 0.3);
}

/* Button Sizes */
.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  min-height: 32px;
  border-radius: var(--radius-pill);
}

.btn-lg {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  min-height: 48px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Table Action Buttons - Friendly & Consistent */
.data-table .btn-sm {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  font-size: 0.7rem;
  min-height: 28px;
  font-weight: 500;
}

.data-table .btn-sm:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.data-table .btn-view {
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.15);
}

.data-table .btn-view:hover:not(:disabled) {
  background: var(--info-bg);
  border-color: var(--info);
}

.data-table .btn-edit {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.15);
}

.data-table .btn-edit:hover:not(:disabled) {
  background: var(--warning-bg);
  border-color: var(--warning);
}

.data-table .btn-duplicate {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.15);
}

.data-table .btn-duplicate:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.12);
  border-color: #a78bfa;
}

.data-table .btn-delete {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.15);
}

.data-table .btn-delete:hover:not(:disabled) {
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* ============================================
   BADGE - Clear & Informative
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--border-light);
  min-height: 20px;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.15);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.15);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.15);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.15);
}

/* ============================================
   LOADING OVERLAY - Friendly & Informative
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg-90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: var(--z-max);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.overlay:not(.active) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-light);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin-bottom: var(--space-4);
}

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

.overlay p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* ============================================
   LOGIN VIEW - Warm & Welcoming
   ============================================ */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-main);
  padding: var(--space-4);
}

.login-container {
  background: var(--bg-card);
  padding: var(--space-12) var(--space-8);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  position: relative;
  transition: all var(--transition-slow);
}

.login-container::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--primary-gradient);
  z-index: -1;
  opacity: 0.15;
  filter: blur(20px);
  transition: opacity var(--transition-slow);
}

[data-theme="light"] .login-container::before {
  opacity: 0.08;
}

.login-brand {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-brand img {
  max-width: 120px;
  max-height: 60px;
  object-fit: contain;
  margin: 0 auto var(--space-4);
}

.login-brand h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: var(--space-1);
  -webkit-text-fill-color: var(--text-muted);
}

#login-form .btn {
  margin-top: var(--space-2);
  width: 100%;
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: var(--space-4);
  text-align: center;
  background: var(--danger-bg);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.15);
}

/* Password toggle button styling */
.password-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.password-toggle:hover {
  color: var(--text-main);
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
#dashboard-view {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ============================================
   SIDEBAR - Clean & Organized
   ============================================ */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  overflow: hidden;
  transition: transform var(--transition-slow), background var(--transition-slow);
  z-index: var(--z-sticky);
}

[data-theme="light"] .sidebar {
  background: rgba(241, 245, 249, 0.65);
}

.sidebar-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  min-height: 64px;
}

.sidebar-header img {
  max-height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0 var(--space-4);
}

.sidebar-divider {
  margin: var(--space-2) var(--space-4);
  padding-top: var(--space-3);
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  border-top: 1px solid var(--border-light);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.6rem var(--space-4);
  margin: 0 var(--space-2);
  width: calc(100% - var(--space-4));
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-family: inherit;
  border-radius: var(--radius-md);
  min-height: 44px;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(129, 140, 248, 0.15));
  font-weight: 700;
  box-shadow: inset 4px 0 0 var(--info);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

[data-theme="light"] .nav-item.active {
  color: #1e40af;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(99, 102, 241, 0.12));
  border-color: rgba(96, 165, 250, 0.3);
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item .nav-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}

.nav-item.text-danger {
  color: var(--danger);
}

.nav-item.text-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  transform: translateX(4px);
}

.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg-50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 89;
  transition: opacity var(--transition-slow);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-main);
  transition: background var(--transition-slow);
}

/* ============================================
   TOPBAR - Clean & Functional
   ============================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-6);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-light);
  min-height: 64px;
  flex-shrink: 0;
  gap: var(--space-4);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-main);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.menu-btn:hover {
  background: var(--bg-surface);
}

.topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Topbar Action Buttons */
.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  font-size: 1.1rem;
  cursor: pointer;
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  transform: scale(1.05);
  border-color: var(--border-medium);
}

.topbar-btn .badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.user-profile:hover {
  background: var(--bg-surface);
  border-color: var(--border-light);
}

.user-profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-profile .user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}

.user-profile .user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-profile .user-email {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Notification Dropdown - User Friendly */
#notification-bell-container {
  position: relative;
}

#notification-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  width: 360px;
  max-height: 440px;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  z-index: var(--z-dropdown);
  flex-direction: column;
  display: none;
}

#notification-dropdown:not(.hidden) {
  display: flex;
}

#notification-dropdown .dropdown-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#notification-dropdown .dropdown-header button {
  background: none;
  border: none;
  color: var(--info);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

#notification-dropdown .dropdown-header button:hover {
  background: var(--bg-surface);
}

.notification-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  position: sticky;
  top: 45px;
  /* right below the header */
  z-index: 2;
}

.notif-tab {
  flex: 1;
  background: none;
  border: none;
  padding: var(--space-2) var(--space-3);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  text-align: center;
}

.notif-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

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

.notification-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.notification-item.unread {
  background: var(--info-bg);
  border-left: 3px solid var(--info);
}

.notification-item .message {
  font-size: 0.85rem;
  margin-bottom: var(--space-1);
  color: var(--text-main);
  line-height: 1.4;
}

.notification-item .time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ============================================
   CONTENT BODY
   ============================================ */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-6) var(--space-6) var(--space-6);
  transition: padding var(--transition-base);
}

/* ============================================
   PANELS
   ============================================ */
.panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
  
  position: sticky;
  top: 0;
  padding-top: var(--space-6);
  padding-bottom: var(--space-3);
  background: var(--bg-main);
  z-index: var(--z-sticky);
  border-bottom: 1px solid var(--border-light);
}

.panel-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.panel-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* ============================================
   WELCOME CARD - Friendly & Inviting
   ============================================ */
.welcome-card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: var(--space-8) var(--space-10);
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-light);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: var(--primary-gradient);
  opacity: 0.03;
  border-radius: 50%;
  pointer-events: none;
}

.welcome-card h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: var(--space-1);
  letter-spacing: -0.5px;
}

.welcome-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

[data-theme="light"] .welcome-card {
  box-shadow: var(--shadow-sm);
}

/* ============================================
   CHARTS - Clean & Readable
   ============================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--bg-card);
  padding: var(--space-6);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  transition: all var(--transition-slow);
}

.chart-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.chart-card:nth-child(1) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(59, 130, 246, 0.01));
  border-color: rgba(59, 130, 246, 0.10);
}

.chart-card:nth-child(2) {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(139, 92, 246, 0.01));
  border-color: rgba(139, 92, 246, 0.10);
}

[data-theme="light"] .chart-card:nth-child(1),
[data-theme="light"] .chart-card:nth-child(2) {
  background: var(--bg-card);
}

.chart-card h4 {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: var(--space-4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ============================================
   STATS GRID - Bento Style
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.stat-card {
  background: var(--bg-card);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-color, var(--border-light));
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-color, var(--border-medium));
  box-shadow: var(--shadow-md);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card h4 {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.stat-card h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-primary);
  letter-spacing: -0.5px;
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  opacity: 0.2;
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-4);
}

/* Stat Card Colors */
.stat-card:nth-child(1) {
  --card-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.01));
}

.stat-card:nth-child(2) {
  --card-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.01));
}

.stat-card:nth-child(3) {
  --card-color: #f97316;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.06), rgba(249, 115, 22, 0.01));
}

.stat-card:nth-child(4) {
  --card-color: #e11d48;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.06), rgba(225, 29, 72, 0.01));
}

.stat-card:nth-child(5) {
  --card-color: #0ea5e9;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.06), rgba(14, 165, 233, 0.01));
}

.stat-card:nth-child(6) {
  --card-color: #d946ef;
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.06), rgba(217, 70, 239, 0.01));
}

.stat-card:nth-child(7) {
  --card-color: #eab308;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.06), rgba(234, 179, 8, 0.01));
}

.stat-card:nth-child(8) {
  --card-color: #14b8a6;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.06), rgba(20, 184, 166, 0.01));
}

.stat-card:nth-child(9) {
  --card-color: #f43f5e;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.06), rgba(244, 63, 94, 0.01));
}

.stat-card:nth-child(10) {
  --card-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(59, 130, 246, 0.01));
}

.stat-card:nth-child(11) {
  --card-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06), rgba(239, 68, 68, 0.01));
}

.stat-card:nth-child(12) {
  --card-color: #84cc16;
  background: linear-gradient(135deg, rgba(132, 204, 22, 0.06), rgba(132, 204, 22, 0.01));
}

.stat-card:nth-child(13) {
  --card-color: #94a3b8;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.06), rgba(148, 163, 184, 0.01));
}

.stat-card:nth-child(14) {
  --card-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(245, 158, 11, 0.01));
}

.stat-card:nth-child(15) {
  --card-color: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(34, 197, 94, 0.01));
}

.stat-card:nth-child(16) {
  --card-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.01));
}

.stat-card:nth-child(17) {
  --card-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.01));
}

.stat-card:nth-child(18) {
  --card-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.01));
}

.stat-card:nth-child(19) {
  --card-color: #f97316;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.06), rgba(249, 115, 22, 0.01));
}

.stat-card:nth-child(20) {
  --card-color: #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06), rgba(6, 182, 212, 0.01));
}

.stat-card:nth-child(21) {
  --card-color: #a855f7;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), rgba(168, 85, 247, 0.01));
}

[data-theme="light"] .stat-card {
  box-shadow: var(--shadow-xs);
}

[data-theme="light"] .stat-card:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================
   TABLES - Clean & Scannable
   ============================================ */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 190px);
  margin-bottom: var(--space-6);
  transition: all var(--transition-slow);
}

[data-theme="light"] .table-container {
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}

.data-table thead {
  background: var(--bg-surface);
}

.data-table th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-card);
}

.data-table th::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  z-index: -1;
}

.data-table td {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.875rem;
  vertical-align: middle;
}

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

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

.data-table .actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.data-table .bulk-select-th {
  width: 40px;
  text-align: center;
}

.data-table .bulk-row-check,
.data-table .bulk-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--info);
}

/* ============================================
   FORMS - User Friendly
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group .helper-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: var(--space-1);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem var(--space-4);
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 4px var(--info-bg);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: 36px;
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  min-height: auto;
  accent-color: var(--info);
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.form-group input[type="checkbox"]:checked,
.form-group input[type="radio"]:checked {
  accent-color: var(--info);
}

/* ============================================
   MODALS - Focused & Clear
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg-70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
  overscroll-behavior: contain;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  max-height: 90dvh;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.3px;
}

.modal-header .modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 400;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.modal form {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal form .form-group {
  margin-bottom: 0;
}

.modal form button[type="submit"] {
  margin-top: var(--space-4);
  padding: 0.75rem;
  font-size: 1rem;
}

/* ============================================
   TOAST NOTIFICATIONS - Friendly Feedback
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 440px;
  width: 100%;
}

.toast {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border-left: 4px solid var(--info);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-info {
  border-left-color: var(--info);
}

.toast .toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast .toast-message {
  flex: 1;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.2rem;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.toast .toast-close:hover {
  background: var(--bg-surface);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   QUILL EDITOR
   ============================================ */
.ql-toolbar.ql-snow,
.ql-container.ql-snow {
  background: var(--bg-input);
  border-color: var(--border-light) !important;
  font-family: var(--font-primary);
  color: var(--text-main);
}

.ql-toolbar.ql-snow {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: var(--space-2);
  border-bottom: 1px solid var(--border-light) !important;
}

.ql-container.ql-snow {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  min-height: 200px;
  font-size: 0.95rem;
}

.ql-snow .ql-stroke {
  stroke: var(--text-muted);
}

.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
  fill: var(--text-muted);
}

.ql-snow .ql-picker {
  color: var(--text-muted);
}

.ql-snow .ql-picker-options {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--primary);
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: var(--primary);
}

.ql-editor {
  min-height: 120px;
  color: var(--text-main);
}

.ql-editor.ql-blank::before {
  color: var(--text-dim);
}

/* ============================================
   PROFILE PANEL
   ============================================ */
.profile-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-6);
}

.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  border: 1px solid var(--border-light);
  transition: all var(--transition-slow);
}

.profile-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.profile-card-info {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(236, 72, 153, 0.06));
  border-color: rgba(236, 72, 153, 0.10);
}

.profile-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.profile-info {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.profile-info img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-medium);
  flex-shrink: 0;
}

.profile-info h4 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.profile-info .designation {
  color: var(--info);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: var(--space-1);
}

.profile-info .email {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ============================================
   GLOBAL VIEW MODAL
   ============================================ */
.admin-card-preview-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
  width: 100%;
}

.speech-card,
.program-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
  color: var(--text-main);
}

.speech-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  grid-template-areas: "cover title" "cover kicker" "cover meta" "cover footer";
}

.speech-cover,
.program-card-cover {
  background: linear-gradient(135deg, #2c3e66, #1e2a4a);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.speech-cover {
  grid-area: cover;
  min-height: 100%;
  aspect-ratio: 1/1;
  padding: var(--space-4);
}

.speech-author-thumb {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.speech-card-title {
  grid-area: title;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  padding: var(--space-4) var(--space-4) var(--space-1) 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.speech-card-kicker {
  grid-area: kicker;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--info);
  margin: 0;
  padding: 0 var(--space-4) var(--space-1) 0;
}

.speech-card .meta {
  grid-area: meta;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0;
  padding: var(--space-1) var(--space-4) var(--space-2) 0;
}

.speech-card-footer {
  grid-area: footer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-4) var(--space-4) 0;
}

.speech-card-author {
  font-size: 0.9rem;
  color: #c084fc;
}

.program-card {
  display: flex;
  flex-direction: column;
}

.program-card-cover {
  height: 180px;
  flex-shrink: 0;
}

.program-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.program-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.program-card-title {
  margin: 0 0 var(--space-1);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.program-card-summary {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Article Preview */
.admin-article-preview {
  --malayalam-body: 'Noto Sans Malayalam', 'Manjari', 'Inter', sans-serif;
  --malayalam-heading: 'Noto Sans Malayalam', 'Manjari', 'Plus Jakarta Sans', sans-serif;
  --malayalam-accent: 'Chilanka', 'Noto Sans Malayalam', cursive;
  --malayalam-body-size: 1.05rem;
  --malayalam-heading-size: 1.6rem;
  --malayalam-line-height: 1.9;
}

.admin-article-preview .article-content {
  font-family: var(--malayalam-body);
  font-size: var(--malayalam-body-size);
  line-height: var(--malayalam-line-height);
  color: var(--text-main);
}

.admin-article-preview .article-content h3 {
  font-family: var(--malayalam-heading);
  font-size: var(--malayalam-heading-size);
  color: var(--info);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  border-left: 4px solid var(--info);
  padding-left: var(--space-4);
}

.admin-article-preview .article-content ul {
  margin: var(--space-4) 0 var(--space-6) var(--space-6);
  padding-left: var(--space-2);
  list-style-type: none;
}

.admin-article-preview .article-content ul li {
  margin-bottom: var(--space-2);
  padding-left: var(--space-5);
  position: relative;
}

.admin-article-preview .article-content ul li::before {
  content: '✦';
  color: var(--info);
  position: absolute;
  left: 0;
}

.admin-article-preview .article-content blockquote {
  font-family: var(--malayalam-accent);
  font-size: 1.1rem;
  border-left: 4px solid var(--info);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  background: var(--bg-surface);
  font-style: italic;
}

.article-gallery {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-light);
}

.article-gallery h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--text-main);
}

.modern-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

.modern-gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.modern-gallery-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

.modern-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   BULK DELETE
   ============================================ */
.btn-bulk-delete {
  display: none;
}

.btn-bulk-delete:not(.hidden) {
  display: inline-flex;
}

/* ============================================
   RESPONSIVE - TABLETS
   ============================================ */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .profile-bento-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 90%;
  }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {

  /* Sidebar */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-overlay);
    border-right: none;
  }

  .sidebar-mobile-active .sidebar {
    transform: translateX(0);
  }

  .sidebar-mobile-active .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .sidebar-overlay {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
    z-index: calc(var(--z-overlay) - 10);
  }

  .menu-btn {
    display: block;
  }

  /* Topbar */
  .topbar {
    padding: 0 var(--space-4);
    min-height: 56px;
  }

  .topbar h2 {
    font-size: 0.95rem;
  }

  .user-profile .user-info {
    display: none;
  }

  /* Content */
  .content-body {
    padding: var(--space-4);
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .stat-card {
    padding: var(--space-3) var(--space-4);
  }

  .stat-card h2 {
    font-size: 1.5rem;
  }

  .stat-card h4 {
    font-size: 0.6rem;
  }

  .stat-card .stat-icon {
    font-size: 1.2rem;
    bottom: var(--space-2);
    right: var(--space-3);
  }

  /* Charts */
  .chart-container {
    height: 200px;
  }

  /* Welcome Card */
  .welcome-card {
    padding: var(--space-5) var(--space-6);
  }

  .welcome-card h3 {
    font-size: 1.2rem;
  }

  /* Login */
  .login-container {
    padding: var(--space-8) var(--space-6);
    margin: var(--space-4);
  }

  /* Modals */
  .modal {
    max-width: 100%;
    margin: var(--space-2);
    max-height: 95vh;
  }

  .modal-header {
    padding: var(--space-3) var(--space-4);
  }

  .modal form {
    padding: var(--space-4);
  }

  /* Tables - Mobile Friendly */
  .table-container {
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
  }

  .data-table {
    min-width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    display: block;
    margin-bottom: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-2);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    text-align: right;
    background: transparent !important;
  }

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

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .data-table td.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
  }

  /* Wrap text in links and long content */
  .data-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    max-width: 100%;
  }

  .data-table a {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Tab Display Grid Responsive */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Wrap text in tab labels */
  [style*="grid-template-columns: 1fr 1fr"] label {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }

  .data-table td.actions::before {
    display: none;
  }

  .data-table td.actions .btn {
    flex: 0 1 auto;
    font-size: 0.65rem;
    padding: 0.2rem 0.6rem;
    min-height: 26px;
  }

  /* Profile */
  .profile-card {
    padding: var(--space-4);
  }

  .profile-info {
    flex-direction: column;
    text-align: center;
  }

  /* Notification Dropdown */
  #notification-dropdown {
    position: fixed;
    top: 60px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 80px);
  }

  /* Toast */
  .toast-container {
    bottom: var(--space-4);
    right: var(--space-4);
    max-width: calc(100% - var(--space-4) * 2);
  }

  .toast {
    padding: var(--space-2) var(--space-4);
    font-size: 0.85rem;
  }

  /* Speech Card */
  .speech-card {
    grid-template-columns: 100px 1fr;
  }

  .speech-author-thumb {
    width: 70px;
    height: 70px;
  }

  .speech-card-title {
    font-size: 0.95rem;
    padding: var(--space-3) var(--space-3) var(--space-1) 0;
  }

  .speech-card-kicker {
    font-size: 0.6rem;
    padding: 0 var(--space-3) var(--space-1) 0;
  }

  .speech-card .meta {
    font-size: 0.7rem;
    padding: var(--space-1) var(--space-3) var(--space-1) 0;
  }

  .speech-card-footer {
    padding: var(--space-1) var(--space-3) var(--space-3) 0;
  }

  /* Gallery */
  .modern-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
  }
}

/* ============================================
   RESPONSIVE - SMALL PHONES
   ============================================ */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }

  .stat-card {
    padding: var(--space-2) var(--space-3);
  }

  .stat-card h2 {
    font-size: 1.2rem;
  }

  .stat-card h4 {
    font-size: 0.55rem;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .panel-header .btn {
    width: 100%;
    justify-content: center;
  }

  .topbar h2 {
    font-size: 0.85rem;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    min-height: 36px;
  }

  .btn-sm {
    font-size: 0.65rem;
    padding: 0.15rem 0.6rem;
    min-height: 26px;
  }

  #user-name,
  #user-email {
    display: none !important;
  }

  .user-profile .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .content-body {
    padding: var(--space-3);
  }

  .welcome-card {
    padding: var(--space-4);
  }

  .welcome-card h3 {
    font-size: 1rem;
  }

  .login-container {
    padding: var(--space-6) var(--space-4);
    margin: var(--space-2);
  }

  .login-brand h2 {
    font-size: 1.2rem;
  }

  .chart-container {
    height: 160px;
  }

  .speech-card {
    grid-template-columns: 80px 1fr;
  }

  .speech-author-thumb {
    width: 60px;
    height: 60px;
  }

  .speech-cover {
    padding: var(--space-2);
  }

  .program-card-cover {
    height: 140px;
  }

  .modern-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-1);
  }

  #notification-dropdown {
    width: 280px;
    right: -40px;
  }

  .topbar-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
}

/* ============================================
   RESPONSIVE - VERY SMALL PHONES
   ============================================ */
@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card h2 {
    font-size: 1rem;
  }

  .stat-card h4 {
    font-size: 0.5rem;
  }

  .topbar {
    padding: 0 var(--space-2);
    min-height: 48px;
  }

  .content-body {
    padding: var(--space-2);
  }

  .modal form {
    padding: var(--space-3);
  }

  .modal-header {
    padding: var(--space-2) var(--space-3);
  }

  .data-table td {
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
  }

  .data-table td.actions .btn {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    min-height: 22px;
  }


}

/* ============================================
   LIGHT THEME SPECIFIC ADJUSTMENTS
   ============================================ */
[data-theme="light"] .login-container {
  box-shadow: 0 0 0 1px var(--border-light), var(--shadow-xl);
}

[data-theme="light"] .modal {
  box-shadow: var(--shadow-modal);
}

[data-theme="light"] .speech-card,
[data-theme="light"] .program-card {
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .speech-card:hover,
[data-theme="light"] .program-card:hover {
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .modern-gallery-item {
  box-shadow: var(--shadow-xs);
}

[data-theme="light"] .modern-gallery-item:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

  .sidebar,
  .topbar,
  .btn,
  .no-print {
    display: none !important;
  }

  .main-content {
    height: auto !important;
    overflow: visible !important;
  }

  .content-body {
    overflow: visible !important;
    padding: 0 !important;
  }

  .panel {
    display: block !important;
  }

  .panel.hidden {
    display: none !important;
  }

  .data-table {
    border-collapse: collapse !important;
  }

  .data-table td,
  .data-table th {
    border: 1px solid #ccc !important;
    padding: 8px !important;
  }
}

/* ============================================
   THEME TOGGLE WAVE ANIMATION
   ============================================ */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  -webkit-mask-image: radial-gradient(circle closest-side, black 80%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, black 80%, transparent 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* ============================================
   SHARE BUTTON & SHARE POPUP
   ============================================ */

/* Share button in table action row */
.btn-share-item {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(18, 140, 126, 0.15)) !important;
  color: #25D366 !important;
  border: 1px solid rgba(37, 211, 102, 0.35) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.btn-share-item:hover {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.28), rgba(18, 140, 126, 0.28)) !important;
  border-color: rgba(37, 211, 102, 0.6) !important;
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.2) !important;
  transform: translateY(-1px);
}

/* Share popup — scrollable message area */
#modal-share-popup .modal {
  animation: shareModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
}

/* The scrollable green preview area */
#modal-share-popup .modal > div[style*="overflow-y"] {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

@keyframes shareModalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* WhatsApp preview pre text */
#share-popup-text {
  font-family: var(--font-primary);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #e9edef;
}

/* Custom scrollbar inside share popup */
#modal-share-popup ::-webkit-scrollbar {
  width: 5px;
}
#modal-share-popup ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
#modal-share-popup ::-webkit-scrollbar-thumb {
  background: rgba(37, 211, 102, 0.3);
  border-radius: 10px;
}
#modal-share-popup ::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 211, 102, 0.5);
}

/* Media Library Styles */
.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
  background: var(--bg-card);
}
.media-item:hover {
  transform: scale(1.02);
  border-color: var(--primary-color);
}
.media-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.media-item-info {
  padding: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0,0,0,0.2);
}

/* ============================================
   SMOOTH THEME TRANSITION CONTROLS
   ============================================ */

/* Disable all transitions during active View Transitions */
.theme-transitioning,
.theme-transitioning * {
  transition: none !important;
  animation-duration: 0s !important;
}

/* Fallback smooth transitions for browsers not supporting View Transitions */
body,
.sidebar,
.topbar,
.panel-header,
.stat-card,
.chart-card,
.welcome-card,
.table-container,
.data-table,
.data-table th,
.data-table td,
.modal,
.modal-header,
.modal-body,
.btn,
input,
select,
textarea {
  transition: background-color var(--transition-base),
              background var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
}