
/* style.css — extracted from index_v4_FINAL.html */

:root {
  --primary: #1a56db;
  --primary-dark: #1239a5;
  --primary-light: #e8f0fe;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --dark: #111827;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --sidebar-width: 260px;
  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --header-height: 64px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --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.1), 0 10px 10px rgba(0, 0, 0, 0.04);

  /* ── Type Scale ── */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;

  /* ── Spacing Scale ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

/* ===== LOGIN ===== */
#loginScreen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a56db 0%, #1239a5 50%, #0f2a7a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  overflow: hidden;
}

.login-card * {
  box-sizing: border-box;
}

.login-card button {
  white-space: nowrap;
}

.login-card p {
  margin: 0;
  line-height: 1.4;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
}

.login-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.login-version {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 24px;
  letter-spacing: 0.03em;
}

.login-card-footer {
  border-top: 1px solid var(--gray-100);
  margin-top: 24px;
  padding-top: 16px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  transition: all 0.2s;
  outline: none;
  direction: rtl;
  box-sizing: border-box;
  margin: 0;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-group {
  margin-bottom: 20px;
  text-align: right;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--gray-700);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--success);
  color: white;
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-gray {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-gray:hover {
  background: var(--gray-200);
}

/* ===== APP LAYOUT ===== */
#app {
  display: none;
  min-height: 100vh;
}

#app.active {
  display: flex;
  flex-direction: row;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gray-900);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--gray-800);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 900;
  color: white;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--gray-400);
}

.nav-section {
  padding: 8px 0;
}

.nav-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-label.clickable:hover {
  color: white;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  margin: 1px 8px;
  border-radius: 8px;
}

.nav-item:hover {
  background: var(--gray-800);
  color: white;
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

#settings-items {
  overflow: hidden;
  transition: max-height .25s ease;
  max-height: 300px;
}

#settings-items.collapsed {
  max-height: 0;
}

.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--gray-800);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--gray-800);
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), #ef4444);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
}

.user-role {
  font-size: 11px;
  color: var(--gray-400);
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gray-900);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-700);
  padding: 4px;
}

/* Main content */
.main-content {
  margin-right: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 14px 20px 24px 20px;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

/* Mobile overrides — see full @media block below */

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.debt-type-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.debt-type-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
}

.debt-type-card.selected {
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .3);
}

.debt-type-card strong {
  font-size: 13px;
  display: block;
}

.settle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.1s;
}

.settle-item:hover {
  background: #f0f9ff;
}

.settle-item.chosen {
  background: #dbeafe;
}

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

/* ===== PAGES ===== */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--gray-900);
}

.card-body {
  padding: 20px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}

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

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: var(--primary-light);
}

.stat-icon.green {
  background: var(--success-light);
}

.stat-icon.yellow {
  background: var(--accent-light);
}

.stat-icon.red {
  background: var(--danger-light);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  font-weight: 600;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--gray-900);
}

.stat-sub {
  font-size: 12px;
  color: var(--gray-400);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

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

tbody tr:hover {
  background: var(--gray-50);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}

.badge-success {
  background: var(--success-light);
  color: #065f46;
}

.badge-danger {
  background: var(--danger-light);
  color: #991b1b;
}

.badge-warning {
  background: var(--warning-light);
  color: #78350f;
}

.badge-blue {
  background: var(--primary-light);
  color: #1e3a8a;
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex !important;
}

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  /* No max-height by default — show ALL content */
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: 16px 16px 0 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  background: var(--gray-100);
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: white;
  z-index: 10;
}

/* Form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}

select.form-control {
  appearance: none;
  background-image: 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='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}

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

/* Search bar */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  font-size: 16px;
}

.search-input-wrap .form-control {
  padding-right: 40px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success {
  background: var(--success);
}

.toast.danger {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
}

/* Dashboard charts */


/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 0;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--gray-900);
}

.page-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 1px;
  margin-bottom: 0;
}

