/* Rika Device Management — Design Tokens */

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

:root {
  /* Primary */
  --primary-50: #EFF6FF;
  --primary-100: #DBEAFE;
  --primary-200: #BFDBFE;
  --primary-300: #93C5FD;
  --primary-400: #60A5FA;
  --primary-500: #3B82F6;
  --primary-600: #2563EB;
  --primary-700: #1D4ED8;
  --primary-800: #1E40AF;
  --primary-900: #1E3A5F;

  /* Semantic */
  --success: #10B981;
  --success-light: #ECFDF5;
  --success-dark: #065F46;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --warning-dark: #92400E;
  --error: #EF4444;
  --error-light: #FEF2F2;
  --error-dark: #991B1B;
  --info: #6366F1;
  --info-light: #EEF2FF;
  --info-dark: #3730A3;

  /* Neutral */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Sidebar */
  --sidebar-bg: #0F172A;
  --sidebar-hover: #1E293B;
  --sidebar-active: var(--primary-600);
  --sidebar-text: #94A3B8;
  --sidebar-text-hover: #F1F5F9;
  --sidebar-width: 250px;
  --sidebar-collapsed: 64px;

  /* Topbar */
  --topbar-bg: #FFFFFF;
  --topbar-height: 64px;
  --topbar-border: var(--gray-200);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

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

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

  /* Motion */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;

  /* Z-Index */
  --z-sidebar: 30;
  --z-topbar: 20;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-toast: 80;
}

/* ===== GLOBAL RESET ===== */
body {
  font-family: var(--font-sans) !important;
  background-color: var(--gray-50) !important;
  color: var(--gray-700);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== SIDEBAR ===== */
/* Width is controlled by Bootstrap's grid classes (col-md-2 on the sidebar,
   col-md-10 on #main-content) - it must NOT be set here, since a fixed px
   width competes with the grid's percentage width and breaks the row's
   column math, wrapping #main-content onto its own line. */
.sidebar {
  background-color: var(--sidebar-bg) !important;
  min-height: 100vh;
  box-shadow: 1px 0 0 rgba(0,0,0,0.08) !important;
  transition: width var(--duration-normal) ease;
  overflow-y: auto;
  overflow-x: hidden;
}

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

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

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.3);
  border-radius: var(--radius-full);
}

.sidebar .nav-link {
  color: var(--sidebar-text) !important;
  padding: 10px 16px !important;
  border-radius: var(--radius-md) !important;
  margin: 2px 8px !important;
  transition: all var(--duration-fast) ease !important;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.sidebar .nav-link:hover {
  background-color: var(--sidebar-hover) !important;
  color: var(--sidebar-text-hover) !important;
}

.sidebar .nav-link.active {
  background-color: var(--sidebar-active) !important;
  color: #FFFFFF !important;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}

.sidebar .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar .submenu {
  padding-left: 12px !important;
}

.sidebar .submenu .nav-link {
  font-size: 0.8125rem;
  padding: 8px 12px 8px 20px !important;
  color: rgba(148,163,184,0.8) !important;
}

.sidebar .submenu .nav-link:hover {
  color: var(--sidebar-text-hover) !important;
}

.sidebar .submenu .nav-link.active {
  background-color: rgba(37,99,235,0.15) !important;
  color: var(--primary-300) !important;
  box-shadow: none;
}

.sidebar .nav-link:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: -2px;
}

.sidebar .nav-link .bi-chevron-down {
  font-size: 0.7rem;
  transition: transform var(--duration-fast) ease;
  margin-left: auto;
  opacity: 0.6;
}

.sidebar .nav-link.expanded .bi-chevron-down {
  transform: rotate(180deg);
}

/* ===== TOP HEADER ===== */
.top-header {
  background: var(--topbar-bg) !important;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 !important;
  border-bottom: 1px solid var(--topbar-border) !important;
  box-shadow: var(--shadow-xs) !important;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
}

.top-header .container-fluid {
  height: 100%;
  display: flex;
  align-items: center;
}

.top-header .row {
  width: 100%;
  height: 100%;
  align-items: center !important;
}

/* ===== STATS CARDS ===== */
.stats-card {
  background: #FFFFFF !important;
  border-radius: var(--radius-lg) !important;
  padding: 24px !important;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm) !important;
  transition: all var(--duration-fast) ease !important;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gray-100);
}

