:root {
  color-scheme: dark;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #273548;
  --bg-input: #0f172a;
  --bg-sidebar: #0f172a;
  --bg-navbar: rgba(15, 23, 42, 0.8);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --border-color: rgba(148, 163, 184, 0.1);
  --border-color-hover: rgba(148, 163, 184, 0.2);

  /* Bootstrap 5 Dark Theme Compatibility */
  --bs-body-color: #f1f5f9;
  --bs-body-bg: #0f172a;
  --bs-emphasis-color: #f8fafc;
  --bs-secondary-color: #94a3b8;
  --bs-tertiary-color: #64748b;
  --bs-border-color: rgba(148, 163, 184, 0.15);
  --bs-secondary-bg: #1e293b;
  --bs-tertiary-bg: #0f172a;

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

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --sidebar-width: 260px;
  --navbar-height: 64px;

  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(148, 163, 184, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --hover-bg: var(--bg-card-hover);
  --primary-alpha: rgba(99, 102, 241, 0.1);
  --card-bg: var(--bg-card);
  --text-color: var(--text-primary);
  --radius: var(--radius-md);

  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-navbar: rgba(255, 255, 255, 0.8);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f1f5f9;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.15);

  /* Bootstrap 5 Light Theme Compatibility */
  --bs-body-color: #0f172a;
  --bs-body-bg: #ffffff;
  --bs-emphasis-color: #0f172a;
  --bs-secondary-color: #475569;
  --bs-tertiary-color: #94a3b8;
  --bs-border-color: rgba(0, 0, 0, 0.12);
  --bs-secondary-bg: #f8fafc;
  --bs-tertiary-bg: #ffffff;

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

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

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

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

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

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

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.stat-card .stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.trend-up::before {
  content: "\f062";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.trend-down {
  color: var(--danger);
}

.trend-down::before {
  content: "\f063";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

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

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

.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2rem; font-size: 1.125rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }

.form-control,
input.form-control,
textarea.form-control,
select.form-control {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary) !important;
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.form-control:focus,
input.form-control:focus,
textarea.form-control:focus,
select.form-control:focus {
  outline: none;
  color: var(--text-primary) !important;
  background-color: var(--bg-input) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

.form-control::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.7 !important;
}

.form-control:disabled,
.form-control[readonly] {
  background-color: var(--bg-secondary) !important;
  color: var(--text-muted) !important;
  opacity: 0.7;
}

.form-control::file-selector-button {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  margin-right: 0.75rem;
  transition: var(--transition);
  font-size: 0.8125rem;
}

.form-control::file-selector-button:hover {
  background: var(--primary);
  color: #ffffff;
}

input, textarea, select {
  color: var(--text-primary) !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text-primary) !important;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-text { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem; }
[data-theme="dark"] select.form-control option { color: #e2e8f0; background: #1e293b; }
[data-theme="light"] select.form-control option { color: #0f172a; background: #fff; }

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

.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 2.5rem; }
.pw-field .pw-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  z-index: 2;
}
.pw-field .pw-toggle:hover { color: var(--text-secondary); }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-check-input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.form-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.form-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.form-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color);
  border-radius: 24px;
  transition: var(--transition);
}

.form-switch .slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.form-switch input:checked + .slider { background: var(--primary); }
.form-switch input:checked + .slider::before { transform: translateX(20px); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-secondary { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
}

.alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); color: var(--warning); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); color: var(--danger); }
.alert-info { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); color: var(--info); }

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

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

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tr:hover td { background: var(--bg-card-hover); }
.table tr:last-child td { border-bottom: none; }

.list-group-item {
  background: transparent;
  color: var(--text-primary);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  height: var(--navbar-height);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

.sidebar-brand .brand-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.sidebar-section {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 0.75rem 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
}

.sidebar-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}

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

.sidebar-item .nav-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border-color);
}

