/* ============================================================
   Devora LMS — Main Stylesheet
   Modern, Dark-Mode-Ready, Premium UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
  /* Brand Colors */
  --primary:        #eab308;       /* Yellow/Gold Primary */
  --primary-dark:   #ca8a04;       /* Darker Yellow */
  --primary-light:  #fef08a;       /* Soft Yellow */
  --secondary:      #18181b;       /* Charcoal Black */
  --accent:         #eab308;       /* Yellow Accent */
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  /* Light Mode */
  --bg-body:        #fafafa;
  --bg-card:        #ffffff;
  --bg-sidebar:     #09090b;       /* Black Sidebar */
  --bg-sidebar-hover: #18181b;     /* Lighter Black for Hover */
  --bg-topbar:      #ffffff;
  --text-primary:   #09090b;       /* Charcoal/black for best contrast */
  --text-secondary: #27272a;       /* Zinc 800 */
  --text-muted:     #71717a;       /* Zinc 500 */
  --text-sidebar:   #f4f4f5;       /* Sidebar link color */
  --border-color:   #e4e4e7;       /* Zinc 200 */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.02);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.05), 0 4px 6px -2px rgba(0,0,0,.02);
  --shadow-xl:      0 20px 25px -5px rgba(0,0,0,.05), 0 10px 10px -5px rgba(0,0,0,.02);
  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --sidebar-width:  260px;
  --topbar-height:  64px;
  --transition:     all .2s cubic-bezier(.4,0,.2,1);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-body:        #09090b;       /* Deep black body */
  --bg-card:        #18181b;       /* Charcoal card */
  --bg-topbar:      #18181b;
  --text-primary:   #f4f4f5;       /* Off-white */
  --text-secondary: #d4d4d8;       /* Light gray */
  --text-muted:     #71717a;       /* Slate gray */
  --border-color:   #27272a;       /* Zinc 700 */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.5);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.6);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.6);
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  transition: background .3s, color .3s;
  min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: #854d0e; text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ============================================================
   LAYOUT — SIDEBAR + MAIN
   ============================================================ */
.lms-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.lms-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand-logo {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #09090b;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-sidebar);
  opacity: .7;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-sidebar);
  opacity: .5;
  padding: 12px 20px 4px;
}

.sidebar-nav-item {
  display: block;
  padding: 0;
  margin: 2px 10px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar-nav-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-nav-link.active {
  background: var(--primary);
  color: #09090b;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(234,179,8,.4);
}

.sidebar-nav-link .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar-nav-link.active .nav-icon { opacity: 1; }

.badge-nav {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}

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

/* ---- Topbar ---- */
.lms-topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
  gap: 16px;
}

.topbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}

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

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-topbar);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 40px;
  cursor: pointer;
  transition: var(--transition);
}

.topbar-user:hover { background: var(--border-color); }

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ---- Page Content ---- */
.lms-content {
  padding: 28px 28px;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 20px; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--border-color);
  padding: 14px 20px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

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

.stat-icon.purple   { background: rgba(234,179,8,.15); color: var(--primary-dark); }
.stat-icon.blue     { background: rgba(59,130,246,.15); color: var(--info); }
.stat-icon.green    { background: rgba(16,185,129,.15); color: var(--success); }
.stat-icon.yellow   { background: rgba(245,158,11,.15); color: var(--warning); }
.stat-icon.red      { background: rgba(239,68,68,.15);  color: var(--danger); }
.stat-icon.cyan     { background: rgba(6,182,212,.15);  color: var(--accent); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 9px 14px;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234,179,8,.15);
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
}

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-weight: 500;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #09090b;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(234,179,8,.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234,179,8,.4);
  color: #09090b;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  border: none;
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  border: none;
  color: #fff;
}

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

.btn-outline-primary:hover {
  background: var(--primary);
  color: #09090b;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* ============================================================
   TABLES
   ============================================================ */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  color: var(--text-primary);
  margin: 0;
}

.table thead th {
  background: var(--bg-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 13.5px;
}

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

.table tbody tr:hover { background: rgba(234,179,8,.03); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 32px;  height: 32px; }
.avatar-md  { width: 44px;  height: 44px; }
.avatar-lg  { width: 64px;  height: 64px; }
.avatar-xl  { width: 96px;  height: 96px; }
.avatar-xxl { width: 120px; height: 120px; }

.avatar-placeholder {
  background: var(--primary);
  color: #09090b;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.breadcrumb {
  background: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
}

.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); }

/* ============================================================
   NOTIFICATIONS DROPDOWN
   ============================================================ */
.notif-dropdown {
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  background: var(--bg-card);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}

.notif-item:hover { background: var(--bg-body); }
.notif-item.unread { background: rgba(234,179,8,.05); }

.notif-dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-msg   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 8px;
  border-radius: 20px;
  background: var(--border-color);
  overflow: hidden;
}