.stats-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md) !important;
  border-color: var(--gray-200);
}

.stats-card .stats-number {
  font-size: 1.875rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 4px !important;
}

.stats-card .stats-label {
  color: var(--gray-500) !important;
  font-size: 0.8125rem !important;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px !important;
}

.stats-card .stats-detail {
  color: var(--gray-400) !important;
  font-size: 0.8125rem !important;
}

.stats-card .card-icon {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2.5rem;
  opacity: 0.08 !important;
  color: var(--gray-900) !important;
}

.stats-green .stats-number { color: var(--success) !important; }
.stats-blue .stats-number { color: var(--primary-500) !important; }
.stats-orange .stats-number { color: var(--warning-dark) !important; }
.stats-cyan .stats-number { color: var(--info) !important; }
.stats-red .stats-number { color: var(--error) !important; }

/* Card accent border variants */
.stats-card.accent-success { border-left: 4px solid var(--success); }
.stats-card.accent-primary { border-left: 4px solid var(--primary-500); }
.stats-card.accent-warning { border-left: 4px solid var(--warning); }
.stats-card.accent-error { border-left: 4px solid var(--error); }
.stats-card.accent-info { border-left: 4px solid var(--info); }

/* ===== PROGRESS BAR ===== */
.progress {
  height: 6px !important;
  border-radius: var(--radius-full) !important;
  background-color: var(--gray-100) !important;
  margin-top: 12px;
}

.progress-bar {
  border-radius: var(--radius-full) !important;
  transition: width var(--duration-slow) ease;
}

/* ===== CHART CONTAINER ===== */
.chart-container {
  background: #FFFFFF !important;
  border-radius: var(--radius-lg) !important;
  padding: 24px !important;
  box-shadow: var(--shadow-sm) !important;
  margin-bottom: 20px;
  border: 1px solid var(--gray-100);
}

.chart-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--gray-900) !important;
  margin-bottom: 20px !important;
}

/* ===== TABLES ===== */
.table {
  font-size: 0.875rem;
}

.table thead th {
  background-color: var(--gray-50) !important;
  color: var(--gray-600) !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-200) !important;
  padding: 12px 16px !important;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid var(--gray-100) !important;
  color: var(--gray-700);
}

.table tbody tr:hover {
  background-color: var(--gray-50) !important;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-300) !important;
  padding: 6px 12px !important;
  font-size: 0.8125rem;
  transition: border-color var(--duration-fast) ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
  outline: none !important;
}

.dataTables_wrapper .dataTables_length select {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-300) !important;
  /* DataTables' own plain jquery.dataTables.min.css ships ".dataTables_length
     select { padding: 4px }" which is MORE specific than Bootstrap's
     ".form-select-sm" and silently wins, crushing the right-side space the
     chevron icon needs. Restate the correct, asymmetric padding here (this
     selector is more specific than both) instead of leaving it unset. */
  padding: 4px 32px 4px 8px !important;
  font-size: 0.8125rem;
  min-width: 70px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 0.8125rem !important;
  color: var(--gray-600);
}

/* The length label is "Show <select> entries" as one line of inline
   content - in a narrow container the browser wraps it mid-phrase
   (e.g. "Show" / select / "entries" each on their own line). Keep it
   as one flexed unit so it wraps as a whole, not internally. */
.dataTables_wrapper .dataTables_length label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.75rem;
  color: var(--gray-500);
  padding: 8px 0 !important;
}

/* DataTables export buttons — compact inline row */
.dataTables_wrapper .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.dataTables_wrapper .dt-buttons .btn {
  font-size: 0.75rem !important;
  padding: 4px 10px !important;
  border-radius: var(--radius-sm) !important;
  white-space: nowrap;
}

.dataTables_wrapper .dt-buttons .btn i {
  font-size: 0.75rem;
}

/* Pagination — compact pills */
.dataTables_wrapper .dataTables_paginate {
  padding: 8px 0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-md) !important;
  font-size: 0.75rem !important;
  padding: 4px 10px !important;
  min-width: 32px;
  text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary-500) !important;
  color: white !important;
  border: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:focus-visible {
  outline: 2px solid var(--primary-400) !important;
  outline-offset: 2px;
}

/* DataTables top bar layout */
.dataTables_wrapper .row:first-child {
  align-items: center;
}

