/* Modern sidebar layer. Scoped to the two application sidebars. */
:root {
  --sidebar-width: 264px;
  --sidebar-compact-width: 82px;
  --sidebar-surface: #fff;
  --sidebar-ink: #273142;
  --sidebar-muted: #8a94a6;
  --sidebar-line: #edf0f4;
}

#accordionSidebar.sidebar {
  width: var(--sidebar-width) !important;
  min-width: var(--sidebar-width);
  height: 100vh;
  min-height: 100vh;
  position: sticky;
  top: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--sidebar-surface) !important;
  border-right: 1px solid var(--sidebar-line);
  box-shadow: 8px 0 30px rgba(31, 45, 61, .07) !important;
  z-index: 1035;
  transition: width .25s ease, min-width .25s ease, transform .25s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#accordionSidebar::-webkit-scrollbar,
#sidebar::-webkit-scrollbar,
#sidebar .mCustomScrollBox::-webkit-scrollbar { display: none; width: 0; height: 0; }

#sidebar,
#sidebar .mCustomScrollBox {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#sidebar .mCSB_scrollTools { display: none !important; }
#sidebar .mCSB_inside > .mCSB_container { margin-right: 0 !important; }

#accordionSidebar .sidebar-brand {
  height: 4.375rem !important;
  min-height: 4.375rem;
  flex: 0 0 4.375rem;
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 8px 18px;
  justify-content: flex-start !important;
  gap: 11px;
  color: var(--app-theme-text-color, #fff) !important;
  background: var(--app-theme-color, #126262) !important;
  text-align: left;
  border-bottom: 1px solid rgba(var(--app-theme-text-rgb, 255,255,255), .18);
  box-shadow: none;
}

#accordionSidebar .sidebar-brand-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: rgba(var(--app-theme-text-rgb, 255,255,255), .14);
  background: color-mix(in srgb, var(--app-theme-color, #126262) 76%, var(--app-theme-text-color, #fff) 24%);
  border: 1px solid rgba(var(--app-theme-text-rgb, 255,255,255), .34);
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(31,45,61,.16);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--app-theme-color, #126262) 35%, transparent);
}

#accordionSidebar .sidebar-brand-icon img {
  display: block;
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  object-fit: contain;
}

.sidebar-brand-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
}