.progress-bar {
  background: var(--primary);
  border-radius: 20px;
  transition: width .8s ease;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #09090b 0%, #18181b 50%, #09090b 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(234,179,8,.15), transparent 70%);
  top: -200px; right: -200px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(234,179,8,.1), transparent 70%);
  bottom: -100px; left: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

[data-theme="dark"] .auth-card {
  background: rgba(30,41,59,.97);
}

.auth-logo {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #09090b;
  margin: 0 auto 20px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.hero-section {
  min-height: 100vh;
  background: linear-gradient(135deg, #09090b, #18181b 40%, #09090b);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
}

.hero-bg-glow {
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(234,179,8,.15), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero-title .highlight {
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,.7);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* ============================================================
   EXAM TIMER
   ============================================================ */
.exam-timer-bar {
  position: sticky;
  top: var(--topbar-height);
  z-index: 800;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timer-display {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.timer-display.warning { color: var(--warning); animation: pulse-warn 1s infinite; }
.timer-display.danger  { color: var(--danger);  animation: pulse-warn .5s infinite; }

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ============================================================
   MESSAGES
   ============================================================ */
.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.message-bubble.sent {
  background: var(--primary);
  color: #09090b;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.message-bubble.received {
  background: var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */
.dark-toggle {
  width: 44px; height: 24px;
  background: var(--border-color);
  border-radius: 20px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.dark-toggle.on { background: var(--primary); }

.dark-toggle::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: var(--shadow-sm);
}

.dark-toggle.on::after { transform: translateX(20px); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary-custom { color: var(--primary) !important; }
.text-muted-custom   { color: var(--text-muted) !important; }
.bg-card             { background: var(--bg-card) !important; }
.border-custom       { border-color: var(--border-color) !important; }

.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }

.rounded-custom { border-radius: var(--radius-md) !important; }

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

/* Course thumbnail */
.course-thumbnail {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.course-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .lms-sidebar {
    transform: translateX(-100%);
  }
  .lms-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .lms-main { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .lms-content { padding: 16px; }
}

@media (max-width: 575.98px) {
  .auth-card { padding: 28px 20px; }
  .stat-card { flex-direction: column; text-align: center; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   SIDEBAR OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

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

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp .4s ease both; }

.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .10s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .20s; }

/* ============================================================
   DATATABLES — Full Design System Integration
   ============================================================ */

/* --- Top/Bottom bar wrappers --- */
.dt-top-bar,
.dt-bottom-bar {
  flex-wrap: wrap;
  gap: 10px;
}

/* --- Length "Show X entries" label --- */
.dataTables_length label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

/* --- Wrapper around the <select> (for custom arrow) --- */
.dt-length-wrapper {
  position: relative;
  display: inline-block;
}

.dt-length-wrapper::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

/* --- Length <select> --- */
.dt-length-select,
.dataTables_length select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  padding: 6px 30px 6px 12px !important;
  font-size: 13px !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  min-width: 70px;
  line-height: 1.4;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.dt-length-select:focus,
.dataTables_length select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(234,179,8,.15) !important;
}

.dt-length-select:hover,
.dataTables_length select:hover {
  border-color: var(--primary) !important;
}

/* --- Search input --- */
.dt-search-input,
.dataTables_filter input {
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  padding: 6px 12px 6px 34px !important;
  font-size: 13px !important;
  font-family: 'Inter', sans-serif !important;
  width: 220px !important;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.dt-search-input:focus,
.dataTables_filter input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(234,179,8,.15) !important;
  width: 260px !important;
}

/* Search icon inside input */
.dataTables_filter label {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.dataTables_filter label::before {
  content: '';
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='M21 21l-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}

/* --- Pagination --- */
.dataTables_wrapper .dataTables_paginate {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 8px !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all .2s !important;
  line-height: 1 !important;
  box-shadow: var(--shadow-sm) !important;
  text-decoration: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #000 !important;
  box-shadow: 0 2px 8px rgba(234,179,8,.3) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  border-color: var(--primary-dark) !important;
  color: #000 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(234,179,8,.4) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  opacity: .5 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

/* --- Info text --- */
.dataTables_wrapper .dataTables_info {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-top: 2px;
}

/* --- Sorting arrows on <th> --- */
table.dataTable thead th {
  position: relative;
  cursor: pointer;
  padding-right: 22px !important;
  user-select: none;
}

table.dataTable thead th::after {
  content: '⇅';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  opacity: .5;
}

table.dataTable thead th.sorting_asc::after { content: '↑'; color: var(--primary); opacity: 1; }
table.dataTable thead th.sorting_desc::after { content: '↓'; color: var(--primary); opacity: 1; }

/* --- Processing indicator --- */
.dataTables_wrapper .dataTables_processing {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-muted);
  box-shadow: var(--shadow-md);
}

/* --- Dark mode fine-tuning --- */
[data-theme="dark"] .dt-length-wrapper::after {
  border-top-color: var(--text-muted);
}

[data-theme="dark"] .dataTables_filter label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='M21 21l-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
}

/* Chart container */
.chart-container { position: relative; height: 260px; }

