:root {
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --primary-light: #eef2ff;
  --primary-glow: rgba(67, 56, 202, 0.15);
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --info: #0284c7;
  --info-light: #e0f2fe;
  --font-sans: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --sidebar-width: 270px;
  --header-height: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

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

html {
  font-family: var(--font-sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* Direction & Text Alignment */
html[dir="rtl"],
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html[dir="ltr"],
html[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

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

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 85;
  transition: opacity 0.25s ease;
}
body.sidebar-mobile-open .mobile-overlay {
  display: block;
}

.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
}

html[dir="rtl"] .sidebar,
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
  left: auto;
  right: 0;
  box-shadow: -1px 0 3px rgba(0, 0, 0, 0.02);
}

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

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  list-style: none;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  margin-bottom: 0.25rem;
}

.menu-item a:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.menu-item.active a {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px var(--primary-glow);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  transition: margin 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html[dir="rtl"] .main-content,
[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

/* Sidebar Collapsed State (Desktop Mini Mode) */
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    width: 70px !important;
    overflow: hidden;
  }
  body.sidebar-collapsed .sidebar-header {
    padding: 0 0.5rem;
    justify-content: center;
  }
  body.sidebar-collapsed .sidebar-logo span:nth-child(2),
  body.sidebar-collapsed .sidebar-title-text {
    display: none !important;
  }
  body.sidebar-collapsed .menu-item a {
    justify-content: center !important;
    padding: 0.75rem 0.25rem !important;
    font-size: 1.25rem !important;
  }
  body.sidebar-collapsed .menu-item a span:nth-child(2) {
    display: none !important;
  }
  body.sidebar-collapsed .sidebar-footer {
    display: none !important;
  }
  body.sidebar-collapsed .main-content {
    margin-left: 70px !important;
  }
  html[dir="rtl"] body.sidebar-collapsed .main-content,
  [dir="rtl"] body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    margin-right: 70px !important;
  }
}