/* Alert */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-warning {
  background: var(--warning-light);
  color: #78350f;
  border: 1px solid #fcd34d;
}

.alert-info {
  background: var(--primary-light);
  color: #1e3a8a;
  border: 1px solid #93c5fd;
}

.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Order items */
.order-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}

.order-item .remove-item {
  position: absolute;
  top: 8px;
  left: 8px;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 6px;
}

.order-item .remove-item:hover {
  background: #fee2e2;
}

.order-item-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.order-item-row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.order-item label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 3px;
  display: block;
}

/* Entity cards */
.entity-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.entity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.entity-card-header:hover {
  background: var(--gray-50);
}

.entity-name {
  font-weight: 800;
  font-size: 15px;
}

.entity-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-500);
  flex-wrap: wrap;
}

.entity-meta strong {
  color: var(--gray-800);
}

.entity-toggle {
  font-size: 16px;
  transition: transform 0.2s;
  color: var(--gray-400);
}

.entity-card.open .entity-toggle {
  transform: rotate(180deg);
}

.entity-details {
  display: none;
  border-top: 1px solid var(--gray-100);
}

.entity-card.open .entity-details {
  display: block;
}

.order-group {
  padding: 12px 18px;
  border-bottom: 1px solid var(--gray-100);
}

.order-group:last-child {
  border-bottom: none;
}

.order-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.order-group-date {
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
}

.order-group-total {
  color: var(--gray-500);
  font-size: 12px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--gray-100);
  font-size: 13px;
}

.order-row:last-child {
  border-bottom: none;
}

.order-row-left {
  color: var(--gray-700);
}

.order-row-right {
  color: var(--gray-500);
  font-size: 12px;
}

/* Inline order entry table */
.inline-order-form {
  padding: 0 18px 16px;
}

.inline-order-form .order-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.inline-order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.inline-order-table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  padding: 7px 10px;
  text-align: right;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.inline-order-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.inline-order-table td input,
.inline-order-table td select {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 5px 8px;
  width: 100%;
  font-size: 13px;
  background: white;
}

.inline-order-table td input:focus {
  border-color: var(--primary);
  outline: none;
}

.inline-order-table .ac-wrap {
  position: relative;
}

.inline-order-table .ac-drop {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  z-index: 999;
  max-height: 180px;
  overflow-y: auto;
  display: none;
}

.inline-order-table .ac-drop.open {
  display: block;
}

.inline-order-table .ac-drop div {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
}

.inline-order-table .ac-drop div:hover {
  background: var(--gray-50);
}

.add-row-btn {
  background: none;
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
  width: 100%;
}

.add-row-btn:hover {
  background: var(--gray-50);
}

.entity-add-order-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 8px;
}

.entity-add-order-btn:hover {
  opacity: .85;
}

.order-item .form-control {
  font-size: 13px;
  padding: 7px 10px;
}

.item-stock-hint {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 3px;
}

/* Stock indicator */
.stock-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
  min-width: 80px;
}

.stock-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

/* Compatible screens list */
.compat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.compat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font-size: 13px;
}

/* Profit cards */
.profit-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.profit-card .profit-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 600;
}

.profit-card .profit-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--success);
  margin: 4px 0;
}

.profit-card .profit-sub {
  font-size: 12px;
  color: var(--gray-400);
}

/* ═══════════════════════════════════════
     MOBILE LAYOUT — شاشات أقل من 768px
     ═══════════════════════════════════════ */
