/* ============================================
   Monita - Modern UI Stylesheet
   Compatible with Bootstrap 4.6.x
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --primary: #c41230;
  --primary-dark: #9e0e27;
  --primary-light: #e8405a;
  --secondary: #1a3c6e;
  --secondary-dark: #122a4e;
  --secondary-light: #2a5ca0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --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;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 0.375rem;
  --radius-lg: 0.5rem;
  --transition: all 0.2s ease;
  --topbar-height: 62px;
  --navbar-height: 46px;
}

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

body {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  overflow-x: hidden;
}

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

/* --- Container --- */
.container-fluid { max-width: 95%; }

/* --- Topbar / Header --- */
#topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  background: #fff;
  box-shadow: var(--shadow-md);
  border: 0;
  min-height: var(--topbar-height);
  transition: var(--transition);
}
#topnav .has-submenu.active > a { color: #ffffff; }
#topnav .has-submenu.active .submenu li > a { color: var(--gray-700); }
#topnav .has-submenu.active .submenu li > a:hover { color: var(--primary); }
#topnav .has-submenu.active .submenu li.active > a { color: var(--primary); font-weight: 600; }

.topbar-main {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
}
.topbar-main .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Menu extras / profile area - must be pushed to right */
.menu-extras.topbar-custom {
  margin-left: auto;
}
.topbar-custom .nav-link { padding: 0; }
.topbar-custom .dropdown-toggle::after { display: none; }
#topnav .topbar-main .logo {
  color: var(--secondary) !important;
  line-height: var(--topbar-height);
  font-size: 1.125rem;
  font-weight: 700;
}
.logo a.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--secondary) !important;
  text-decoration: none !important;
}
.logo a.logo:hover { color: var(--primary) !important; }
.logo .logo-small { display: none; }
.logo .logo-large i { color: var(--primary); font-size: 1.4rem; }

/* User Menu */
.topbar-right-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-user {
  display: inline-flex !important;
  align-items: center;
  padding: 0.375rem 0.75rem !important;
  border-radius: var(--radius);
  color: var(--gray-700) !important;
  font-weight: 500;
  transition: var(--transition);
}
.nav-user:hover { background: var(--gray-100); color: var(--gray-900) !important; }
.nav-user .user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  margin-right: 0.375rem;
}
.pro-user-name { font-size: 0.8125rem; color: var(--gray-700); }
.pro-user-name i { font-size: 1rem; vertical-align: middle; }

.profile-dropdown {
  border: none !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0.5rem 0 !important;
  min-width: 180px;
  margin-top: 0;
}
.notification-list { position: relative; }
.notification-list .dropdown-menu-right {
  right: 0; left: auto;
}
.profile-dropdown .dropdown-item {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--gray-700);
  transition: var(--transition);
}
.profile-dropdown .dropdown-item:hover { background: var(--gray-50); color: var(--primary); }
.profile-dropdown .dropdown-item i { font-size: 1rem; width: 1.25rem; display: inline-block; }

/* Mobile Toggle */
.navbar-toggle { cursor: pointer; padding: 0.5rem; display: flex; align-items: center; }
.navbar-toggle .lines { display: flex; flex-direction: column; gap: 4px; }
.navbar-toggle .lines span {
  display: block; width: 22px; height: 2px;
  background: var(--gray-700); border-radius: 2px; transition: var(--transition);
}

/* --- Navigation Bar --- */
.navbar-custom {
  background: var(--secondary);
  min-height: var(--navbar-height);
  display: flex;
  align-items: center;
}
.navbar-custom .container-fluid { display: flex; align-items: center; }
#navigation { width: 100%; }
.navigation-menu {
  display: flex; align-items: center; list-style: none; margin: 0; padding: 0;
}
.navigation-menu > li > a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.6rem 0.9rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.8125rem; font-weight: 500;
  border-radius: var(--radius);
  transition: var(--transition);
  white-space: nowrap;
}
.navigation-menu > li > a:hover,
.navigation-menu > li.active > a { color: #fff; background: rgba(255,255,255,0.15); }
.navigation-menu > li > a i { font-size: 1rem; opacity: 0.85; }

/* Submenu */
.has-submenu { position: relative; }
.submenu {
  position: absolute; top: 100%; left: 0;
  min-width: 220px; background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0; list-style: none;
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: var(--transition);
  z-index: 1050;
}
.has-submenu:hover .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu li a {
  display: block; padding: 0.5rem 1rem;
  color: var(--gray-700); font-size: 0.8125rem;
  transition: var(--transition);
}
.submenu li a:hover { background: var(--gray-50); color: var(--primary); padding-left: 1.25rem; }

/* --- Wrapper --- */
.wrapper {
  padding-top: calc(var(--topbar-height) + var(--navbar-height) + 1.5rem);
  padding-bottom: 4rem;
  min-height: calc(100vh - 60px);
}

/* --- Page Title --- */
.page-title-box { padding: 0.5rem 0 1rem; }
.page-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin: 0; }