.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--navbar-height);
  background: var(--bg-navbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 999;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-search {
  position: relative;
  width: 320px;
}

.navbar-search .form-control {
  padding-left: 2.5rem;
  background: var(--bg-card);
  border-color: transparent;
}

.navbar-search .form-control:focus {
  border-color: var(--primary);
  background: var(--bg-input);
}

.navbar-search .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.navbar-search .kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-family: inherit;
}

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  padding: 1.5rem;
  min-height: calc(100vh - var(--navbar-height));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

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

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { color: var(--text-muted); }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.8125rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.375rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 2rem; }

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1050;
  min-width: 200px;
  padding: 0.375rem;
  margin-top: 0.375rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: var(--transition);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 0.375rem 0; }

.dropdown-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

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

.modal-dialog {
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition);
}

.modal.show .modal-dialog { transform: scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.modal-body { padding: 1.5rem; overflow-y: auto; color: var(--text-primary); }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-primary);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.progress {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 999px;
  overflow: hidden;
}

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

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

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

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

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state .empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

.page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  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: var(--transition);
  text-decoration: none;
}

.page-item:hover { border-color: var(--primary); color: var(--primary); }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled { opacity: 0.5; cursor: not-allowed; }

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

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

.toast-container {
  position: fixed;
  top: calc(var(--navbar-height) + 0.75rem);
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 320px;
  max-width: 420px;
  animation: slideIn 0.3s ease;
}

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

.toast .toast-icon { font-size: 1.125rem; flex-shrink: 0; margin-top: 0.125rem; }
.toast .toast-content { flex: 1; }
.toast .toast-title { font-size: 0.875rem; font-weight: 600; }
.toast .toast-message { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.125rem; }
.toast .toast-close { cursor: pointer; color: var(--text-muted); font-size: 0.875rem; }

.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  z-index: 100;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.command-palette.show { opacity: 1; visibility: visible; }

.command-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.command-palette-dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition);
}

.command-palette.show .command-palette-dialog { transform: scale(1); }

.command-palette-search {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.command-palette-search input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.125rem;
  color: var(--text-primary);
  outline: none;
}

.command-palette-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.command-palette-item:hover,
.command-palette-item.selected {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.command-palette-item .cmd-icon { width: 20px; text-align: center; }
.command-palette-item .cmd-shortcut {
  margin-left: auto;
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.timeline {
  position: relative;
  padding-left: 1.5rem;
}

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

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item .timeline-dot {
  position: absolute;
  left: -1.25rem;
  top: 0.25rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-primary);
}

.timeline-item .timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-item .timeline-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.offline-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.offline-indicator.online { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.offline-indicator.offline { background: var(--text-muted); }
.offline-indicator.warning { background: var(--warning); box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }

.floating-labels { position: relative; }
.floating-labels .form-control:focus ~ label,
.floating-labels .form-control:not(:placeholder-shown) ~ label {
  transform: translateY(-1.5rem) scale(0.85);
  color: var(--primary);
}

.hover-scale { transition: var(--transition); }
.hover-scale:hover { transform: scale(1.02); }

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

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

.chart-container-sm { height: 200px; }
.chart-container-lg { height: 400px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 0.875rem; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }

.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
}

.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== Bootstrap theme overrides ===== */
[data-theme="dark"] .table { --bs-table-bg: var(--bg-card); --bs-table-color: var(--text-primary); --bs-table-striped-bg: var(--bg-card-hover); --bs-table-hover-bg: var(--bg-card-hover); }
[data-theme="dark"] .modal-content,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .popover,
[data-theme="dark"] .toast { background: var(--bg-card); color: var(--text-primary); }
[data-theme="dark"] .popover-header { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="dark"] .btn-close { filter: invert(1); }
[data-theme="dark"] .list-group-item { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .bg-light { background: var(--bg-secondary) !important; }
[data-theme="dark"] .bg-white { background: var(--bg-card) !important; }
[data-theme="dark"] .text-dark { color: var(--text-primary !important); }

[data-theme="light"] .bg-dark { background: var(--bg-secondary) !important; }
[data-theme="light"] .text-light { color: var(--text-primary) !important; }
[data-theme="light"] .text-white { color: var(--text-primary) !important; }

[data-theme="dark"] .navbar-nav .nav-link { color: var(--text-secondary); }
[data-theme="dark"] .navbar-nav .nav-link:hover { color: var(--text-primary); }

/* ============================================
   DRIVER CHECK MODAL — Part 20
   ============================================ */

.dc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}
.dc-overlay.dc-visible { display: flex; }

.dc-modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  animation: dcSlideIn 0.25s ease-out;
}
@keyframes dcSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dc-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 1;
}
.dc-close:hover { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.dc-header {
  padding: 1.5rem 1.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}
.dc-header-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.dc-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dc-body { padding: 1.25rem 1.75rem 1.75rem; }

.dc-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.dc-text code {
  background: var(--bg-input);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  color: var(--primary-light);
}

/* Warning / Error / Success banners inside modal */
.dc-warning-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--warning);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.dc-warning-banner i { font-size: 1.2rem; flex-shrink: 0; }
.dc-warning-banner.dc-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