.sidebar-brand-name {
  display: block;
  overflow: hidden;
  color: var(--app-theme-text-color, #fff);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-tagline {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--app-theme-text-color, #fff);
  opacity: .76;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar .sidebar-header { background: var(--app-theme-color, #126262) !important; border-bottom: 1px solid rgba(var(--app-theme-text-rgb, 255,255,255), .18); }
#sidebar .sidebar-header .sidebar-brand { justify-content: flex-start; gap: 10px; min-height: 50px; padding: 6px 48px 6px 8px; color: var(--app-theme-text-color, #fff); }
#sidebar .sidebar-header .sidebar-brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(var(--app-theme-text-rgb, 255,255,255), .14);
  background: color-mix(in srgb, var(--app-theme-color, #126262) 76%, var(--app-theme-text-color, #fff) 24%);
  border: 1px solid rgba(var(--app-theme-text-rgb, 255,255,255), .34);
  border-radius: 11px;
}
#sidebar .sidebar-header .sidebar-brand-icon img { width: 28px; height: 28px; object-fit: contain; }
#sidebar #dismiss { color: #657086; background: #f2f5f8; }
#sidebar #dismiss:hover { color: var(--app-theme-color, #126262); background: #e9eef4; }

#accordionSidebar .sidebars { padding: 2px 10px 14px; }
#accordionSidebar hr.sidebar-divider { border-color: var(--sidebar-line); margin: 8px 4px !important; }
#accordionSidebar .sidebar-heading {
  padding: 12px 11px 5px;
  color: #a0a8b7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

#accordionSidebar .nav-item { margin: 3px 0; }
#accordionSidebar .nav-item .nav-link {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  color: #596579;
  border-radius: 11px;
  font-weight: 500;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

#accordionSidebar .nav-item .nav-link:hover {
  color: var(--app-theme-color, #126262);
  background: #f3f7f7;
  transform: translateX(2px);
}

#accordionSidebar .nav-item .nav-link i {
  width: 22px;
  margin: 0;
  color: #98a2b2;
  text-align: center;
  font-size: 16px;
  transition: color .18s ease;
}

#accordionSidebar .nav-item .nav-link:hover i,
#accordionSidebar .nav-item:has(.collapse-item.active) > .nav-link i { color: var(--app-theme-color, #126262); }

#accordionSidebar .nav-item:has(.collapse-item.active) > .nav-link,
#accordionSidebar .nav-item .nav-link[aria-expanded="true"] { color: var(--app-theme-color, #126262); background: #f3f7f7; }

#accordionSidebar .nav-item .nav-link[data-toggle="collapse"]::after {
  margin-left: auto;
  float: none;
  font-size: 12px;
  transition: transform .2s ease;
}

#accordionSidebar .nav-item .nav-link[data-toggle="collapse"]:not(.collapsed)::after { transform: rotate(180deg); }
#accordionSidebar .nav-item .collapse, #accordionSidebar .nav-item .collapsing { margin: 3px 0 5px 33px; }
#accordionSidebar .nav-item .collapse .collapse-inner,
#accordionSidebar .nav-item .collapsing .collapse-inner {
  margin: 0;
  padding: 5px;
  background: #f8f9fb !important;
  border-left: 2px solid #e4e9ef;
  border-radius: 0 10px 10px 0;
  box-shadow: none;
}

#accordionSidebar .collapse-header { display: none; }
#accordionSidebar .collapse-item {
  padding: 8px 10px !important;
  margin: 1px 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 8px !important;
  font-size: 12.5px;
}

#accordionSidebar .collapse-item:hover { color: var(--app-theme-color, #126262) !important; background: #fff !important; }
#accordionSidebar .collapse-item.active {
  color: var(--app-theme-color, #126262) !important;
  background: #fff;
  box-shadow: 0 2px 8px rgba(31,45,61,.07);
}

#accordionSidebar .version { padding: 8px 14px 18px; text-align: center; }
/* Cashier drawer uses the same visual language without changing its menu logic. */
#sidebar { background: var(--sidebar-surface) !important; color: var(--sidebar-ink) !important; }
#sidebar .sidebar-header { padding: 10px 16px; background: var(--app-theme-color, #126262) !important; }
#sidebar #dismiss { top: 18px; right: 14px; color: #657086; border-radius: 10px; background: #f2f5f8; }
#sidebar ul.components { padding: 4px 12px 20px; border: 0; }
#sidebar ul.components > li { margin: 3px 0; }
#sidebar ul.components li a { padding: 11px 13px; border-radius: 10px; font-size: 14px; }
#sidebar ul.components li a:hover { color: var(--app-theme-color, #126262); background: #f3f7f7; }
#sidebar ul.components li.active > a { color: var(--app-theme-color, #126262); background: #eef6f5; filter: none; font-weight: 700; }
#sidebar ul.components ul a { padding-left: 26px; font-size: 13px; }

@media (min-width: 769px) {
  #accordionSidebar.sidebar.toggled { width: var(--sidebar-compact-width) !important; min-width: var(--sidebar-compact-width); }
  #accordionSidebar.sidebar.toggled .nav-item .nav-link { width: 62px; justify-content: center; padding: 11px; }
  #accordionSidebar.sidebar.toggled .nav-item .nav-link i { margin: 0; float: none; }
  #accordionSidebar.sidebar.toggled .nav-item .collapse { left: 70px; }
  #accordionSidebar.sidebar.toggled .sidebar-brand { justify-content: center !important; padding: 8px; }
  #accordionSidebar.sidebar.toggled .sidebar-brand-copy { display: none; }
}

@media (max-width: 768px) {
  body.sidebar-mobile-open { overflow: hidden; }
  #accordionSidebar.sidebar,
  #accordionSidebar.sidebar.toggled {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px) !important;
    min-width: min(86vw, 320px);
    transform: translateX(-105%);
    box-shadow: 18px 0 45px rgba(18, 31, 53, .22) !important;
  }
  #accordionSidebar.sidebar.toggled { transform: translateX(0); }
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: rgba(15, 23, 42, .48);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
  }
  body.sidebar-mobile-open::after { opacity: 1; visibility: visible; }
  #accordionSidebar.sidebar.toggled .nav-item { margin-left: 0; }
  #accordionSidebar.sidebar.toggled .nav-item .nav-link { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #accordionSidebar, #accordionSidebar *, #sidebar, #sidebar * { transition-duration: .01ms !important; }
}