/* --- Cards --- */
.card-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-200);
  transition: box-shadow 0.2s ease;
}
.card-box:hover { box-shadow: var(--shadow-md); }
.header-title { font-size: 1rem; font-weight: 600; color: var(--gray-800); margin-bottom: 0.75rem; }

/* --- Widget Cards --- */
.widget-flat {
  border-radius: var(--radius-lg) !important;
  padding: 1.25rem !important;
  border: none !important;
  position: relative; overflow: hidden;
}
.widget-flat::after {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.widget-flat i { font-size: 1.75rem; opacity: 0.8; margin-bottom: 0.5rem; display: block; }
.widget-flat h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.widget-flat p { font-size: 0.75rem; letter-spacing: 0.05em; margin: 0; opacity: 0.9; }

/* --- Tables --- */
.table { font-size: 0.75rem; }
.table thead th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-600);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
}
.table tbody td { padding: 0.5rem; vertical-align: middle; border-color: var(--gray-100); }
.table-hover tbody tr:hover { background: var(--gray-50); }
.table .w-index { width: 50px; }

/* Bootstrap Table horizontal scroll fix */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fixed-table-container { border: none !important; }
.fixed-table-body { overflow-x: auto; overflow-y: auto; }
.bootstrap-table .fixed-table-container .table { table-layout: auto !important; }

.fixed-table-toolbar .search input {
  border: 1px solid var(--gray-300) !important;
  border-radius: var(--radius) !important;
  padding: 0.375rem 0.75rem; font-size: 0.8125rem;
}
.fixed-table-pagination .pagination .page-link {
  border-radius: var(--radius); margin: 0 2px;
  font-size: 0.8125rem; color: var(--gray-700);
}
.fixed-table-pagination .pagination .active .page-link {
  background: var(--primary); border-color: var(--primary);
}

/* --- Forms --- */
.form-control {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--gray-800);
  transition: var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1);
}
.form-control-lg { padding: 0.4rem 0.75rem; font-size: 0.8125rem; height: auto; }
label, .form-label { font-weight: 500; font-size: 0.8125rem; color: var(--gray-700); margin-bottom: 0.375rem; }
.form-group { margin-bottom: 1rem; }

/* Input Group (BS4) */
.input-group-text {
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  line-height: 1.5;
  height: auto;
}
.input-group-append .input-group-text { border-left: 0; }
.input-group .form-control {
  height: auto;
}

