:root {
  color-scheme: light;
}

html.theme-dark {
  color-scheme: dark;
}

html.theme-light {
  color-scheme: light;
}

html.theme-light body {
  background: #f6f7fb;
}

html.theme-light .sidenav {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}

html.theme-light .sidenav .nav-link,
html.theme-light .sidenav .nav-link i,
html.theme-light .sidenav .navbar-brand {
  color: #344767;
}

html.theme-light .sidenav .nav-link-text,
html.theme-light .sidenav .nav-link span {
  color: #344767;
}

html.theme-light .sidenav .collapse .nav-link,
html.theme-light .sidenav .collapse .nav-link span {
  color: #334155;
}

html.theme-light .sidenav .nav-link.active {
  background: #f1f5f9;
  color: #0f172a;
}

html.theme-light .sidenav .nav-link.active .nav-link-text,
html.theme-light .sidenav .nav-link.active span {
  color: #0f172a;
}

html.theme-light .sidenav h6 {
  color: #64748b;
}

html.theme-light .sidenav .icon i,
html.theme-light .sidenav .nav-link i {
  color: #2563eb;
  opacity: 1;
}

html.theme-light .sidenav .icon {
  background: #eaf1ff;
}

html.theme-light .sidenav .nav-link.active .icon i,
html.theme-light .sidenav .nav-link.active i {
  color: #1d4ed8;
}

html.theme-light .sidenav .nav-link.active .icon {
  background: #dbeafe;
}

html.theme-light .navbar-main .nav-link,
html.theme-light .breadcrumb .breadcrumb-item,
html.theme-light .breadcrumb .breadcrumb-item a,
html.theme-light .navbar-main h6 {
  color: #344767 !important;
}

html.theme-light .navbar-main .input-group-text,
html.theme-light .navbar-main .form-control {
  background: #ffffff;
  color: #344767;
  border-color: #e2e8f0;
}

html.theme-light [data-theme-toggle] {
  color: #344767;
  border-color: #cbd5e1;
  background: #ffffff;
}

html.theme-light [data-theme-toggle]:hover {
  background: #f1f5f9;
}

.toolbox-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
}

html.theme-light .toolbox-toggle {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #344767;
}

html.theme-dark .toolbox-toggle {
  background: #0f172a;
  border: 1px solid #1f2937;
  color: #e5e7eb;
}

.toolbox-menu {
  min-width: 220px;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 2px;
}

.toolbox-icon-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: inherit;
  width: 100%;
}

.toolbox-icon-btn i {
  font-size: 16px;
}

.toolbox-label {
  font-size: 11px;
  line-height: 1;
  opacity: 0.8;
}

html.theme-light .toolbox-icon-btn {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #344767;
}

html.theme-light .toolbox-icon-btn:hover {
  background: #f1f5f9;
}

html.theme-dark .toolbox-icon-btn {
  background: #0f172a;
  border-color: #1f2937;
  color: #e5e7eb;
}

html.theme-dark .toolbox-icon-btn:hover {
  background: #1f2937;
}

html.theme-dark body {
  background: #0b1220;
}