@media screen and (max-width: 768px) {

  /* إعادة تعيين المتغيرات */
  :root {
    --sidebar-width: 0px !important;
    --header-height: 0px !important;
  }

  /* إخفاء عناصر سطح المكتب */
  .header {
    display: none !important;
  }

  .sidebar {
    transform: translateX(100%) !important;
    width: 280px !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-overlay.open {
    display: block !important;
  }

  /* تحسين عرض عناصر القائمة الجانبية */
  .nav-item {
    padding: 12px 16px !important;
    font-size: 14px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .nav-icon {
    font-size: 16px !important;
    min-width: 20px !important;
  }

  /* تحسين عرض قسم الإعدادات */
  .nav-label {
    padding: 12px 16px !important;
    font-size: 14px !important;
    min-height: 44px !important;
  }

  #settings-items {
    max-height: none !important;
    overflow: visible !important;
  }

  /* تحسين سهم الإعدادات على الموبايل */
  #settings-arrow {
    transition: transform 0.2s ease !important;
    display: inline-block !important;
  }

  #settings-arrow.collapsed {
    transform: rotate(0deg) !important;
  }

  #settings-arrow:not(.collapsed) {
    transform: rotate(-180deg) !important;
  }

  /* المحتوى الرئيسي */
  .main-content {
    margin-right: 0 !important;
    margin-top: 0 !important;
    padding: 12px 10px 80px 10px !important;
    min-height: calc(100vh - 62px) !important;
  }

  /* شريط التنقل السفلي */
  .bottom-nav {
    display: flex !important;
  }

  /* الشبكات */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

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

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

  /* الجداول */
  table {
    font-size: 12px !important;
  }

  thead th,
  tbody td {
    padding: 7px 8px !important;
  }

  /* رأس الصفحة */
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* النوافذ — تظهر من الأسفل */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal {
    border-radius: 20px 20px 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    margin: 0 !important;
  }

  /* بطاقات الإحصاء */
  .stat-card {
    padding: 12px !important;
    gap: 8px !important;
  }

  .stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
  }

  .stat-value {
    font-size: 16px !important;
  }

  .stat-label {
    font-size: 11px !important;
  }

  /* عنوان الصفحة للموبايل */
  .mobile-page-title {
    display: block !important;
  }

  /* تحسينات النوافذ المنبثقة للموبايل */
  .modal-body {
    padding: 16px !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .modal-footer .btn {
    width: 100% !important;
  }

  /* تحسين حقول الإدخال للموبايل */
  .form-control {
    font-size: 16px !important;
    padding: 12px 14px !important;
    min-height: 44px !important;
  }

  input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
  }

  input::-webkit-outer-spin-button,
  input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* تحسين الأزرار للموبايل */
  .btn {
    min-height: 44px !important;
    font-size: 14px !important;
    padding: 12px 20px !important;
  }

  /* تحسين الجداول للموبايل */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }
}

/* ===== BOTTOM NAV (mobile only) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--gray-900);
  z-index: 1100;
  align-items: stretch;
  border-top: 2px solid var(--gray-800);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  display: none;
  /* shown via JS on mobile */
}

.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 700;
  transition: all 0.15s;
  padding: 6px 2px;
  border: none;
  background: none;
  font-family: 'Cairo', sans-serif;
  position: relative;
}

.bn-item .bn-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.15s;
}

.bn-item.active {
  color: #60a5fa;
}

.bn-item.active .bn-icon {
  transform: scale(1.2);
}

.bn-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: #60a5fa;
  border-radius: 0 0 4px 4px;
}

.bn-more-panel {
  position: fixed;
  bottom: 62px;
  left: 0;
  right: 0;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  display: none;
  flex-direction: column;
  z-index: 1099;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
}

.bn-more-panel.open {
  display: flex;
}

.bn-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  color: var(--gray-300);
  cursor: pointer;
  border-bottom: 1px solid var(--gray-800);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
}

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

.bn-more-item:active,
.bn-more-item:hover {
  background: var(--gray-800);
}

.bn-more-item.active {
  color: #60a5fa;
}

.bn-more-item .bmi-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.bn-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1098;
  background: rgba(0, 0, 0, 0.5);
}

.bn-overlay.open {
  display: block;
}

.mobile-page-title {
  display: none;
  padding: 8px 16px 4px;
  font-size: 20px;
  font-weight: 900;
  color: var(--gray-900);
}