/* --- Buttons --- */
.btn {
  font-weight: 500; font-size: 0.75rem;
  border-radius: var(--radius);
  padding: 0.35rem 0.85rem;
  transition: var(--transition);
}
.btn i { margin-right: 0.25rem; }
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.btn-primary { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; box-shadow: 0 4px 12px rgba(196,18,48,0.3); }
.btn-secondary { background: var(--gray-200) !important; border-color: var(--gray-200) !important; color: var(--gray-700) !important; }
.btn-secondary:hover { background: var(--gray-300) !important; border-color: var(--gray-300) !important; }
.btn-success { background: var(--success) !important; border-color: var(--success) !important; color: #fff !important; }
.btn-success:hover { filter: brightness(0.9); }
.btn-danger { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; }
.btn-danger:hover { filter: brightness(0.9); }
.btn-warning { background: var(--warning) !important; border-color: var(--warning) !important; color: #fff !important; }
.btn-warning:hover { filter: brightness(0.9); }
.btn-info { background: var(--info) !important; border-color: var(--info) !important; color: #fff !important; }
.btn-info:hover { filter: brightness(0.9); }
.btn-dark { background: var(--gray-700) !important; border-color: var(--gray-700) !important; color: #fff !important; }
.btn-custom { background: var(--primary); border-color: var(--primary); color: #fff; width: 100%; padding: 0.625rem; font-size: 0.9375rem; font-weight: 600; }
.btn-custom:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* Button group gap (BS4 compat) */
.d-flex.gap-1 > * { margin-right: 0.25rem; margin-bottom: 0.25rem; }
.d-flex.gap-1 > *:last-child { margin-right: 0; }
.d-flex.gap-2 > * { margin-right: 0.5rem; }
.d-flex.gap-2 > *:last-child { margin-right: 0; }
.d-flex.gap-3 > * { margin-right: 0.75rem; }
.d-flex.gap-3 > *:last-child { margin-right: 0; }
.d-flex.flex-wrap.gap-2 > * { margin-right: 0.5rem; margin-bottom: 0.5rem; }
.d-flex.flex-wrap.gap-2 > *:last-child { margin-right: 0; }
/* d-grid helper for BS4 (login buttons) */
.d-grid { display: flex; flex-direction: column; }
.d-grid.gap-2 > * { margin-bottom: 0.5rem; }
.d-grid.gap-2 > *:last-child { margin-bottom: 0; }

/* --- Badges --- */
.badge { font-weight: 500; font-size: 0.7rem; padding: 0.35em 0.65em; border-radius: 9999px; letter-spacing: 0.03em; }
.badge-danger { background: #fef2f2 !important; color: #dc2626 !important; }
.badge-success { background: #f0fdf4 !important; color: #16a34a !important; }
.badge-info { background: #eff6ff !important; color: #2563eb !important; }
.badge-primary { background: #f0f4ff !important; color: #4f46e5 !important; }
.badge-secondary { background: var(--gray-100) !important; color: var(--gray-600) !important; }
.badge-warning { background: #fffbeb !important; color: #d97706 !important; }

/* --- Modals --- */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--gray-200); padding: 1rem 1.25rem; }
.modal-title { font-weight: 600; color: var(--gray-800); }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--gray-200); padding: 0.75rem 1.25rem; }
.close { text-shadow: none; opacity: 0.5; }
.close:hover { opacity: 1; }

/* --- Spinner --- */
.spinner-border { width: 1.5rem; height: 1.5rem; border-width: 2px; }
.spinner-border-sm { width: 1rem; height: 1rem; }

/* --- Progress --- */
.progress { height: 6px; border-radius: 9999px; background: var(--gray-200); }
.progress-bar { background: var(--primary); border-radius: 9999px; }

/* --- Footer --- */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--gray-200);
  padding: 0 1.5rem; height: 48px;
  display: flex; align-items: center;
  z-index: 1000; font-size: 0.75rem; color: var(--gray-500);
  white-space: nowrap; line-height: 48px;
}
.footer .row { width: 100%; align-items: center; }

/* --- Login / Auth Pages --- */
.accountbg {
  position: fixed; top: 0; left: 0;
  width: calc(100% - 500px); height: 100vh;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.accountbg::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1d5db' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.accountbg img { max-width: 60%; position: relative; z-index: 1; }
.wrapper-page.account-page-full {
  position: fixed; right: 0; top: 0;
  width: 500px; height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #fff; padding: 2rem;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}
.account-box .card-box { box-shadow: none; border: none; padding: 2rem; }
.account-box h2 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.account-copyright { font-size: 0.75rem; color: var(--gray-400); }

/* --- Alerts --- */
.alert { border-radius: var(--radius); border: none; font-size: 0.8125rem; }
.alert-info { background: #eff6ff; color: #1e40af; }

/* --- Datepicker overrides --- */
.datepicker { font-family: var(--font-sans); }
.datepicker-dropdown {
  z-index: 1070 !important;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200); padding: 6px;
}
.datepicker table tr td,
.datepicker table tr th { border-radius: var(--radius); font-size: 0.8125rem; }
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.highlighted { background: var(--primary) !important; color: #fff !important; }
.datepicker table tr td.today { background: #fff3cd !important; color: #856404 !important; }

/* --- Select2 overrides (BS4 theme) --- */
.select2-container--bootstrap4 .select2-selection {
  border: 1px solid var(--gray-300) !important;
  border-radius: var(--radius) !important;
  min-height: calc(1.5em + 0.75rem + 2px);
  font-size: 0.875rem;
}
.select2-container--bootstrap4 .select2-selection--single {
  padding: 0.375rem 0.75rem;
  height: auto;
}
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  padding: 0;
  line-height: 1.5;
  color: var(--gray-800);
}
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: 100%;
}
/* Fix Select2 when applied on form-control-lg elements */
.form-control-lg + .select2-container--bootstrap4 .select2-selection,
.form-control-lg.select2-hidden-accessible + .select2-container--bootstrap4 .select2-selection {
  min-height: calc(1.5em + 1rem + 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
}
.select2-container--bootstrap4.select2-container--focus .select2-selection {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1) !important;
}
.select2-container--bootstrap4 .select2-results__option--highlighted {
  background: var(--primary) !important;
}
.select2-container--bootstrap4 .select2-results__option {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}
.select2-dropdown {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  z-index: 1060;
}
/* Ensure Select2 takes full width in flex/row contexts */
.select2-container--bootstrap4 {
  width: 100% !important;
}
/* Fix Select2 inside d-flex rows (Ship form TBBM list) */
.d-flex .select2-container--bootstrap4 {
  flex: 1;
}
/* Fix native select with form-control and form-control-lg */
select.form-control,
select.form-control-lg {
  height: calc(1.5em + 1rem + 2px) !important;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.9375rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%236b7280' d='M1.5 4L6 8.5 10.5 4'/%3e%3c/svg%3e") no-repeat right 0.75rem center;
  background-size: 12px 12px;
  cursor: pointer;
}
select.form-control {
  height: calc(1.5em + 0.75rem + 2px) !important;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* --- Utility helpers --- */
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-nowrap { white-space: nowrap !important; }
.font-weight-medium { font-weight: 500 !important; }
.font-weight-bold { font-weight: 600 !important; }
.font-600 { font-weight: 600; }
.font-13 { font-size: 0.8125rem; }
.m-b-5 { margin-bottom: 0.3125rem; }
.m-b-10 { margin-bottom: 0.625rem; }
.m-t-40 { margin-top: 2.5rem; }
.w-100 { width: 100% !important; }

/* --- Responsive --- */

/* Tablet & below */
@media (max-width: 992px) {
  /* === Navigation === */
  #topnav { overflow: visible; }
  .navbar-custom { min-height: 0; padding: 0; position: static; }
  .navbar-custom .container-fluid { padding: 0; display: block; }
  #navigation { position: static; }

  .navigation-menu {
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: var(--topbar-height);
    left: 0; right: 0;
    background: var(--secondary);
    padding: 0.5rem 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 1050;
    max-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
  }
  .navigation-menu.show { display: flex !important; }
  .navigation-menu > li { border-bottom: 1px solid rgba(255,255,255,0.08); }
  .navigation-menu > li:last-child { border-bottom: none; }
  .navigation-menu > li > a {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
  }
  .navigation-menu > li > a:hover,
  .navigation-menu > li.active > a { background: rgba(255,255,255,0.1); color: #fff; }

  .has-submenu .submenu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; background: rgba(0,0,0,0.15);
    border-radius: 0; margin: 0; padding: 0;
  }
  .submenu li a {
    color: rgba(255,255,255,0.7);
    padding: 0.7rem 1.25rem 0.7rem 2.5rem;
    font-size: 0.8125rem;
    display: block;
  }
  .submenu li a:hover { color: #fff; background: rgba(255,255,255,0.08); padding-left: 2.5rem; }

  /* === Topbar === */
  .logo .logo-large { display: none !important; }
  .logo .logo-small { display: inline-block !important; font-size: 1.5rem; color: var(--primary); }
  .pro-user-name { display: none !important; }
  .nav-user .user-avatar { margin-right: 0; }

  /* Hamburger button visibility */
  .menu-item.d-lg-none { display: list-item !important; }
  .navbar-toggle { padding: 0.5rem; }
  .navbar-toggle .lines span { background: var(--gray-700); }

  /* === Content Layout === */
  .container-fluid { max-width: 100%; }
  .wrapper {
    padding-top: calc(var(--topbar-height) + 1rem);
  }

  /* Filter rows - stack */
  .d-flex.flex-wrap.align-items-center.gap-2 {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .d-flex.flex-wrap.align-items-center.gap-2 > * {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 0.5rem;
  }
  .d-flex.flex-wrap.align-items-center.gap-2 .input-group {
    width: 100% !important;
  }

  /* Widget cards */
  .widget-flat h3 { font-size: 1.25rem; }

  /* Modal */
  .modal-lg { max-width: 95%; }

  /* Login */
  .accountbg { display: none; }
  .wrapper-page.account-page-full { position: relative; width: 100%; height: auto; min-height: 100vh; }
}

/* Mobile */
@media (max-width: 768px) {
  .container-fluid { padding: 0 0.75rem; max-width: 100%; }
  .card-box { padding: 0.75rem; margin-bottom: 1rem; }
  .page-title { font-size: 1rem; }
  .page-title-box { padding: 0.25rem 0 0.75rem; }

  /* Topbar compact */
  .topbar-main { height: 52px; }
  .navbar-custom { min-height: 0; }
  #topnav .topbar-main .logo { font-size: 1rem; line-height: 52px; }

  /* Wrapper */
  .wrapper {
    padding-top: calc(52px + 0.75rem);
    padding-bottom: 3.5rem;
  }

  /* Tables - horizontal scroll */
  .table { font-size: 0.75rem; }
  .table thead th { font-size: 0.65rem; padding: 0.5rem 0.375rem; white-space: nowrap; }
  .table tbody td { padding: 0.375rem; font-size: 0.75rem; }
  .table-responsive { margin: 0 -0.75rem; padding: 0 0.75rem; }
  .fixed-table-body { overflow-x: auto !important; }

  /* Cards row */
  .row.mb-4 .col-sm-6,
  .row.mb-4 .col-xl-3 { margin-bottom: 0.5rem; }
  .widget-flat { padding: 1rem !important; }
  .widget-flat i { font-size: 1.25rem; margin-bottom: 0.25rem; }
  .widget-flat h3 { font-size: 1.125rem; }
  .widget-flat p { font-size: 0.7rem; }

  /* Tabs */
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-tabs .nav-link { font-size: 0.75rem; padding: 0.5rem 0.75rem; white-space: nowrap; }

  /* Filter rows from .row.mb-3 */
  .row.mb-3 [class*="col-md-"] { margin-bottom: 0.5rem; }

  /* Footer compact */
  .footer { padding: 0 0.75rem; height: 40px; line-height: 40px; font-size: 0.7rem; }

  /* Buttons in table */
  .btn-sm { padding: 0.2rem 0.4rem; font-size: 0.7rem; }

  /* Badges */
  .badge { font-size: 0.65rem; padding: 0.25em 0.5em; }

  /* Modal full width */
  .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
  .modal-lg { max-width: calc(100% - 1rem); }
  .modal-body { padding: 1rem; }
  .modal-header { padding: 0.75rem 1rem; }
  .modal-footer { padding: 0.5rem 1rem; }

  /* Page title flex wrap */
  .page-title-box .d-flex { flex-wrap: wrap; gap: 0.5rem; }
  .page-title-box .d-flex .btn { font-size: 0.75rem; padding: 0.375rem 0.75rem; }

  /* Form controls smaller */
  .form-control { font-size: 0.8125rem; padding: 0.4rem 0.625rem; }
  select.form-control { font-size: 0.8125rem; }
  label, .form-label { font-size: 0.75rem; }
}

/* Small mobile */
@media (max-width: 480px) {
  .container-fluid { padding: 0 0.5rem; }
  .card-box { padding: 0.5rem; border-radius: var(--radius); }
  .topbar-main { height: 48px; }
  #topnav .topbar-main .logo { line-height: 48px; }
  .wrapper { padding-top: calc(48px + 0.5rem); }

  /* Filter labels */
  .d-flex.flex-wrap .form-label.text-nowrap { font-size: 0.7rem; }

  /* Action buttons stack */
  .d-flex.flex-wrap.gap-1 { flex-direction: column; align-items: stretch; }
  .d-flex.flex-wrap.gap-1 .btn { width: 100%; margin-bottom: 0.25rem; margin-right: 0 !important; }

  /* User menu */
  .nav-user { padding: 0.25rem 0.5rem !important; }
  .nav-user .user-avatar { width: 28px; height: 28px; font-size: 0.7rem; }

  /* Datepicker */
  .datepicker-dropdown { width: 280px !important; left: 50% !important; transform: translateX(-50%); }

  /* Page title */
  .page-title { font-size: 0.9rem; }

  /* Table action buttons wrap */
  td .btn { margin-bottom: 0.2rem; display: inline-block; }

  /* Modal */
  .modal-title { font-size: 0.9rem; }
  .modal-body { padding: 0.75rem; }
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-box { animation: fadeIn 0.3s ease; }


/* --- Print --- */
@media print {
  #topnav, .navbar-custom, .footer, .no-print { display: none !important; }
  .wrapper { padding-top: 0 !important; }
  .card-box { box-shadow: none; border: none; }
}

/* Bootstrap Table Loading Text */
.bootstrap-table .fixed-table-body .fixed-table-loading .loading-wrap .loading-text {
  font-size: 0.75rem !important;
}
