body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

/* Improve table text contrast in light mode */
table thead th,
table tbody td,
table tfoot td {
  color: #0f172a !important;
}

.dark table thead th,
.dark table tbody td,
.dark table tfoot td {
  color: #e2e8f0 !important;
}

/* Force readable text when table is inside green cards */
.bg-emerald-600 table thead th,
.bg-emerald-600 table tbody td,
.bg-emerald-600 table tfoot td,
.bg-emerald-700 table thead th,
.bg-emerald-700 table tbody td,
.bg-emerald-700 table tfoot td {
  color: #111827 !important;
}

.dark .bg-emerald-600 table thead th,
.dark .bg-emerald-600 table tbody td,
.dark .bg-emerald-600 table tfoot td,
.dark .bg-emerald-700 table thead th,
.dark .bg-emerald-700 table tbody td,
.dark .bg-emerald-700 table tfoot td {
  color: #e5e7eb !important;
}

/* Zebra rows for all system tables */
table tbody tr:nth-child(odd) {
  background-color: #f8fafc !important;
}

table tbody tr:nth-child(even) {
  background-color: #eef2ff !important;
}

.dark table tbody tr:nth-child(odd) {
  background-color: #0f172a !important;
}

.dark table tbody tr:nth-child(even) {
  background-color: #1e293b !important;
}

#app-sidebar.sidebar-collapsed {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#app-sidebar.sidebar-collapsed .sidebar-title,
#app-sidebar.sidebar-collapsed .sidebar-label {
  display: none;
}

#app-sidebar .sidebar-icon {
  display: inline-flex;
  width: 1.5rem;
  min-width: 1.5rem;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  line-height: 1;
}

#app-sidebar .sidebar-link.sidebar-link-active {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.dark #app-sidebar .sidebar-link.sidebar-link-active {
  background: rgba(30, 58, 138, 0.45) !important;
  color: #dbeafe !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

#app-sidebar.sidebar-collapsed .sidebar-link {
  justify-content: center;
  gap: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#app-sidebar {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e2e8f0;
}

#app-sidebar::-webkit-scrollbar {
  width: 10px;
}

#app-sidebar::-webkit-scrollbar-track {
  background: #e2e8f0;
}

#app-sidebar::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
  border: 2px solid #e2e8f0;
}

.dark #app-sidebar {
  scrollbar-color: #475569 #1e293b;
}

.dark #app-sidebar::-webkit-scrollbar-track {
  background: #1e293b;
}

.dark #app-sidebar::-webkit-scrollbar-thumb {
  background: #475569;
  border-color: #1e293b;
}

/* TomSelect in modals: clear layering and readable search dropdown */
.ts-wrapper {
  width: 100% !important;
  min-width: 100%;
}

.ts-control {
  min-height: 42px;
  border-radius: 0.5rem;
  border-color: #cbd5e1;
  width: 100% !important;
}

.ts-dropdown {
  z-index: 1400;
  border-color: #cbd5e1;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
}

.ts-dropdown .dropdown-input-wrap input {
  direction: rtl;
  text-align: right;
}

.dark .ts-control {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

.dark .ts-dropdown {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

/* Product picker modal table scrollbar */
#sales-product-picker-modal .overflow-auto {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e2e8f0;
}

#sales-product-picker-modal .overflow-auto::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#sales-product-picker-modal .overflow-auto::-webkit-scrollbar-track {
  background: #e2e8f0;
}

#sales-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
  border: 2px solid #e2e8f0;
}

.dark #sales-product-picker-modal .overflow-auto {
  scrollbar-color: #475569 #0f172a;
}

.dark #sales-product-picker-modal .overflow-auto::-webkit-scrollbar-track {
  background: #0f172a;
}

.dark #sales-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb {
  background: #475569;
  border-color: #0f172a;
}

#purchase-product-picker-modal .overflow-auto,
#van-product-picker-modal .overflow-auto {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e2e8f0;
}

#purchase-product-picker-modal .overflow-auto::-webkit-scrollbar,
#van-product-picker-modal .overflow-auto::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#purchase-product-picker-modal .overflow-auto::-webkit-scrollbar-track,
#van-product-picker-modal .overflow-auto::-webkit-scrollbar-track {
  background: #e2e8f0;
}

#purchase-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb,
#van-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
  border: 2px solid #e2e8f0;
}

.dark #purchase-product-picker-modal .overflow-auto,
.dark #van-product-picker-modal .overflow-auto {
  scrollbar-color: #475569 #0f172a;
}

.dark #purchase-product-picker-modal .overflow-auto::-webkit-scrollbar-track,
.dark #van-product-picker-modal .overflow-auto::-webkit-scrollbar-track {
  background: #0f172a;
}

.dark #purchase-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb,
.dark #van-product-picker-modal .overflow-auto::-webkit-scrollbar-thumb {
  background: #475569;
  border-color: #0f172a;
}