html.theme-dark .card {
  background-color: #0f172a;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

html.theme-dark .card .text-muted,
html.theme-dark .text-muted {
  color: #94a3b8 !important;
}

html.theme-dark .table {
  color: #e5e7eb;
}

html.theme-dark .table thead th {
  color: #9ca3af;
  border-color: #1f2937;
}

html.theme-dark .table tbody tr {
  border-color: #1f2937;
}

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

html.theme-dark .table tbody tr:nth-child(even) {
  background-color: #111827;
}

html.theme-dark .table td,
html.theme-dark .table th {
  color: inherit;
}

html.theme-light .table {
  color: #1f2937;
}

html.theme-light .table thead th {
  color: #475569;
  border-color: #e2e8f0;
}

html.theme-light .table tbody tr {
  border-color: #e2e8f0;
}

html.theme-dark .form-control,
html.theme-dark .form-select,
html.theme-dark .input-group-text {
  background-color: #0b1220;
  color: #e5e7eb;
  border-color: #1f2937;
}

html.theme-dark .form-control::placeholder {
  color: #6b7280;
}

html.theme-dark .navbar-main {
  background: transparent;
}

html.theme-dark .sidenav {
  background: #0b1220;
  border-right: 1px solid #111827;
}

html.theme-dark .sidenav .nav-link,
html.theme-dark .sidenav .nav-link i {
  color: #cbd5f5;
}

html.theme-dark .sidenav .nav-link.active {
  background: #111827;
  color: #ffffff;
}

html.theme-dark .sidenav .nav-link.active .nav-link-text,
html.theme-dark .sidenav .nav-link.active span {
  color: #ffffff;
}

html.theme-dark .sidenav .collapse .nav-link,
html.theme-dark .sidenav .collapse .nav-link span {
  color: #cbd5f5;
}

html.theme-light .sidenav .nav-link i,
html.theme-dark .sidenav .nav-link i {
  opacity: 1 !important;
}

html.theme-dark .sidenav .icon i,
html.theme-dark .sidenav .nav-link i {
  color: #60a5fa;
  opacity: 1;
}

html.theme-light .sidenav .nav-item.mt-3 i {
  color: #2563eb;
  opacity: 0.9;
}

html.theme-dark .sidenav .nav-item.mt-3 i {
  color: #60a5fa;
  opacity: 0.9;
}

html.theme-dark .sidenav .icon {
  background: #0b2340;
}

html.theme-dark .sidenav .nav-link.active .icon i,
html.theme-dark .sidenav .nav-link.active i {
  color: #93c5fd;
}

html.theme-dark .sidenav .nav-link.active .icon {
  background: #12325c;
}

.sidenav-collapse-icon {
  font-size: 0.75rem;
  opacity: 0.7;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-link[aria-expanded=\"true\"] .sidenav-collapse-icon {
  transform: rotate(180deg);
  opacity: 1;
}

.submenu-icon {
  font-size: 0.75rem;
  opacity: 0.85;
}

html.theme-light .submenu-icon {
  color: #2563eb;
}

html.theme-dark .submenu-icon {
  color: #60a5fa;
}

.nav .nav-link.py-0 {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

@media (max-width: 576px) {
  .nav .nav-link.py-0 {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .nav .nav-link.py-0 span {
    font-size: 0.9rem;
  }
}
html.theme-dark .breadcrumb .breadcrumb-item,
html.theme-dark .breadcrumb .breadcrumb-item a {
  color: #cbd5f5 !important;
  opacity: 0.8;
}

html.theme-dark .btn-outline-secondary {
  color: #e5e7eb;
  border-color: #334155;
}

html.theme-dark .btn-outline-secondary:hover {
  background: #1f2937;
}

html.theme-dark .border-bottom {
  border-bottom-color: #1f2937 !important;
}

html.theme-dark .dropdown-menu {
  background: #0f172a;
  color: #e5e7eb;
  border-color: #1f2937;
}

html.theme-dark .dropdown-item {
  color: #e5e7eb;
}

html.theme-dark .dropdown-item:hover,
html.theme-dark .dropdown-item:focus {
  background: #1f2937;
  color: #ffffff;
}

html.theme-light .dropdown-menu {
  background: #ffffff;
  color: #1f2937;
  border-color: #e2e8f0;
}

html.theme-light .dropdown-item:hover,
html.theme-light .dropdown-item:focus {
  background: #f1f5f9;
}

html.theme-light .theme-icon-dark,
html.theme-dark .theme-icon-light {
  display: none;
}

html.theme-light .theme-icon-light,
html.theme-dark .theme-icon-dark {
  display: inline-block;
}

html.theme-dark .theme-toggle {
  color: #e5e7eb;
  border-color: #334155;
  background: #111827;
}

html.theme-dark .theme-toggle:hover {
  background: #1f2937;
}

.product-actions {
  margin-top: auto;
}

.product-actions-row .btn {
  flex: 1 1 140px;
  min-width: 0;
}

.product-actions-row .btn-outline-dark {
  border-color: #cbd5e1;
}

html.theme-dark .product-actions-row .btn-outline-dark {
  color: #e5e7eb;
  border-color: #334155;
}

html.theme-dark .product-actions-row .btn-outline-dark:hover {
  background: #1f2937;
}

html.theme-dark .page-link {
  background-color: #0b1220 !important;
  color: #e5e7eb !important;
  border-color: #1f2937 !important;
}

html.theme-dark .page-item.active .page-link {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

html.theme-light .page-link {
  background-color: #ffffff !important;
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}

html.theme-light .page-item.active .page-link {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

html.theme-light .page-link:hover {
  background-color: #f1f5f9;
}

html.theme-dark .page-link:hover {
  background-color: #111827 !important;
  color: #ffffff !important;
  border-color: #243041 !important;
}

html.theme-dark .page-item.disabled .page-link {
  background-color: #0b1220 !important;
  color: #6b7280 !important;
  border-color: #1f2937 !important;
}

html.theme-light .page-item.disabled .page-link {
  background-color: #ffffff !important;
  color: #9ca3af !important;
  border-color: #e2e8f0 !important;
}

html.theme-dark .pagination {
  background: #0b1220;
  border-radius: 12px;
  padding: 6px;
  border: 1px solid #1f2937;
  gap: 4px;
}

html.theme-light .pagination {
  background: #ffffff;
  border-radius: 12px;
  padding: 6px;
  border: 1px solid #e2e8f0;
  gap: 4px;
}

html.theme-dark .pagination .page-link,
html.theme-light .pagination .page-link {
  border-radius: 10px;
  min-width: 36px;
  text-align: center;
}

html.theme-dark .page-item.active .page-link {
  box-shadow: inset 0 0 0 1px #374151, 0 6px 14px rgba(0, 0, 0, 0.35);
}

html.theme-light .page-item.active .page-link {
  box-shadow: inset 0 0 0 1px #cbd5e1, 0 6px 14px rgba(15, 23, 42, 0.08);
}

.dropdown-menu,
.card,
.table,
.form-control,
.form-select,
.input-group-text,
.sidenav,
.nav-link,
body {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

body {
  font-family: "Space Grotesk", "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.1px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Space Grotesk", "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.2px;
}

html.theme-light .sidenav .nav-link.active {
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
}

html.theme-dark .sidenav .nav-link.active {
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.35);
  border: 1px solid #1f2937;
}

html.theme-light .sidenav .nav-link:hover {
  background: #f8fafc;
}

html.theme-dark .sidenav .nav-link:hover {
  background: #0f172a;
}

.form-label,
label {
  font-size: 0.875rem;
}

.form-control::placeholder,
.form-select::placeholder,
input::placeholder,
textarea::placeholder {
  font-size: 0.875rem;
  opacity: 0.75;
}

html.theme-dark .form-control::placeholder,
html.theme-dark .form-select::placeholder,
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
  color: #94a3b8;
  opacity: 0.9;
}

html.theme-dark .pagination-wrap .bg-white {
  background-color: #0b1220 !important;
}

html.theme-dark .pagination-wrap .border-gray-300 {
  border-color: #1f2937 !important;
}

html.theme-dark .pagination-wrap .text-gray-500 {
  color: #9ca3af !important;
}

html.theme-dark .pagination-wrap .text-gray-700 {
  color: #e5e7eb !important;
}

html.theme-dark .pagination-wrap .text-gray-400 {
  color: #cbd5f5 !important;
}

html.theme-dark .pagination-wrap .ring-gray-300 {
  --tw-ring-color: #334155 !important;
}

html.theme-dark .pagination-wrap .active\:bg-gray-100:active {
  background-color: #111827 !important;
}

html.theme-dark .pagination-wrap .active\:text-gray-700:active {
  color: #ffffff !important;
}

html.theme-dark .pagination-wrap .hover\:text-gray-500:hover {
  color: #ffffff !important;
}

html.theme-dark .pagination-wrap .hover\:text-gray-400:hover {
  color: #ffffff !important;
}

html.theme-dark .pagination-wrap span[aria-current=\"page\"] > span {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

html.theme-dark .pagination-wrap .shadow-sm {
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.35) !important;
}

html.theme-light .pagination-wrap .bg-white {
  background-color: #ffffff !important;
}

html.theme-light .pagination-wrap .border-gray-300 {
  border-color: #e2e8f0 !important;
}

html.theme-light .pagination-wrap .text-gray-500 {
  color: #64748b !important;
}

html.theme-light .pagination-wrap .text-gray-700 {
  color: #334155 !important;
}

html.theme-light .pagination-wrap .hover\:text-gray-500:hover,
html.theme-light .pagination-wrap .hover\:text-gray-400:hover {
  color: #1f2937 !important;
}

.table th {
  font-weight: 600;
}

.table td,
.form-control,
.form-select,
.input-group-text,
label,
.form-label {
  font-weight: 500;
}

.text-muted {
  color: #64748b !important;
}

html.theme-dark .text-muted {
  color: #9ca3af !important;
}

.ps__rail-x {
  display: none !important;
}

.main-content .btn {
  min-width: 120px;
}

.pagination-wrap nav {
  display: flex;
  justify-content: center;
}

.pagination-wrap nav > div {
  width: 100%;
}

.pagination-wrap .sm\\:flex.sm\\:items-center.sm\\:justify-between {
  justify-content: center !important;
}

.pagination-wrap .sm\\:flex-1.sm\\:flex.sm\\:items-center.sm\\:justify-between > div:first-child {
  display: none;
}

.pagination-wrap .flex.items-center.justify-between {
  justify-content: center !important;
}

.category-tree {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.category-tree > li {
  margin-top: 6px;
}

.category-tree ul {
  list-style: none;
  margin: 6px 0 0 16px;
  padding-left: 10px;
  border-left: 1px solid var(--bs-border-color);
}

.category-tree .tree-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--bs-border-color);
}

.category-tree .tree-name {
  font-weight: 600;
}

.category-tree .tree-actions {
  margin-left: auto;
}

.category-tree-fullscreen {
  min-height: 80vh;
}

.tree-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-item {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tree-item.is-hidden {
  display: none;
}

.tree-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--bs-border-color);
}

.tree-item .tree-title {
  font-weight: 600;
}

.tree-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color);
}

.tree-item.has-children .tree-toggle i {
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.tree-item.is-collapsed .tree-toggle i {
  transform: rotate(-90deg);
}

.tree-toggle:disabled {
  opacity: 0.4;
  cursor: default;
}

.tree-indent {
  width: calc(var(--indent) * 18px);
}

.tree-item-row .btn {
  min-width: auto;
}

@media (max-width: 576px) {
  .product-grid-card .product-actions {
    position: sticky;
    bottom: -1px;
    margin-top: 12px;
    padding-top: 10px;
    background: linear-gradient(180deg, rgba(246, 247, 251, 0) 0%, rgba(246, 247, 251, 0.9) 30%, rgba(246, 247, 251, 1) 100%);
  }

  html.theme-dark .product-grid-card .product-actions {
    background: linear-gradient(180deg, rgba(11, 18, 32, 0) 0%, rgba(11, 18, 32, 0.9) 30%, rgba(11, 18, 32, 1) 100%);
  }
}

@media (max-width: 576px) {
  .toolbox-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1030;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  }
}

@media (max-width: 576px) {
  .theme-toggle-text {
    display: none;
  }
}