/* ===== PAGE HEADER — RESPONSIVE ===== */
.d-flex.justify-content-between.align-items-center h2,
.d-flex.justify-content-between h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.d-flex.justify-content-between .btn {
  white-space: nowrap;
  font-size: 0.8125rem;
}

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) ease;
  font-size: 0.875rem;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.3) !important;
}

.btn-primary {
  background-color: var(--primary-500) !important;
  border-color: var(--primary-500) !important;
}

.btn-primary:hover {
  background-color: var(--primary-600) !important;
  border-color: var(--primary-600) !important;
}

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

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

.btn-warning {
  background-color: var(--warning) !important;
  border-color: var(--warning) !important;
  color: var(--warning-dark) !important;
}

.btn-outline-primary {
  border-color: var(--primary-500) !important;
  color: var(--primary-500) !important;
  border-radius: var(--radius-md) !important;
}

.btn-outline-primary:hover {
  background-color: var(--primary-500) !important;
  color: white !important;
}

/* ===== BADGES ===== */
.badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge.bg-success { background-color: var(--success-light) !important; color: var(--success-dark) !important; }
.badge.bg-danger { background-color: var(--error-light) !important; color: var(--error-dark) !important; }
.badge.bg-warning { background-color: var(--warning-light) !important; color: var(--warning-dark) !important; }
.badge.bg-info { background-color: var(--info-light) !important; color: var(--info-dark) !important; }
.badge.bg-primary { background-color: var(--primary-100) !important; color: var(--primary-700) !important; }

/* Solid badge variants */
.badge.badge-solid-success { background-color: var(--success) !important; color: white !important; }
.badge.badge-solid-danger { background-color: var(--error) !important; color: white !important; }

/* ===== STATUS INDICATORS ===== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-right: 6px;
}

.status-dot.online { background-color: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.status-dot.offline { background-color: var(--error); box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }
.status-dot.stale { background-color: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }
.status-dot.pulse { animation: pulse-dot 2s ease-in-out infinite; }

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

.status-online { color: var(--success) !important; }
.status-offline { color: var(--error) !important; }

/* ===== ALERTS ===== */
.alert {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  font-size: 0.875rem;
  padding: 14px 20px !important;
}

.alert-success {
  background-color: var(--success-light) !important;
  color: var(--success-dark) !important;
}

.alert-danger {
  background-color: var(--error-light) !important;
  color: var(--error-dark) !important;
}

.alert-warning {
  background-color: var(--warning-light) !important;
  color: var(--warning-dark) !important;
}

/* ===== FORMS ===== */
.form-control {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-300) !important;
  padding: 8px 12px !important;
  font-size: 0.875rem !important;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.form-control:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
}

.form-select {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-300) !important;
  font-size: 0.875rem !important;
}

.form-select:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

/* ===== CARDS ===== */
.card {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--gray-100) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card-header {
  background-color: var(--gray-50) !important;
  border-bottom: 1px solid var(--gray-200) !important;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 16px 20px !important;
}

.card-body {
  padding: 20px !important;
}

/* ===== MODALS ===== */
.modal-content {
  border-radius: var(--radius-xl) !important;
  border: none !important;
  box-shadow: var(--shadow-xl) !important;
}

.modal-header {
  border-bottom: 1px solid var(--gray-200) !important;
  padding: 20px 24px !important;
}

.modal-title {
  font-weight: 600 !important;
  font-size: 1.125rem !important;
  color: var(--gray-900);
}

.modal-body {
  padding: 24px !important;
}

.modal-footer {
  border-top: 1px solid var(--gray-200) !important;
  padding: 16px 24px !important;
}

/* ===== DROPDOWN ===== */
.dropdown-menu {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 4px !important;
}

.dropdown-item {
  border-radius: var(--radius-md) !important;
  font-size: 0.875rem;
  padding: 8px 12px !important;
  transition: background-color var(--duration-fast) ease;
}

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

/* ===== PROFILE CIRCLE ===== */
.profile-circle {
  width: 40px !important;
  height: 40px !important;
  border-radius: var(--radius-full) !important;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700)) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600 !important;
  font-size: 0.9375rem !important;
  box-shadow: 0 2px 4px rgba(37,99,235,0.3) !important;
  transition: transform var(--duration-fast) ease;
}

.profile-circle:hover {
  transform: scale(1.05);
}