.dc-success-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--success);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.dc-success-banner i { font-size: 1.2rem; flex-shrink: 0; }

/* Chip identification cards */
.dc-chip-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.dc-chip-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}
.dc-chip-card:hover { border-color: var(--border-color-hover); }
.dc-chip-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.dc-chip-icon.dc-silabs {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}
.dc-chip-icon.dc-wch {
  background: rgba(6, 182, 212, 0.15);
  color: var(--secondary);
}
.dc-chip-card strong { font-size: 0.85rem; color: var(--text-primary); }
.dc-chip-card small { color: var(--text-muted); font-size: 0.75rem; }

/* OS badge */
.dc-os-section { margin-bottom: 1.25rem; }
.dc-os-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Steps */
.dc-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.dc-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.dc-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-alpha);
  color: var(--primary-light);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Action buttons */
.dc-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.dc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.dc-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.dc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4); }
.dc-btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.dc-btn-secondary:hover { border-color: var(--border-color-hover); color: var(--text-primary); }
.dc-btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.dc-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}
.dc-btn-ghost:hover { color: var(--text-secondary); }

/* Troubleshooting list */
.dc-troubleshoot {
  margin: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dc-trouble-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.dc-trouble-item i {
  color: var(--primary-light);
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.dc-trouble-item code {
  background: var(--bg-input);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  color: var(--primary-light);
}

/* Soft banner (top of page, non-blocking) */
.dc-soft-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  animation: dcBannerSlide 0.4s ease-out;
}
@keyframes dcBannerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.dc-soft-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}
.dc-soft-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--warning);
  flex-shrink: 0;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.dc-soft-text {
  flex: 1;
  min-width: 0;
}
.dc-soft-text p {
  margin: 0;
  padding: 0;
  line-height: 1.5;
}
.dc-soft-text .dc-soft-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}
.dc-soft-text .dc-soft-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.dc-soft-dismiss {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  padding: 0;
}
.dc-soft-dismiss:hover { background: rgba(239, 68, 68, 0.12); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.dc-soft-bottom {
  display: flex;
  justify-content: flex-end;
}

.dc-soft-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.04));
  border-color: rgba(239, 68, 68, 0.25);
}
.dc-soft-error .dc-soft-icon-wrap,
.dc-icon-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

@media (max-width: 576px) {
  .dc-modal { max-height: 90vh; margin: 0.5rem; }
  .dc-header { padding: 1.25rem 1.25rem 0.75rem; }
  .dc-body { padding: 1rem 1.25rem 1.25rem; }
  .dc-chip-cards { grid-template-columns: 1fr; }
  .dc-actions { flex-direction: column; }
  .dc-btn { justify-content: center; }
  .dc-soft-top { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .dc-soft-icon-wrap { align-self: flex-start; }
  .dc-soft-dismiss { position: absolute; top: 0.75rem; right: 0.75rem; }
  .dc-soft-banner { position: relative; }
  .dc-soft-bottom { justify-content: stretch; }
  .dc-soft-bottom .dc-btn { flex: 1; justify-content: center; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .navbar { left: 0; }
  .main-content { margin-left: 0; }
  .navbar-search { width: 200px; }
  .grid-stats { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .toast-container { right: 0.75rem; left: 0.75rem; }
  .toast { min-width: unset; max-width: unset; }
}

@media (max-width: 576px) {
  .main-content { padding: 1rem; }
  .navbar-search { width: 140px; }
  .navbar-search .kbd { display: none; }
  .card-header { flex-direction: column; gap: 0.5rem; }
}
