/* ==========================================================================
   DMUS Operating System — Design System
   Brand: DMUS Hub Control Center
   Palette: Restrained Indigo / Purple Accents + Premium Slate Neutrals
   ========================================================================== */

:root {
  /* Color Palette */
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-500: #6366F1;
  --primary-600: #4F46E5;
  --primary-700: #4338CA;
  --primary-800: #3730A3;
  --primary-900: #312E81;
  
  --accent-purple: #7C3AED;
  --accent-purple-light: #F5F3FF;
  --accent-teal: #0D9488;
  --accent-amber: #D97706;
  --accent-rose: #E11D48;
  --accent-emerald: #059669;

  /* Neutrals (Light Mode) */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-hover: #F8FAFC;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;

  /* Status Colors */
  --status-new-bg: #EFF6FF;
  --status-new-text: #1D4ED8;
  --status-contacted-bg: #FEF3C7;
  --status-contacted-text: #B45309;
  --status-qualified-bg: #EDE9FE;
  --status-qualified-text: #6D28D9;
  --status-proposal-bg: #E0E7FF;
  --status-proposal-text: #4338CA;
  --status-won-bg: #DCFCE7;
  --status-won-text: #15803D;
  --status-lost-bg: #FEE2E2;
  --status-lost-text: #B91C1C;
  --status-blocked-bg: #FFE4E6;
  --status-blocked-text: #BE123C;

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

  /* Radius & Transitions */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar Width */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
  --bg-app: #0B0F19;
  --bg-surface: #111827;
  --bg-subtle: #1F2937;
  --bg-hover: #1E293B;
  --border-subtle: #1F2937;
  --border-strong: #374151;
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-subtle: #6B7280;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: width var(--transition-normal), transform var(--transition-normal);
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--accent-purple) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--primary-50);
  color: var(--primary-600);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 700;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
  border-color: var(--primary-100);
}

[data-theme="dark"] .nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
  border-color: rgba(99, 102, 241, 0.3);
}

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

.nav-item .nav-label {
  flex: 1;
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.nav-badge.alert {
  background: #FEE2E2;
  color: #DC2626;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.version-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
}

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

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 520px;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-main);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  width: 100%;
  transition: all var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--primary-500);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box input {
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text-main);
  outline: none;
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Role Switcher in Topbar */
.role-badge-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.role-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* User Profile Badge */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-100);
  color: var(--primary-700);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.user-meta {
  text-align: left;
  line-height: 1.2;
}
.user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}
.user-role-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Page Container */
.page-container {
  padding: 28px;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-group h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-title-group p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary-600);
  color: white;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover {
  background: var(--primary-700);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-success {
  background: var(--accent-emerald);
  color: white;
}
.btn-success:hover {
  background: #047857;
}

.btn-danger {
  background: #DC2626;
  color: white;
}
.btn-danger:hover {
  background: #B91C1C;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

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

/* Card System */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 22px;
}

/* Metrics & Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

.stat-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-trend-up {
  color: var(--accent-emerald);
  font-weight: 600;
}
.stat-trend-down {
  color: var(--accent-rose);
  font-weight: 600;
}

/* Filter Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-select, .form-input {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary-500);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-subtle);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

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

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

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Kanban Board Styles */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-col {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 4px;
}

.kanban-col-title {
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: all var(--transition-fast);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-200);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 150ms ease-out;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

.modal-dialog.modal-lg {
  max-width: 900px;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

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

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

/* Slide Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 150ms ease-out;
}

.drawer {
  background: var(--bg-surface);
  width: 100%;
  max-width: 580px;
  height: 100%;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  animation: slideInRight 200ms ease-out;
}

/* Tabs */
.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

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

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideUp 200ms ease-out;
}

.toast.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast.toast-warning { border-left: 4px solid var(--accent-amber); }
.toast.toast-error { border-left: 4px solid var(--accent-rose); }
.toast.toast-info { border-left: 4px solid var(--primary-600); }

/* Form Group Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

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

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
}

.form-error {
  font-size: 11px;
  color: #DC2626;
  font-weight: 500;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.8;
}
.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto 18px;
}

/* Duplicate Warning Banner */
.duplicate-warning-banner {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  color: #92400E;
}

[data-theme="dark"] .duplicate-warning-banner {
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.3);
  color: #FCD34D;
}

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

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

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

/* ==========================================================================
   Shared Pagination Controls (Circular / Rounded Styling)
   ========================================================================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.pagination-btn.pagination-number {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.pagination-btn.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #FFFFFF !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

.pagination-size-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-size-selector select {
  padding: 4px 10px;
  font-size: 12px;
  height: 32px;
  width: auto;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
}

/* ==========================================================================
   Client Directory — Card View & Timeline
   ========================================================================== */
.client-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.client-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.client-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.client-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.client-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.client-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}

