/* ==========================================================================
   SMT INVENTORY - ENTERPRISE LOOM MANUFACTURING ADMIN THEME
   Aesthetic: Industrial Precision, Deep Navy & Titanium Slate, Electric Sapphire
   ========================================================================== */

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

:root {
  /* Brand Core Colors */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.25);

  --secondary: #0ea5e9;
  --secondary-hover: #0284c7;
  --secondary-light: #f0f9ff;

  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-violet: #8b5cf6;

  /* Neutrals & Surfaces */
  --bg-app: #f8fafc;
  --surface-card: #ffffff;
  --surface-muted: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Typography */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  /* Sidebar (Dark Titanium Theme) */
  --sidebar-bg: #090e17;
  --sidebar-surface: #111827;
  --sidebar-border: #1f2937;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f8fafc;
  --sidebar-active-bg: rgba(79, 70, 229, 0.15);
  --sidebar-active-border: #4f46e5;

  /* Layout Constants */
  --sidebar-width: 270px;
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

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

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

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

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}

.sidebar-brand img {
  height: 38px;
  width: auto;
}

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

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-hover);
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--sidebar-active-border);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link.active svg {
  color: var(--secondary);
  opacity: 1;
}

.sidebar-badge {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 9999px;
  background: rgba(79, 70, 229, 0.25);
  color: #a5b4fc;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(0, 0, 0, 0.2);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

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

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

.user-role {
  font-size: 0.725rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.role-pill-admin {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

.role-pill-subadmin {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

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

/* Top Navigation Bar */
.app-topbar {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  max-width: 100%;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.page-title-group {
  min-width: 0;
}

.page-title-group h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Content Body */
.app-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}

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

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
  --bs-btn-color: var(--text-main, #0f172a);
  --bs-btn-bg: #ffffff;
  --bs-btn-border-color: var(--border-subtle, #e2e8f0);
  --bs-btn-hover-color: var(--text-main, #0f172a);
  --bs-btn-hover-bg: var(--surface-muted, #f1f5f9);
  --bs-btn-hover-border-color: var(--border-strong, #cbd5e1);
  --bs-btn-focus-shadow-rgb: 203, 213, 225;
  --bs-btn-active-color: var(--text-main, #0f172a);
  --bs-btn-active-bg: #e2e8f0;
  --bs-btn-active-border-color: #94a3b8;
  background-color: #ffffff !important;
  color: var(--text-main, #0f172a) !important;
  border-color: var(--border-subtle, #e2e8f0) !important;
  font-weight: 500;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary.active,
.btn-secondary:first-child:active,
:not(.btn-check)+.btn-secondary:active,
.btn-secondary.show {
  background-color: var(--surface-muted, #f1f5f9) !important;
  color: var(--text-main, #0f172a) !important;
  border-color: var(--border-strong, #cbd5e1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.btn-secondary svg,
.btn-secondary i,
.btn-secondary span {
  color: inherit !important;
}

.btn-success {
  background: var(--accent-emerald);
  color: #ffffff;
  border-color: var(--accent-emerald);
}

.btn-success:hover {
  background: #059669;
}

.btn-warning {
  background: var(--accent-amber);
  color: #ffffff;
}

.btn-danger {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Cards & Surfaces */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  min-width: 0;
  max-width: 100%;
}

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

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* KPI Stat Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* Dashboard 3 Cards In A Row */
.dashboard-kpi-grid,
.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 1024px) {
  .dashboard-kpi-grid,
  .kpi-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .dashboard-kpi-grid,
  .kpi-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  margin-left: auto;
}

.kpi-icon-wrap svg {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex-shrink: 0;
  display: block;
}

.kpi-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.kpi-label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: clamp(1.2rem, 1.8vw, 1.65rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 0.775rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colors for KPI cards */
.kpi-indigo .kpi-icon-wrap { background: #e0e7ff; color: #4338ca; }
.kpi-cyan .kpi-icon-wrap { background: #e0f2fe; color: #0284c7; }
.kpi-emerald .kpi-icon-wrap { background: #d1fae5; color: #059669; }
.kpi-amber .kpi-icon-wrap { background: #fef3c7; color: #d97706; }
.kpi-rose .kpi-icon-wrap { background: #ffe4e6; color: #e11d48; }

/* Data Tables */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.table-custom th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table-custom td {
  padding: 0.85rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.table-custom tbody tr {
  transition: background-color 0.15s ease;
}

.table-custom tbody tr:hover {
  background-color: #f8fafc;
}

/* Badges & Tags - High Contrast & Crystal Clear Visibility */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  border-radius: 9999px;
  white-space: nowrap;
  letter-spacing: 0.015em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Soft Badges - Crisp, highly visible text with matching subtle backgrounds */
.badge-primary, .badge.badge-primary {
  background-color: #eef2ff !important;
  color: #3730a3 !important;
  border: 1px solid #c7d2fe !important;
}

.badge-success, .badge.badge-success {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #a7f3d0 !important;
}

.badge-warning, .badge.badge-warning {
  background-color: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
}

.badge-danger, .badge.badge-danger {
  background-color: #fff1f2 !important;
  color: #9f1239 !important;
  border: 1px solid #fecdd3 !important;
}

.badge-info, .badge.badge-info {
  background-color: #f0f9ff !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
}

.badge-neutral, .badge.badge-neutral, .badge-secondary, .badge.badge-secondary {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

/* Solid Badges with Crisp High-Contrast White Text */
.badge.bg-primary, .badge-solid-primary {
  background-color: var(--bs-primary) !important;
  color: #ffffff !important;
  border: 1px solid var(--bs-primary) !important;
}

.badge.bg-success, .badge-solid-success {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #10b981 !important;
}

.badge.bg-danger, .badge-solid-danger {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border: 1px solid #ef4444 !important;
}

.badge.bg-warning, .badge-solid-warning {
  background-color: #f59e0b !important;
  color: #1e293b !important;
  border: 1px solid #f59e0b !important;
}

.badge.bg-info, .badge-solid-info {
  background-color: #0ea5e9 !important;
  color: #ffffff !important;
  border: 1px solid #0ea5e9 !important;
}

.badge.bg-secondary, .badge.bg-dark, .badge-solid-dark {
  background-color: #1e293b !important;
  color: #ffffff !important;
  border: 1px solid #1e293b !important;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-label span.req {
  color: var(--accent-rose);
}

.form-control, .form-select, textarea.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Filter Toolbar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-input-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  width: 18px;
  height: 18px;
}

.search-input-wrap input {
  padding-left: 2.5rem;
}

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

.tab-btn {
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

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

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Invoice Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  .app-sidebar, .app-topbar, .no-print, .btn, .sidebar-brand {
    display: none !important;
  }
  .app-main {
    margin-left: 0 !important;
  }
  .app-content {
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
  .printable-invoice {
    padding: 20px;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   Pagination Styling & SVG Icon Sizing
   Fixes oversized Tailwind SVG chevrons (< and >) in Laravel pagination links
   ========================================================================== */

/* Full-width container inside card-footer */
.card-footer > nav,
.card-footer > nav[role="navigation"] {
  width: 100%;
}

nav[role="navigation"] {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Constrain all SVG icons inside pagination to 16px */
nav[role="navigation"] svg,
nav[role="navigation"] svg.w-5,
nav[role="navigation"] svg.h-5,
.card-footer svg,
svg.w-5,
svg.h-5,
.w-5,
.h-5 {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  display: inline-block !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
}

/* Desktop layout (>= 640px) */
@media (min-width: 640px) {
  /* Hide the duplicate simple mobile block (Previous / Next text buttons) */
  nav[role="navigation"] > div:first-child:not(:last-child) {
    display: none !important;
  }

  /* Show the full desktop pagination bar with counter and page pills */
  nav[role="navigation"] > div:last-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
  }
}

/* Mobile layout (< 640px) */
@media (max-width: 639px) {
  nav[role="navigation"] > div:first-child:not(:last-child) {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  nav[role="navigation"] > div:last-child {
    display: none !important;
  }
}

/* Mobile Previous / Next buttons */
nav[role="navigation"] > div:first-child:not(:last-child) a,
nav[role="navigation"] > div:first-child:not(:last-child) span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.45rem 0.9rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  background: #ffffff !important;
  color: var(--text-main) !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

nav[role="navigation"] > div:first-child:not(:last-child) a:hover {
  background: var(--surface-muted) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

nav[role="navigation"] > div:first-child:not(:last-child) span.cursor-not-allowed,
nav[role="navigation"] > div:first-child:not(:last-child) span[aria-disabled="true"] {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
}

/* Results text (Showing X to Y of Z results) */
nav[role="navigation"] p {
  margin: 0 !important;
  font-size: 0.875rem !important;
  color: var(--text-muted) !important;
  line-height: 1.5 !important;
}

nav[role="navigation"] p .font-medium,
nav[role="navigation"] p strong {
  font-weight: 600 !important;
  color: var(--text-main) !important;
}

/* Pagination Pills Container */
nav[role="navigation"] span.rounded-md {
  display: inline-flex !important;
  align-items: center !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-xs) !important;
  border: 1px solid var(--border-subtle) !important;
  background: #ffffff !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Direct children of the pagination pill strip */
nav[role="navigation"] span.rounded-md > * {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-right: 1px solid var(--border-subtle) !important;
  background: transparent !important;
  text-decoration: none !important;
}

nav[role="navigation"] span.rounded-md > *:last-child {
  border-right: none !important;
}

/* Page items (links and spans) */
nav[role="navigation"] span.rounded-md a,
nav[role="navigation"] span.rounded-md span > span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 36px !important;
  height: 36px !important;
  padding: 0 0.75rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--text-main) !important;
  background: #ffffff !important;
  text-decoration: none !important;
  border: none !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
  line-height: 1 !important;
}

/* Arrow buttons (Prev / Next) */
nav[role="navigation"] span.rounded-md a[rel="prev"],
nav[role="navigation"] span.rounded-md a[rel="next"],
nav[role="navigation"] span.rounded-md a:has(svg),
nav[role="navigation"] span.rounded-md span > span:has(svg) {
  padding: 0 0.65rem !important;
}

/* Hover state on clickable page links */
nav[role="navigation"] span.rounded-md a:hover {
  background: var(--surface-muted) !important;
  color: var(--primary) !important;
}

/* Active / Current page pill */
nav[role="navigation"] span.rounded-md [aria-current="page"],
nav[role="navigation"] span.rounded-md span[aria-current="page"] > span {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  cursor: default !important;
}

/* Disabled pills (e.g. disabled Prev / Next) */
nav[role="navigation"] span.rounded-md [aria-disabled="true"],
nav[role="navigation"] span.rounded-md span[aria-disabled="true"] > span {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
}

nav[role="navigation"] span.rounded-md [aria-disabled="true"] svg {
  color: #cbd5e1 !important;
}

/* ==========================================================================
   Bootstrap 5 Theme Integration & Overrides
   ========================================================================== */
:root {
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-primary-hover: #4338ca;
  --bs-link-color: #4f46e5;
  --bs-link-hover-color: #3730a3;
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: #f8fafc;
  --bs-body-color: #0f172a;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
}

.btn-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 1px 2px 0 rgba(79, 70, 229, 0.2);
  transition: all 0.15s ease-in-out;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: #4338ca !important;
  border-color: #4338ca !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

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

.btn-outline-primary:hover {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #ffffff !important;
}

.btn-outline-secondary {
  color: var(--text-main, #0f172a) !important;
  border-color: var(--border-subtle, #e2e8f0) !important;
  background-color: transparent !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  background-color: var(--surface-muted, #f1f5f9) !important;
  border-color: var(--border-strong, #cbd5e1) !important;
  color: var(--text-main, #0f172a) !important;
}

.bg-primary {
  background-color: var(--bs-primary) !important;
  color: #ffffff !important;
}

.text-primary {
  color: var(--bs-primary) !important;
}

/* ==========================================================================
   Responsive Mobile Navigation & Sidebar Drawer
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    z-index: 1045 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .app-topbar {
    padding: 0.75rem 1rem !important;
  }

  .app-content {
    padding: 1rem !important;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch !important;
  }

  .search-input-wrap {
    max-width: 100% !important;
  }
}

/* ==========================================================================
   jQuery DataTables Bootstrap 5 Integration
   ========================================================================== */
.dataTables_wrapper {
  padding: 1.25rem 1.5rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.dataTables_wrapper .dataTables_length select {
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-main);
  outline: none;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-main);
  min-width: 220px;
  outline: none;
  transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 0.5rem;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  margin: 0;
  gap: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link {
  border-radius: var(--radius-md) !important;
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link:hover {
  background: var(--surface-muted);
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #ffffff !important;
  font-weight: 700;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
  color: #94a3b8;
  background-color: #f8fafc;
  border-color: var(--border-subtle);
  cursor: not-allowed;
}

/* DataTables Table Elements */
table.dataTable {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

table.dataTable thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

table.dataTable tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

table.dataTable tbody tr:hover td {
  background-color: rgba(79, 70, 229, 0.03) !important;
}