/* ===== QUICK ACTION BUTTONS ===== */
.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  transition: all 0.2s;
  text-align: right;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.quick-btn:hover {
  transform: translateX(-3px);
  box-shadow: var(--shadow-lg);
}

.quick-btn:active {
  transform: translateX(0);
  box-shadow: var(--shadow);
}

.quick-btn-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.quick-btn-text {
  flex: 1;
  text-align: right;
}

.quick-btn-label {
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 2px;
}

.quick-btn-sub {
  font-size: 12px;
  opacity: 0.82;
  font-weight: 500;
}

.quick-btn-arrow {
  font-size: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

.quick-btn-purchase {
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: white;
}

.quick-btn-sale {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
}

.quick-btn-compat {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
}

.quick-btn-stats {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  color: white;
}

/* Stats modal grid */
.stats-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-modal-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-modal-card .smc-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.stat-modal-card .smc-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--gray-900);
}

.stat-modal-card .smc-label {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 600;
  margin-top: 2px;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 20px 0;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-wrap {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: white;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
}

.ac-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}

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

.ac-item:hover,
.ac-item.selected {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.ac-item .ac-qty {
  margin-right: auto;
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 700;
}

.ac-item .ac-qty.zero {
  color: var(--danger);
}

.ac-no-results {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--gray-400);
  text-align: center;
}

/* Compatible tags input */
.tags-input-wrap {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  cursor: text;
  min-height: 46px;
  transition: border-color 0.2s;
  background: white;
}

.tags-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.tag-chip {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.tag-chip .tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary);
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.tag-chip .tag-remove:hover {
  opacity: 1;
}

.tags-input-field {
  border: none;
  outline: none;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  flex: 1;
  min-width: 120px;
  padding: 2px 4px;
  background: transparent;
  direction: rtl;
}

/* Action buttons in table */
.action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Mobile: inline sale table scroll */
@media (max-width: 640px) {
  .inline-order-table {
    font-size: 11px;
  }

  .inline-order-table th,
  .inline-order-table td {
    padding: 4px 4px !important;
  }

  .inline-order-table input,
  .inline-order-table select {
    font-size: 11px !important;
    padding: 3px 4px !important;
  }

  .inline-order-form {
    overflow-x: auto;
  }
}

/* Safe area for notch phones */
@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    height: calc(62px + env(safe-area-inset-bottom));
  }

  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
}

/* Print styles */
@media print {

  .sidebar,
  .header,
  .bottom-nav,
  .bn-more-panel,
  .toast-container,
  #splashScreen,
  #offlineBanner,
  #errorScreen,
  .quick-actions-list {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .page {
    display: block !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* Focus ring for accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.nav-item:focus-visible {
  outline: 3px solid rgba(26, 86, 219, 0.5);
  outline-offset: 2px;
}

/* Smooth page transitions */
.page {
  animation: fadeIn 0.18s ease;
}

/* Inventory warning row */
tr.low-stock td {
  background: #fffbeb;
}

tr.out-stock td {
  background: #fef2f2;
}

/* Backup section */
.backup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .backup-grid {
    grid-template-columns: 1fr;
  }
}

.backup-card {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.backup-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.backup-card .backup-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.backup-card .backup-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--gray-800);
}

.backup-card .backup-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.prod-filter-chip {
  padding: 5px 13px;
  border-radius: 99px;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  transition: all .15s;
}

.prod-filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.prod-filter-chip:hover:not(.active) {
  background: var(--gray-100);
}

.prod-chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  transition: all .15s;
}

.prod-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.prod-chip:hover:not(.active) {
  background: var(--gray-100);
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  background: none;
  border: none;
  border-radius: 7px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: var(--shadow);
}

/* WhatsApp export button */
.btn-whatsapp {
  background: linear-gradient(135deg, var(--whatsapp), var(--whatsapp-dark));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s;
}

.btn-whatsapp:hover {
  opacity: 0.88;
}

.btn-whatsapp-sm {
  background: linear-gradient(135deg, var(--whatsapp), var(--whatsapp-dark));
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
}

