/* ==========================================================================
   WF MailCom - Admin Stylesheet
   Version: 1.0.0
   ========================================================================== */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (THEMING)
   ========================================================================== */

:root {
  /* Primary: deep blue */
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;

  /* Accent: teal/cyan */
  --accent: #0891b2;
  --accent-light: #22d3ee;
  --accent-dark: #0e7490;
  --accent-50: #ecfeff;

  /* Semantic */
  --success: #059669;
  --success-light: #d1fae5;
  --success-dark: #047857;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --warning-dark: #b45309;
  --error: #dc2626;
  --error-light: #fee2e2;
  --error-dark: #b91c1c;
  --info: #2563eb;
  --info-light: #dbeafe;
  --info-dark: #1d4ed8;

  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
  --topbar-height: 56px;

  /* Backgrounds */
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #111827;
  --bg-sidebar-hover: #1f2937;
  --bg-sidebar-active: rgba(59, 130, 246, 0.12);
  --bg-topbar: #ffffff;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --text-on-primary: #ffffff;
  --text-sidebar: #9ca3af;
  --text-sidebar-active: #ffffff;

  /* Borders */
  --border-color: #e5e7eb;
  --border-color-light: #f3f4f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Font */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Z-index layers */
  --z-sidebar: 100;
  --z-topbar: 90;
  --z-dropdown: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* ==========================================================================
   2. DARK MODE
   ========================================================================== */

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --primary-dark: #2563eb;
  --primary-50: rgba(59, 130, 246, 0.1);
  --primary-100: rgba(59, 130, 246, 0.15);

  --accent: #22d3ee;
  --accent-light: #67e8f9;
  --accent-50: rgba(34, 211, 238, 0.1);

  --success-light: rgba(5, 150, 105, 0.15);
  --warning-light: rgba(217, 119, 6, 0.15);
  --error-light: rgba(220, 38, 38, 0.15);
  --info-light: rgba(37, 99, 235, 0.15);

  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: rgba(59, 130, 246, 0.15);
  --bg-topbar: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-light: #64748b;
  --text-sidebar: #94a3b8;

  --border-color: #334155;
  --border-color-light: #1e293b;

  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-800: #f1f5f9;
  --gray-900: #f8fafc;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   3. CSS RESET & BASE
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 14px;
  line-height: 1.5;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  min-height: 100vh;
}

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

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

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

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

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

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

::selection {
  background: var(--primary-light);
  color: white;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--gray-300);
}

/* ==========================================================================
   4. APP LAYOUT
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   5. SIDEBAR
   ========================================================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  overflow: hidden;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 28px;
  height: 28px;
  color: var(--primary-light);
}

.logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
  letter-spacing: -0.02em;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  pointer-events: none;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.nav-section-label {
  display: flex;
  align-items: center;
  padding: 20px 20px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-label {
  justify-content: center;
  padding: 20px 0 8px;
}

.sidebar.collapsed .nav-section-label span {
  display: none;
}

.sidebar.collapsed .nav-section-label::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  font-weight: 450;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #e2e8f0;
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-item-icon {
  opacity: 1;
}

.nav-item-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item-text {
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
  margin: 1px 6px;
}

.sidebar.collapsed .nav-item-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-item.active::before {
  left: -6px;
}

/* Sidebar User */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.sidebar-user-name {
  color: #e2e8f0;
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Sidebar Toggle */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-sidebar) + 1);
  transition: transform var(--transition-fast);
  color: var(--text-secondary);
}