/* ===== NOTIFICATION BELL ===== */
.notification-bell {
  position: relative;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background-color var(--duration-fast) ease;
}

.notification-bell:hover {
  background-color: var(--gray-100);
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 0.8125rem;
  margin-bottom: 16px;
  background: transparent !important;
  padding: 0 !important;
}

.breadcrumb-item a {
  color: var(--primary-500);
  text-decoration: none;
}

.breadcrumb-item.active {
  color: var(--gray-500);
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h5 {
  color: var(--gray-600);
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto 16px;
}

/* ===== DONUT CHART ===== */
.donut-chart-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-labels {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.donut-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.donut-label-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

/* ===== BADGE COUNT (Sidebar) ===== */
.badge-count {
  background-color: var(--error) !important;
  color: white;
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: auto;
  min-width: 20px;
  text-align: center;
}

/* ===== SweetAlert2 Overrides ===== */
.swal2-popup {
  border-radius: var(--radius-xl) !important;
  font-family: var(--font-sans) !important;
}

.swal2-title {
  font-weight: 600 !important;
  color: var(--gray-900) !important;
}

.swal2-confirm {
  border-radius: var(--radius-md) !important;
  font-weight: 500 !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    z-index: var(--z-sidebar);
    transition: left var(--duration-normal) ease;
    height: 100vh;
  }

  .sidebar.show {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal) ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .stats-card {
    padding: 16px !important;
  }

  .stats-card .stats-number {
    font-size: 1.5rem !important;
  }

  .page-title {
    font-size: 1.125rem;
  }

  .chart-container {
    padding: 16px !important;
  }

  /* Page header — stack title and buttons vertically on mobile */
  .d-flex.justify-content-between.align-items-center {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px;
  }

  .d-flex.justify-content-between.align-items-center h2 {
    font-size: 1rem !important;
  }

  .d-flex.justify-content-between.align-items-center .btn,
  .d-flex.justify-content-between .btn {
    font-size: 0.6875rem !important;
    padding: 5px 10px !important;
  }

  /* Multiple top buttons — inline wrap */
  .d-flex.justify-content-between.align-items-center .d-flex,
  .d-flex.justify-content-between.align-items-center .btn-group {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* DataTables export buttons — smaller on mobile */
  .dataTables_wrapper .dt-buttons {
    gap: 3px;
    margin-bottom: 8px;
  }

  .dataTables_wrapper .dt-buttons .btn {
    font-size: 0.6875rem !important;
    padding: 3px 8px !important;
  }

  /* DataTables search and length — full width stacked */
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left !important;
    margin-bottom: 8px;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-top: 4px;
  }

  .dataTables_wrapper .dataTables_length label,
  .dataTables_wrapper .dataTables_filter label {
    font-size: 0.75rem !important;
  }

  /* DataTables pagination — compact on mobile */
  .dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 0.6875rem !important;
    padding: 3px 8px !important;
    min-width: 28px;
  }

  .dataTables_wrapper .dataTables_info {
    font-size: 0.6875rem !important;
  }

  /* Table cells — tighter padding on mobile */
  .table thead th {
    padding: 8px 10px !important;
    font-size: 0.6875rem !important;
  }

  .table tbody td {
    padding: 8px 10px !important;
    font-size: 0.8125rem !important;
  }

  /* Card header and body — compact */
  .card-header {
    padding: 12px 16px !important;
    font-size: 0.875rem !important;
  }

  .card-body {
    padding: 12px !important;
  }

  /* Form controls — smaller on mobile */
  .form-control, .form-select {
    font-size: 0.8125rem !important;
    padding: 6px 10px !important;
  }

  .form-label {
    font-size: 0.75rem !important;
  }

  /* Filter dropdowns row — stacked */
  .filter-row .col-md-3,
  .filter-row .col-md-4 {
    margin-bottom: 8px;
  }

  /* Badge — smaller on mobile */
  .badge {
    font-size: 0.6875rem;
    padding: 3px 8px;
  }

  /* Top header — compact */
  .top-header {
    height: 56px;
  }

  .profile-circle {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.8125rem !important;
  }
}

/* ===== SKIP LINK (Accessibility) ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px 16px;
  background: var(--primary-500);
  color: white;
  z-index: 100;
  border-radius: 0 0 var(--radius-md) 0;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top var(--duration-fast) ease;
}

.skip-link:focus {
  top: 0;
  color: white;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