/* Inline sale table — scrollable on mobile */
.inline-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Loading splash screen */
#appSplash {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a56db 0%, #1239a5 60%, #0f2a7a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  gap: 24px;
  transition: opacity 0.4s ease;
}

#appSplash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.splash-title {
  color: white;
  font-size: 26px;
  font-weight: 900;
  font-family: 'Cairo', sans-serif;
  text-align: center;
}

.splash-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-family: 'Cairo', sans-serif;
}

.splash-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Offline banner */
#offlineBanner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  background: linear-gradient(90deg, #b45309, #d97706);
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#offlineBanner.show {
  display: block;
}

/* Error boundary card */
.error-card {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: #991b1b;
  font-weight: 600;
  margin: 20px 0;
}

.error-card .error-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* Loader upgrade — CSS spinner instead of emoji */
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}


/* ══════════════════════════════════════════
     SCROLLBAR — Custom subtle scrollbar
     ══════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ══════════════════════════════════════════
     FOCUS VISIBLE — Accessibility
     ══════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* ══════════════════════════════════════════
     MOBILE — Inline Sale Table (8 columns → scrollable)
     ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .inline-order-table {
    font-size: 11px !important;
  }

  .inline-order-table th,
  .inline-order-table td {
    padding: 4px 3px !important;
  }

  .inline-order-table select,
  .inline-order-table input {
    font-size: 11px !important;
    padding: 3px 4px !important;
  }

  .inline-order-form {
    padding: 0 8px 12px !important;
    overflow-x: auto;
  }

  /* Hide less critical columns on very small screens */
  @media (max-width: 400px) {

    .inline-order-table th:nth-child(2),
    .inline-order-table td:nth-child(2) {
      display: none;
    }
  }
}

/* ══════════════════════════════════════════
     PRINT — Basic print styles
     ══════════════════════════════════════════ */
@media print {

  .sidebar,
  .header,
  .bottom-nav,
  .bn-more-panel,
  .sidebar-overlay,
  .bn-overlay,
  .toast-container,
  .page-header button,
  #splashScreen {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }

  body {
    background: white !important;
  }
}

/* ══════════════════════════════════════════
     SECURITY UI — Session warning
     ══════════════════════════════════════════ */
#sessionWarning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--danger);
  color: white;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  z-index: 99999;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════
     LOADING OVERLAY — Data fetch indicator
     ══════════════════════════════════════════ */
#loadingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  z-index: 99998;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

#loadingOverlay.show {
  display: flex;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-text {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  text-align: center;
}

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

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════════
     OFFLINE BANNER
     ══════════════════════════════════════════ */


/* تحسينات إضافية للموبايل */
@media (max-width: 768px) {

  /* تحسين الأزرار */
  button,
  .btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* تحسين الجداول */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* تحسين القوائم المنسدلة */
  select.form-control {
    font-size: 16px !important;
    min-height: 44px !important;
  }

  /* إزالة المساحات البيضاء الزائدة */
  body {
    overflow-x: hidden;
  }

  .page {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* تحسين البطاقات */
  .card {
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }

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

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

  /* تحسين النوافذ المنبثقة */
  .modal {
    animation: slideUp 0.3s ease-out;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  /* تحسين حقول الإدخال */
  input.form-control,
  textarea.form-control,
  select.form-control {
    border-radius: 10px !important;
    border: 2px solid var(--gray-200) !important;
  }

  input.form-control:focus,
  textarea.form-control:focus,
  select.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.1) !important;
  }

  /* تحسين الأيقونات */
  .stat-icon {
    border-radius: 12px !important;
  }

  /* تحسين عرض الإحصائيات */
  .stat-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  }
}

/* تحسينات للشاشات الصغيرة جداً */
@media (max-width: 360px) {
  :root {
    --text-sm: 11px;
    --text-base: 12px;
    --text-md: 13px;
  }

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

  .modal-title {
    font-size: 16px !important;
  }
}