.sidebar-toggle:hover {
  background: var(--gray-50);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ==========================================================================
   6. MAIN AREA
   ========================================================================== */

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-area {
  margin-left: var(--sidebar-collapsed-width);
}

/* ==========================================================================
   7. TOPBAR
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: var(--z-topbar);
  flex-shrink: 0;
}

.topbar-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.topbar-menu-btn:hover {
  background: var(--gray-100);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  font-size: 0.875rem;
}

.breadcrumb-item {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-item a {
  color: var(--text-secondary);
}

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

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

.breadcrumb-separator {
  color: var(--gray-300);
  font-size: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-search {
  position: relative;
}

.topbar-search .search-input {
  width: 220px;
  transition: width var(--transition-normal);
}

.topbar-search .search-input:focus {
  width: 320px;
}

.topbar-notifications {
  position: relative;
}

.notification-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  font-size: 0.65rem;
  padding: 0 5px;
}

.topbar-user-menu {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.topbar-user-menu:hover {
  background: var(--gray-100);
}

/* ==========================================================================
   8. MAIN CONTENT
   ========================================================================== */

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - var(--topbar-height));
}

.main-content > *:not(:last-child) {
  margin-bottom: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* ==========================================================================
   9. CARDS
   ========================================================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3,
.card-header h4 {
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--gray-50);
}

[data-theme="dark"] .card-footer {
  background: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   10. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: var(--success-dark);
  border-color: var(--success-dark);
}

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

.btn-danger:hover {
  background: var(--error-dark);
  border-color: var(--error-dark);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-50);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
}

/* Button loading state */
.btn.loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after,
.btn-ghost.loading::after,
.btn-outline.loading::after {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--primary);
}

/* ==========================================================================
   11. BADGES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-error {
  background: var(--error-light);
  color: var(--error);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ==========================================================================
   12. FORMS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-light);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--gray-400);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-input::placeholder {
  color: var(--text-light);
}

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

.form-select {
  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='%236b7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Toggle Switch */
.form-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--gray-300);
  border-radius: 12px;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.form-toggle input:checked + .toggle-track {
  background: var(--primary);
}

.form-toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.form-toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.toggle-label {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Checkbox */
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-mark svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-fast);
}

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

.form-checkbox input:checked + .checkbox-mark svg {
  opacity: 1;
  transform: scale(1);
}

.form-checkbox input:focus-visible + .checkbox-mark {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ==========================================================================
   13. SEARCH INPUT
   ========================================================================== */

.search-input {
  padding: 7px 12px 7px 36px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  width: 100%;
}

[data-theme="dark"] .search-input {
  background: rgba(255, 255, 255, 0.05);
}

.search-input:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* ==========================================================================
   14. DATA TABLE
   ========================================================================== */

.data-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

[data-theme="dark"] .data-table th {
  background: rgba(0, 0, 0, 0.2);
}

.data-table th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.data-table th.sortable:hover {
  color: var(--text-primary);
}

.data-table th .sort-indicator {
  display: inline-flex;
  flex-direction: column;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 0;
}

.data-table th .sort-indicator::before,
.data-table th .sort-indicator::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.data-table th .sort-indicator::before {
  border-bottom: 4px solid var(--gray-300);
  margin-bottom: 2px;
}

.data-table th .sort-indicator::after {
  border-top: 4px solid var(--gray-300);
}

.data-table th.sort-asc .sort-indicator::before {
  border-bottom-color: var(--primary);
}

.data-table th.sort-desc .sort-indicator::after {
  border-top-color: var(--primary);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--primary-50);
}

.data-table.striped tbody tr:nth-child(even) {
  background: var(--gray-50);
}

.data-table.striped tbody tr:nth-child(even):hover {
  background: var(--primary-50);
}

.data-table.compact th,
.data-table.compact td {
  padding: 6px 12px;
}

.data-table .table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ==========================================================================
   15. PAGINATION
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 8px;
}

/* ==========================================================================
   16. MODAL
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-light);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   17. TOAST
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: toastIn 0.35s ease forwards;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  min-width: 320px;
}

.toast.removing {
  animation: toastOut 0.25s ease forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--gray-100);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: progressBar 4s linear forwards;
}

.toast.success .toast-progress { background: var(--success); }
.toast.success .toast-icon { color: var(--success); }

.toast.error .toast-progress { background: var(--error); }
.toast.error .toast-icon { color: var(--error); }

.toast.warning .toast-progress { background: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }

.toast.info .toast-progress { background: var(--info); }
.toast.info .toast-icon { color: var(--info); }

/* ==========================================================================
   18. DROPDOWN
   ========================================================================== */

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

.dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--gray-50);
}

.dropdown-item.danger {
  color: var(--error);
}

.dropdown-item.danger:hover {
  background: var(--error-light);
}

.dropdown-item-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ==========================================================================
   19. TABS
   ========================================================================== */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  gap: 0;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text-primary);
}

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

.tab-content {
  padding: 20px 0;
}

/* ==========================================================================
   20. STATS CARD
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stats-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.stats-card:hover {
  box-shadow: var(--shadow-md);
}

.stats-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.stats-card.stat-primary::before { background: linear-gradient(180deg, var(--primary-light), var(--primary)); }
.stats-card.stat-success::before { background: linear-gradient(180deg, #34d399, var(--success)); }
.stats-card.stat-warning::before { background: linear-gradient(180deg, #fbbf24, var(--warning)); }
.stats-card.stat-error::before   { background: linear-gradient(180deg, #f87171, var(--error)); }
.stats-card.stat-accent::before  { background: linear-gradient(180deg, var(--accent-light), var(--accent)); }
.stats-card.stat-info::before    { background: linear-gradient(180deg, #60a5fa, var(--info)); }

.stats-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-primary .stats-icon { background: var(--primary-50); color: var(--primary); }
.stat-success .stats-icon { background: var(--success-light); color: var(--success); }
.stat-warning .stats-icon { background: var(--warning-light); color: var(--warning); }
.stat-error .stats-icon   { background: var(--error-light); color: var(--error); }
.stat-accent .stats-icon  { background: var(--accent-50); color: var(--accent); }
.stat-info .stats-icon    { background: var(--info-light); color: var(--info); }

.stats-icon svg {
  width: 22px;
  height: 22px;
}

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

.stats-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stats-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stats-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.stats-trend.up {
  color: var(--success);
  background: var(--success-light);
}

.stats-trend.down {
  color: var(--error);
  background: var(--error-light);
}

.stats-trend-arrow {
  font-size: 0.65rem;
}

/* ==========================================================================
   21. PROGRESS BAR
   ========================================================================== */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s ease;
  position: relative;
}

.progress-bar-fill.animated {
  animation: progressBar 2s ease forwards;
}

.progress-bar.success .progress-bar-fill { background: var(--success); }
.progress-bar.warning .progress-bar-fill { background: var(--warning); }
.progress-bar.error .progress-bar-fill   { background: var(--error); }

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 6px;
}

.progress-bar-label .percentage {
  font-weight: 600;
  color: var(--text-primary);
}

/* ==========================================================================
   22. TAGS / CHIPS
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.tag-primary {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-200);
}

.tag-success {
  background: var(--success-light);
  color: var(--success);
  border-color: transparent;
}

.tag-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: transparent;
}

.tag-error {
  background: var(--error-light);
  color: var(--error);
  border-color: transparent;
}

.tag-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.6;
  transition: all var(--transition-fast);
}

.tag-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   23. AVATAR
   ========================================================================== */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}

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

.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.4rem; }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ==========================================================================
   24. EMPTY STATE
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: var(--gray-300);
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin-bottom: 20px;
}

/* ==========================================================================
   25. ALERTS
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  border: 1px solid;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-info {
  background: var(--info-light);
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--info-dark);
}

.alert-success {
  background: var(--success-light);
  border-color: rgba(5, 150, 105, 0.2);
  color: var(--success-dark);
}

.alert-warning {
  background: var(--warning-light);
  border-color: rgba(217, 119, 6, 0.2);
  color: var(--warning-dark);
}

.alert-error {
  background: var(--error-light);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--error-dark);
}

/* ==========================================================================
   26. SKELETON LOADING
   ========================================================================== */