/* Client Activity Timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding-left: 20px;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  background: var(--border-subtle);
}

.timeline-item {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
}

.timeline-marker {
  position: absolute;
  left: -21px;
  top: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-600);
  border: 3px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--primary-200);
}

.timeline-marker.type-call { background: #2563EB; }
.timeline-marker.type-meeting { background: #7C3AED; }
.timeline-marker.type-whatsapp { background: #16A34A; }
.timeline-marker.type-email { background: #EA580C; }
.timeline-marker.type-note { background: #64748B; }

/* Contact chips */
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.contact-chip.is-primary {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}

/* Responsive Styles */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-nav-toggle {
    display: block;
  }
}

@media (max-width: 640px) {
  .page-container {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pagination-nav {
    justify-content: center;
  }
  .pagination-size-selector {
    justify-content: space-between;
  }
}

/* Service System Specific Styles (Section 6, 10) */
.badge-service-active {
  background: #ECFDF5 !important;
  color: #047857 !important;
  border: 1px solid #A7F3D0 !important;
  font-weight: 700 !important;
}

.badge-service-deactivated {
  background: #F1F5F9 !important;
  color: #64748B !important;
  border: 1px solid #CBD5E1 !important;
  font-weight: 600 !important;
}

.service-card-compact {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.service-card-compact:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.service-card-deactivated {
  opacity: 0.82;
  background: #FAFAFA;
}

/* ==========================================================================
   Authentication, User Menu, Preview Banner & Preferences System Styles
   ========================================================================== */

/* 1. Login Page & Card */
.login-page-wrapper {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.12), transparent 60%), var(--bg-app);
  padding: 24px;
  position: relative;
}

.login-theme-bar {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 10;
}

.login-theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.login-theme-toggle:hover {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-md);
}

.login-card-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(99, 102, 241, 0.05);
  position: relative;
}

[data-theme="dark"] .login-card {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.login-brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-box {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.25);
  padding: 10px;
}

[data-theme="dark"] .login-logo-box {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.4);
}

.login-official-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.login-brand-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.login-brand-positioning {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-600);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
}

.login-brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Alert Container */
.login-alert-box {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
  animation: fadeIn 200ms ease;
}

.login-alert-info {
  background: var(--primary-50);
  color: var(--primary-900);
  border: 1px solid var(--primary-200);
}

[data-theme="dark"] .login-alert-info {
  background: rgba(99, 102, 241, 0.12);
  color: #C7D2FE;
  border-color: rgba(99, 102, 241, 0.3);
}

.login-alert-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

[data-theme="dark"] .login-alert-error {
  background: rgba(225, 29, 72, 0.15);
  color: #FECDD3;
  border-color: rgba(225, 29, 72, 0.3);
}

.login-alert-success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

[data-theme="dark"] .login-alert-success {
  background: rgba(5, 150, 105, 0.15);
  color: #A7F3D0;
  border-color: rgba(5, 150, 105, 0.3);
}

/* Input enhancements */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.7;
}

.input-with-icon input {
  padding-left: 36px;
}

.login-input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.login-otp-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: 10px !important;
  text-align: center !important;
  height: 56px !important;
  border: 2px solid var(--border-strong) !important;
  border-radius: 12px !important;
  transition: all var(--transition-fast) !important;
}

.login-otp-field:focus {
  border-color: var(--primary-600) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15) !important;
}

.login-otp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-main);
}

.login-resend-container {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-security-notice {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 11px;
  color: var(--text-subtle);
}

/* Demo Staff Pills */
.login-demo-helper {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--border-subtle);
}

.login-demo-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.login-demo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.login-demo-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-demo-pill:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
}

[data-theme="dark"] .login-demo-pill:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #C7D2FE;
}

/* 2. Admin Preview Mode Banner */
.preview-mode-banner {
  background: linear-gradient(90deg, #B45309, #D97706);
  color: #FFFFFF;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
  position: relative;
  z-index: 50;
  font-size: 13px;
  animation: slideDown 200ms ease;
}

.preview-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-banner-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.preview-banner-text {
  color: #FFFBEB;
}

.preview-banner-text strong {
  color: #FFFFFF;
}

/* 3. User Avatar Menu & Dropdown */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

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

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  padding: 8px;
  z-index: 100;
  animation: fadeIn 150ms ease;
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
}

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

.dropdown-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
  border: none;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--primary-600);
}

.dropdown-item-danger:hover {
  background: #FEE2E2 !important;
  color: var(--accent-rose, #e11d48) !important;
}

[data-theme="dark"] .dropdown-item-danger:hover {
  background: rgba(225, 29, 72, 0.2) !important;
  color: #FECDD3 !important;
}

.dropdown-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

/* 4. Account & Preferences View Layout */
.account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .account-grid {
    grid-template-columns: 1.1fr 1fr;
  }
}

.theme-card {
  transition: all var(--transition-fast);
}

.theme-card:hover {
  border-color: var(--primary-400) !important;
  box-shadow: var(--shadow-sm);
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