/* Header */
.top-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.role-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-btn {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

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

/* Page Body */
.page-body {
  padding: 2rem;
  flex: 1;
}

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

html[dir="rtl"] .page-header {
  text-align: right;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Cards & Grid */
.grid {
  display: grid;
  gap: 1.25rem;
}
.grid-cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* Tables & Containers */
.table-container {
  overflow-x: auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 0.95rem;
}

th {
  background: #f8fafc;
  padding: 0.85rem 1.15rem;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: start;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

td {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: start;
}

html[dir="rtl"] th,
html[dir="rtl"] td,
[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

html[dir="ltr"] th,
html[dir="ltr"] td,
[dir="ltr"] th,
[dir="ltr"] td {
  text-align: left;
}

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

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.925rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.3;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  text-decoration: none;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #059669;
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
  text-decoration: none;
}

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

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

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  text-align: start;
}

html[dir="rtl"] .form-label {
  text-align: right;
}

.form-control, input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #ffffff;
  color: var(--text-main);
  text-align: start;
}

html[dir="rtl"] .form-control,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea,
[dir="rtl"] .form-control {
  text-align: right;
  direction: rtl;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.2;
}


.badge-success {
  background: var(--success-light);
  color: #047857;
}
.badge-danger {
  background: var(--danger-light);
  color: #b91c1c;
}
.badge-warning {
  background: var(--warning-light);
  color: #b45309;
}
.badge-info {
  background: var(--info-light);
  color: #0369a1;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.alert-danger {
  background: var(--danger-light);
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.alert-success {
  background: var(--success-light);
  color: #047857;
  border: 1px solid #a7f3d0;
}
.alert-warning {
  background: var(--warning-light);
  color: #b45309;
  border: 1px solid #fde68a;
}
.alert-info {
  background: var(--info-light);
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  padding: 1.75rem;
}

/* Login Page Specific */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.login-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.925rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.75rem;
}

/* Footer */
.footer-text {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

/* Helper display classes */
.lang-short {
  display: none;
}
.logout-icon {
  display: none;
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsiveness (Max Width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Prevent any horizontal screen sliding */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
  }

  .app-container, .main-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Mobile Drawer Sidebar */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 275px !important;
    max-width: 82vw !important;
    z-index: 100 !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease !important;
    visibility: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
  }

  html[dir="rtl"] .sidebar,
  [dir="rtl"] .sidebar {
    right: 0 !important;
    left: auto !important;
    transform: translateX(105%) !important;
  }

  html[dir="ltr"] .sidebar,
  [dir="ltr"] .sidebar {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-105%) !important;
  }

  body.sidebar-mobile-open .sidebar,
  html[dir="rtl"] body.sidebar-mobile-open .sidebar,
  [dir="rtl"] body.sidebar-mobile-open .sidebar,
  html[dir="ltr"] body.sidebar-mobile-open .sidebar,
  [dir="ltr"] body.sidebar-mobile-open .sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45) !important;
  }

  /* Header Clean Styling on Mobile */
  .top-header {
    height: auto !important;
    min-height: 52px !important;
    padding: 0.4rem 0.75rem !important;
  }

  .header-left {
    gap: 0.4rem !important;
  }

  .sidebar-toggle-btn {
    padding: 0.35rem 0.6rem !important;
    font-size: 1.1rem !important;
  }

  .user-badge .role-tag {
    display: none !important;
  }

  .user-name-text {
    max-width: 90px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.85rem !important;
  }

  .header-right {
    gap: 0.35rem !important;
  }

  .lang-full {
    display: none !important;
  }
  .lang-short {
    display: inline !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
  }

  .lang-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.8rem !important;
  }

  .logout-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.85rem !important;
  }
  .logout-text {
    display: none !important;
  }
  .logout-icon {
    display: inline !important;
  }

  /* Page Body */
  .page-body {
    padding: 0.85rem 0.65rem !important;
  }

  .page-header {
    margin-bottom: 1rem !important;
    gap: 0.65rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .page-title {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
  }

  /* Cards */
  .card {
    padding: 1rem 0.85rem !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.85rem !important;
  }

  /* Form Grids on mobile: convert 2-col to 1-col */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Universal Mobile Form & Grid Adapters */
  [style*="grid-template-columns: repeat(auto-fit, minmax(2"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(3"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(4"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* ===================================================
     1. TABLES -> STACKED CARDS ON MOBILE (<= 768px)
     =================================================== */
  table.data-table:not(.table-report),
  table:not(.table-report):not(.layout-table) {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
  }

  table.data-table:not(.table-report) thead,
  table:not(.table-report):not(.layout-table) thead {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  table.data-table:not(.table-report) tbody,
  table:not(.table-report):not(.layout-table) tbody {
    display: block !important;
    width: 100% !important;
  }

  table.data-table:not(.table-report) tbody tr,
  table:not(.table-report):not(.layout-table) tbody tr {
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.85rem !important;
    padding: 0.85rem 1rem !important;
    box-shadow: var(--shadow-sm) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  table.data-table:not(.table-report) td,
  table:not(.table-report):not(.layout-table) td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.5rem 0 !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 0.92rem !important;
    min-height: 42px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  table.data-table:not(.table-report) td::before,
  table:not(.table-report):not(.layout-table) td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-inline-end: 0.75rem;
    flex-shrink: 0;
    text-align: start;
    min-width: 80px;
  }

  table.data-table:not(.table-report) td:not([data-label])::before,
  table.data-table:not(.table-report) td[data-label=""]::before,
  table:not(.table-report):not(.layout-table) td:not([data-label])::before,
  table:not(.table-report):not(.layout-table) td[data-label=""]::before {
    display: none !important;
  }

  table.data-table:not(.table-report) td[colspan],
  table.data-table:not(.table-report) td.table-empty-row,
  table:not(.table-report):not(.layout-table) td[colspan] {
    display: block !important;
    text-align: center !important;
    justify-content: center !important;
    border-bottom: none !important;
    padding: 1.5rem !important;
  }
  table.data-table:not(.table-report) td[colspan]::before,
  table:not(.table-report):not(.layout-table) td[colspan]::before {
    display: none !important;
  }

  table.data-table:not(.table-report) td:last-child,
  table:not(.table-report):not(.layout-table) td:last-child {
    border-bottom: none !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.25rem !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
  }

  table.data-table:not(.table-report) td:last-child .btn,
  table:not(.table-report):not(.layout-table) td:last-child .btn {
    flex: 1 1 auto !important;
    min-height: 44px !important;
    padding: 0.5rem 0.85rem !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .table-container:not(.table-report-container) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow-x: visible !important;
    margin-bottom: 1rem !important;
  }

  /* ===================================================
     2. REPORT TABLES (Genuinely wide reports)
     =================================================== */
  .table-report-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    background: var(--bg-card) !important;
    margin-bottom: 1.25rem !important;
  }

  table.table-report {
    display: table !important;
    width: 100% !important;
    min-width: 600px !important;
  }
  table.table-report thead {
    display: table-header-group !important;
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  table.table-report tbody {
    display: table-row-group !important;
  }
  table.table-report tr {
    display: table-row !important;
  }
  table.table-report th,
  table.table-report td {
    display: table-cell !important;
    white-space: nowrap !important;
    padding: 0.65rem 0.85rem !important;
  }
  table.table-report th:first-child,
  table.table-report td:first-child {
    position: sticky !important;
    z-index: 3 !important;
    background: #f8fafc !important;
  }
  table.table-report td:first-child {
    background: var(--bg-card) !important;
  }
  html[dir="rtl"] table.table-report th:first-child,
  html[dir="rtl"] table.table-report td:first-child,
  [dir="rtl"] table.table-report th:first-child,
  [dir="rtl"] table.table-report td:first-child {
    right: 0 !important;
    left: auto !important;
    box-shadow: -2px 0 6px rgba(0,0,0,0.06) !important;
  }
  html[dir="ltr"] table.table-report th:first-child,
  html[dir="ltr"] table.table-report td:first-child,
  [dir="ltr"] table.table-report th:first-child,
  [dir="ltr"] table.table-report td:first-child {
    left: 0 !important;
    right: auto !important;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06) !important;
  }

  /* ===================================================
     3. FORMS & INPUTS ON MOBILE
     =================================================== */
  form {
    width: 100% !important;
    max-width: 100% !important;
  }

  .form-group {
    margin-bottom: 1rem !important;
    width: 100% !important;
  }

  .form-label {
    display: block !important;
    margin-bottom: 0.35rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
  }

  .form-control,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.55rem 0.75rem !important;
    line-height: 1.4 !important;
  }

  textarea.form-control,
  textarea {
    min-height: 80px !important;
  }

  .form-actions,
  .card-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
    width: 100% !important;
    margin-top: 1.25rem !important;
  }

  .form-actions .btn,
  .card-actions .btn {
    width: 100% !important;
    min-height: 46px !important;
  }

  /* ===================================================
     4. TOUCH TARGETS (>= 44px)
     =================================================== */
  .btn,
  button,
  .action-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    font-size: 0.925rem !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .btn-sm {
    min-height: 44px !important;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.875rem !important;
  }

  /* ===================================================
     5. MODALS & DIALOGS (Bottom sheet / Full Screen)
     =================================================== */
  .modal-dialog,
  .modal-content,
  .modal .card,
  [id*="Modal"] .card,
  [id*="modal"] .card,
  [id*="dialog"] .card,
  [id*="Dialog"] .card {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    max-height: 90vh !important;
    margin: 0 !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 1.25rem 1rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25) !important;
    border-bottom: none !important;
  }

  body.modal-open {
    overflow: hidden !important;
    width: 100% !important;
  }

  /* ===================================================
     6. HORIZONTALLY SCROLLABLE CHIPS / TABS
     =================================================== */
  .filter-chips,
  .status-chips,
  .tabs-nav,
  .filter-tabs-bar,
  .page-header > div > div[style*="display: flex; gap: 0."],
  .page-header > div > div[style*="display:flex;gap:0."],
  .page-header > div > div[style*="display: flex; gap: 0.4rem; flex-wrap: wrap;"],
  .page-header > div > div[style*="display: flex; gap: 0.5rem; flex-wrap: wrap;"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.45rem !important;
    padding-bottom: 0.4rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .filter-chips .btn,
  .status-chips .btn,
  .tabs-nav .btn,
  .page-header > div > div > .btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* ===================================================
     7. DASHBOARD & KPIS
     =================================================== */
  .card-value {
    font-size: 1.45rem !important;
  }
  .card-title {
    font-size: 0.8rem !important;
  }

  /* ===================================================
     8. ORDER CREATION LINE ITEMS & BOTTOM TOTALS
     =================================================== */
  #order-items-table.data-table tbody tr.order-item-row {
    position: relative !important;
    padding: 1rem !important;
    padding-top: 2.2rem !important;
  }

  #order-items-table.data-table tbody tr.order-item-row .btn[onclick*="removeRow"] {
    position: absolute !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    left: auto !important;
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: none !important;
  }
  html[dir="rtl"] #order-items-table.data-table tbody tr.order-item-row .btn[onclick*="removeRow"],
  [dir="rtl"] #order-items-table.data-table tbody tr.order-item-row .btn[onclick*="removeRow"] {
    right: auto !important;
    left: 0.5rem !important;
  }
}