.skeleton {
  background: var(--gray-200);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: skeleton-pulse 1.5s ease infinite;
}

[data-theme="dark"] .skeleton {
  background: var(--gray-200);
}

[data-theme="dark"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%
  );
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

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

.skeleton-title {
  height: 20px;
  width: 50%;
  margin-bottom: 16px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 120px;
}

/* ==========================================================================
   27. STATUS DOT
   ========================================================================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot-online  { background: var(--success); box-shadow: 0 0 0 2px var(--success-light); }
.status-dot-offline { background: var(--gray-400); }
.status-dot-error   { background: var(--error); box-shadow: 0 0 0 2px var(--error-light); }
.status-dot-warning { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-light); }

.status-dot.pulse {
  animation: statusPulse 2s ease infinite;
}

/* ==========================================================================
   28. SPINNER
   ========================================================================== */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* ==========================================================================
   29. UTILITIES
   ========================================================================== */

/* Flexbox */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* Typography */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.8125rem; }
.text-base { font-size: 0.875rem; }
.text-lg   { font-size: 1rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted   { color: var(--text-light); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }

/* Spacing */
.mt-0  { margin-top: 0; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.ml-4  { margin-left: 4px; }
.ml-8  { margin-left: 8px; }
.ml-12 { margin-left: 12px; }
.ml-16 { margin-left: 16px; }
.ml-24 { margin-left: 24px; }
.ml-32 { margin-left: 32px; }

.mr-4  { margin-right: 4px; }
.mr-8  { margin-right: 8px; }
.mr-12 { margin-right: 12px; }
.mr-16 { margin-right: 16px; }
.mr-24 { margin-right: 24px; }
.mr-32 { margin-right: 32px; }

.p-0  { padding: 0; }
.p-4  { padding: 4px; }
.p-8  { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }

/* Display */
.hidden  { display: none !important; }
.visible { display: block; }
.inline  { display: inline; }
.inline-flex { display: inline-flex; }

/* Sizing */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-w-0 { min-width: 0; }

/* Overflow */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Grid */
.grid   { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Border */
.border     { border: 1px solid var(--border-color); }
.border-t   { border-top: 1px solid var(--border-color); }
.border-b   { border-bottom: 1px solid var(--border-color); }
.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* ==========================================================================
   30. KEYFRAME ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

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

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

@keyframes skeleton-pulse {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

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

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes progressBar {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Animation utility classes */
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }
.animate-slide-in { animation: slideIn 0.3s ease forwards; }
.animate-slide-up { animation: slideUp 0.3s ease forwards; }
.animate-count-up { animation: countUp 0.5s ease forwards; }

/* ==========================================================================
   31. RESPONSIVE
   ========================================================================== */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar .logo-text,
  .sidebar .nav-item-text,
  .sidebar .nav-section-label span,
  .sidebar .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: 9px 0;
    margin: 1px 6px;
  }

  .sidebar .nav-section-label {
    justify-content: center;
    padding: 20px 0 8px;
  }

  .sidebar .nav-section-label::after {
    content: '';
    display: block;
    width: 20px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
  }

  .sidebar .nav-item.active::before {
    left: -6px;
  }

  .main-area {
    margin-left: var(--sidebar-collapsed-width);
  }

  .sidebar-toggle {
    display: none;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: var(--shadow-xl);
  }

  .sidebar .logo-text,
  .sidebar .nav-item-text,
  .sidebar .nav-section-label span,
  .sidebar .sidebar-user-info {
    opacity: 1;
    width: auto;
    overflow: visible;
  }

  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 9px 20px;
    margin: 1px 8px;
  }

  .sidebar .nav-section-label {
    justify-content: flex-start;
    padding: 20px 20px 8px;
  }

  .sidebar .nav-section-label::after {
    display: none;
  }

  .sidebar .nav-item.active::before {
    left: -8px;
  }

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

  .sidebar-toggle {
    display: none;
  }

  .main-area {
    margin-left: 0;
  }

  .topbar-menu-btn {
    display: flex;
  }

  .topbar-search {
    display: none;
  }

  .main-content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100%;
    margin: 8px;
    border-radius: var(--radius-lg);
  }

  .toast-container {
    right: 8px;
    left: 8px;
    max-width: none;
  }

  .toast {
    min-width: 0;
  }
}

/* Mobile overlay for sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   32. LOGIN PAGE
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0a0f1e;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(8, 145, 178, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 10% 80%, rgba(99, 102, 241, 0.12) 0%, transparent 50%);
  position: relative;
  overflow: hidden;
}

/* Animated background grid */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  pointer-events: none;
  animation: fadeIn 1.5s ease;
}

/* Decorative floating orb */
.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.2),
    0 32px 64px -16px rgba(0, 0, 0, 0.4);
  padding: 44px 40px 36px;
  position: relative;
  z-index: 1;
  animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
}

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

[data-theme="dark"] .login-card {
  background: rgba(22, 28, 45, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 32px 64px -16px rgba(0, 0, 0, 0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #1e40af 0%, #0891b2 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 12px rgba(30, 64, 175, 0.3),
    0 0 0 4px rgba(30, 64, 175, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-logo-icon:hover {
  transform: scale(1.05) rotate(-2deg);
  box-shadow:
    0 6px 20px rgba(30, 64, 175, 0.4),
    0 0 0 6px rgba(30, 64, 175, 0.1);
}

.login-logo-icon svg {
  width: 34px;
  height: 34px;
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.login-logo h1 {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin: 0;
}

.login-logo p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 400;
}

.login-form .form-group {
  margin-bottom: 22px;
}

.login-form .form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: block;
  letter-spacing: 0.01em;
}

.login-form .form-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.9375rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.login-form .form-input::placeholder {
  color: var(--gray-400);
}

.login-form .form-input:hover {
  border-color: var(--gray-300);
}

.login-form .form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .login-form .form-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .login-form .form-input:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--primary-light);
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.login-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.login-btn:hover {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.35);
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.login-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.login-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
}

.login-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 22px;
  display: none;
  animation: loginCardIn 0.25s ease;
  border: 1px solid #fecaca;
  line-height: 1.4;
}

.login-error.show {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-error svg {
  flex-shrink: 0;
}

[data-theme="dark"] .login-error {
  background: rgba(185, 28, 28, 0.12);
  border-color: rgba(185, 28, 28, 0.2);
  color: #fca5a5;
}

/* 2FA section */
.login-2fa {
  display: none;
  animation: fadeIn 0.35s ease;
}

.login-2fa.show {
  display: block;
}

.login-2fa h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.totp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 28px 0;
}

.totp-input {
  width: 48px;
  height: 58px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  background: var(--gray-50);
  color: var(--text-primary);
  transition: all 0.2s ease;
  caret-color: var(--primary);
}

.totp-input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  transform: scale(1.05);
}

.totp-input.filled {
  border-color: var(--primary);
  background: var(--primary-50);
  color: var(--primary-dark);
}

[data-theme="dark"] .totp-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.login-2fa-back,
.login-recovery-link {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  margin-top: 16px;
  transition: color 0.15s ease;
  font-weight: 500;
}

.login-2fa-back:hover,
.login-recovery-link:hover {
  color: var(--primary);
}

.login-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 1;
  letter-spacing: 0.01em;
}

/* Checkbox styling for login */
.login-actions .form-checkbox {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.login-actions .form-checkbox input[type="checkbox"] {
  display: none;
}

.login-actions .checkbox-mark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--gray-300);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.login-actions .checkbox-mark svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  color: white;
  transition: opacity 0.15s ease;
}

.login-actions .form-checkbox input:checked + .checkbox-mark {
  background: var(--primary);
  border-color: var(--primary);
}

.login-actions .form-checkbox input:checked + .checkbox-mark svg {
  opacity: 1;
}

/* Login page responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px 28px;
    border-radius: 16px;
    max-width: 100%;
  }

  .login-logo-icon {
    width: 56px;
    height: 56px;
  }

  .login-logo h1 {
    font-size: 1.375rem;
  }

  .totp-input {
    width: 42px;
    height: 50px;
    font-size: 1.25rem;
  }

  .totp-inputs {
    gap: 6px;
  }
}

/* ==========================================================================
   34. AVATAR
   ========================================================================== */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ==========================================================================
   35. ADDITIONAL FORM & PAGE UTILITIES
   ========================================================================== */

/* Native select/input/textarea without class */
.main-content select,
.modal-body select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  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='%236b7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s ease;
  cursor: pointer;
}

.main-content input[type="text"],
.main-content input[type="email"],
.main-content input[type="password"],
.main-content input[type="number"],
.main-content input[type="url"],
.main-content input[type="search"],
.main-content input[type="date"],
.main-content textarea,
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body input[type="url"],
.modal-body input[type="search"],
.modal-body input[type="date"],
.modal-body textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.main-content input:focus,
.main-content select:focus,
.main-content textarea:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.main-content input:hover,
.main-content select:hover,
.main-content textarea:hover,
.modal-body input:hover,
.modal-body select:hover,
.modal-body textarea:hover {
  border-color: var(--gray-400);
}

.main-content textarea,
.modal-body textarea {
  resize: vertical;
  min-height: 80px;
}

.main-content input[type="color"] {
  padding: 2px;
  height: 38px;
  width: 60px;
  cursor: pointer;
}

.main-content input[type="checkbox"],
.modal-body input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar select,
.filter-bar input {
  max-width: 220px;
}

.filter-bar .search-input {
  flex: 1;
  min-width: 180px;
}

/* Page tabs */
.page-tabs,
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  gap: 0;
}

.page-tabs .tab,
.tab-bar .tab,
.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}

.page-tabs .tab:hover,
.tab-bar .tab:hover,
.tab-btn:hover {
  color: var(--text-primary);
}

.page-tabs .tab.active,
.tab-bar .tab.active,
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Tag/chip */
.tag, .tag-sm {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 99px;
  background: var(--gray-100);
  color: var(--text-secondary);
  gap: 4px;
  white-space: nowrap;
}

.tag-sm {
  padding: 1px 6px;
  font-size: 0.6875rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state h2 {
  font-size: 1.125rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Text utilities */
.text-muted { color: var(--text-secondary); }
.text-danger, .text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.8125rem; }
.text-secondary { color: var(--text-secondary); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* Action cells */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.error { background: var(--error); }

/* Loading */
.loading-spinner {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

/* Settings / form section */
.settings-section,
.form-section {
  max-width: 640px;
}

.settings-section .form-group {
  margin-bottom: 20px;
}

/* Rich text editor toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px;
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.editor-toolbar button {
  padding: 6px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  line-height: 1;
}

.editor-toolbar button:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

.editor-toolbar button.active {
  background: var(--primary-100);
  color: var(--primary);
  border-color: var(--primary-200);
}

.editor-toolbar .separator {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
  align-self: center;
}

.editor-content {
  min-height: 300px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  outline: none;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-card);
}

.editor-content:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

/* Wizard steps */
.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 99px;
}

.wizard-step.active {
  background: var(--primary-100);
  color: var(--primary);
  font-weight: 600;
}

.wizard-step.completed {
  color: var(--success);
}

.wizard-step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

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

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

/* API docs layout */
.api-docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}

.api-docs-nav {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.api-docs-nav a {
  display: block;
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.15s;
}

.api-docs-nav a:hover,
.api-docs-nav a.active {
  background: var(--primary-50);
  color: var(--primary);
}

.api-docs-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.api-docs-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.api-docs-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.5;
  position: relative;
  margin: 12px 0;
}

.api-docs-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.code-copy-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Category tree */
.category-tree {
  padding: 0;
  list-style: none;
}

.category-tree-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-tree-item:hover {
  background: var(--gray-50);
}

/* Dark mode extras */
[data-theme="dark"] .main-content input,
[data-theme="dark"] .main-content select,
[data-theme="dark"] .main-content textarea,
[data-theme="dark"] .modal-body input,
[data-theme="dark"] .modal-body select,
[data-theme="dark"] .modal-body textarea {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .editor-toolbar {
  background: var(--gray-800);
}

[data-theme="dark"] .api-docs-content pre {
  background: #0f172a;
}

/* Dark mode: modal */
[data-theme="dark"] .modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-header {
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-close {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-close:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

/* Dark mode: dropdown */
[data-theme="dark"] .dropdown {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item:hover {
  background: var(--gray-200);
}

/* Dark mode: badges */
[data-theme="dark"] .badge-success {
  background: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
}

[data-theme="dark"] .badge-warning {
  background: rgba(217, 119, 6, 0.2);
  color: #fcd34d;
}

[data-theme="dark"] .badge-error, [data-theme="dark"] .badge-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

[data-theme="dark"] .badge-secondary {
  background: var(--gray-200);
  color: var(--text-secondary);
}

/* Dark mode: cards */
[data-theme="dark"] .card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

/* Dark mode: topbar */
[data-theme="dark"] .topbar {
  background: var(--bg-topbar);
  border-color: var(--border-color);
}

[data-theme="dark"] .topbar-user-menu:hover {
  background: var(--gray-200);
}

/* Dark mode: data table */
[data-theme="dark"] .data-table tbody tr:hover {
  background: var(--gray-100);
}

[data-theme="dark"] .data-table td {
  border-color: var(--border-color);
}

/* Dark mode: tags */
[data-theme="dark"] .tag, [data-theme="dark"] .tag-sm {
  background: var(--gray-200);
  color: var(--text-secondary);
}

/* Dark mode: progress bars */
[data-theme="dark"] .progress-bar {
  background: var(--gray-200);
}

/* Dark mode: page tabs */
[data-theme="dark"] .page-tabs,
[data-theme="dark"] .tab-bar {
  border-color: var(--border-color);
}

/* Dark mode: filter bar */
[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-bar input {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

/* Dark mode: empty state */
[data-theme="dark"] .empty-state {
  color: var(--text-secondary);
}

[data-theme="dark"] .empty-state h2 {
  color: var(--text-primary);
}

/* Campaign progress mini stats */
.stat-mini {
  text-align: center;
  padding: 12px;
  background: var(--gray-50);
  border-radius: 8px;
}

.stat-mini-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-mini-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-mini.success .stat-mini-value { color: var(--success); }
.stat-mini.error .stat-mini-value { color: var(--error); }
.stat-mini.warning .stat-mini-value { color: var(--warning); }
.stat-mini.info .stat-mini-value { color: var(--primary); }

[data-theme="dark"] .stat-mini {
  background: var(--gray-200);
}

/* Queue status badges in table */
.queue-status-sent { color: var(--success); font-weight: 500; }
.queue-status-failed { color: var(--error); font-weight: 500; }
.queue-status-queued { color: var(--primary); font-weight: 500; }
.queue-status-processing { color: var(--warning); font-weight: 500; }
.queue-status-bounced { color: var(--error); font-weight: 500; }

/* Details/Summary styling */
details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 8px 0;
  user-select: none;
}

details summary:hover {
  color: var(--primary);
}

/* Pulse animation for sending status */
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.badge-pulse {
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .api-docs-layout {
    grid-template-columns: 1fr;
  }
  .api-docs-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar select,
  .filter-bar input {
    max-width: 100%;
  }
}

/* ==========================================================================
   33. PRINT STYLES
   ========================================================================== */

@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  .main-area {
    margin-left: 0 !important;
  }

  .main-content {
    padding: 0;
    max-height: none;
    overflow: visible;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
