/**
 * Sidebar polish — sectioned ERP nav, strong category boxes, soft active state, icon-rail.
 * Module accents kept subtle for remaining top-level modules only.
 */

/* —— Global polish —— */
.side-bar {
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.04);
  transition: width 0.2s ease;
}

#side-bar {
  padding-top: 0.35rem !important;
  padding-bottom: 1rem !important;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}

#side-bar > a.sb-item,
#side-bar > div {
  margin-block: 0.05rem;
}

#side-bar a.theme-sidebar-hover,
#side-bar a.drop_down {
  border-radius: 0.5rem;
  letter-spacing: 0.01em;
  border-inline-start: 2px solid transparent;
}

#side-bar a.theme-sidebar-active,
#side-bar a.drop_down.theme-sidebar-active {
  border-inline-start-color: currentColor;
  font-weight: 500;
}

#side-bar .chiled {
  margin-top: 0.2rem !important;
  margin-bottom: 0.3rem !important;
}

/* —— Section groups (boxed categories) —— */
#side-bar .sb-section-group {
  --sb-sec-fg: #334155;
  --sb-sec-hdr-bg: #e2e8f0;
  --sb-sec-box-bg: #f8fafc;
  --sb-sec-border: #cbd5e1;
  margin-block: 0.55rem;
  padding: 0.4rem 0.35rem 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid var(--sb-sec-border);
  background: var(--sb-sec-box-bg);
}

#side-bar .sb-section-group:first-child {
  margin-top: 0.35rem;
}

#side-bar .sb-section-group.sb-sec-ops {
  --sb-sec-fg: #065f46;
  --sb-sec-hdr-bg: #d1fae5;
  --sb-sec-box-bg: #ecfdf5;
  --sb-sec-border: #a7f3d0;
}

#side-bar .sb-section-group.sb-sec-finance {
  --sb-sec-fg: #92400e;
  --sb-sec-hdr-bg: #fde68a;
  --sb-sec-box-bg: #fffbeb;
  --sb-sec-border: #fcd34d;
}

#side-bar .sb-section-group.sb-sec-reports {
  --sb-sec-fg: #3730a3;
  --sb-sec-hdr-bg: #c7d2fe;
  --sb-sec-box-bg: #eef2ff;
  --sb-sec-border: #a5b4fc;
}

#side-bar .sb-section-group.sb-sec-system {
  --sb-sec-fg: #1e293b;
  --sb-sec-hdr-bg: #cbd5e1;
  --sb-sec-box-bg: #f1f5f9;
  --sb-sec-border: #94a3b8;
}

/* —— Section labels (Operasional / Keuangan / …) —— */
#side-bar .sb-section-label {
  margin-top: 0;
  margin-bottom: 0.35rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sb-sec-fg, #334155);
  background: var(--sb-sec-hdr-bg, #e2e8f0);
  border-radius: 0.45rem;
  pointer-events: none;
  user-select: none;
}

/* Standalone labels (before JS wrap) — same accents via class on label */
#side-bar > .sb-section-label.sb-sec-ops,
#side-bar .sb-section-label.sb-sec-ops {
  --sb-sec-fg: #065f46;
  --sb-sec-hdr-bg: #d1fae5;
}

#side-bar > .sb-section-label.sb-sec-finance,
#side-bar .sb-section-label.sb-sec-finance {
  --sb-sec-fg: #92400e;
  --sb-sec-hdr-bg: #fde68a;
}

#side-bar > .sb-section-label.sb-sec-reports,
#side-bar .sb-section-label.sb-sec-reports {
  --sb-sec-fg: #3730a3;
  --sb-sec-hdr-bg: #c7d2fe;
}

#side-bar > .sb-section-label.sb-sec-system,
#side-bar .sb-section-label.sb-sec-system {
  --sb-sec-fg: #1e293b;
  --sb-sec-hdr-bg: #cbd5e1;
}

#side-bar > .sb-section-label:first-child {
  margin-top: 0.25rem;
}

/* —— Report / child cluster headers —— */
#side-bar .sb-child-section {
  margin-top: 0.55rem;
  margin-bottom: 0.1rem;
  padding: 0.15rem 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  pointer-events: none;
}

#side-bar .sb-child-section:first-child {
  margin-top: 0.15rem;
}

/* —— Soft module blocks (top-level only) —— */
#side-bar .sb-mod-wrap {
  --sb-accent: #64748b;
  border-radius: 0.5rem;
  border-inline-start: 2px solid color-mix(in srgb, var(--sb-accent) 55%, transparent);
  padding-inline-start: 0.1rem;
  margin-block: 0.1rem;
}

#side-bar .sb-mod-wrap > a.theme-sidebar-hover,
#side-bar .sb-mod-wrap > a.drop_down {
  background-color: transparent !important;
  color: #4b5563;
}

#side-bar .sb-mod-wrap > a svg,
#side-bar .sb-mod-wrap > a i {
  color: var(--sb-accent) !important;
}

#side-bar .sb-mod-wrap.sb-mod-accounting { --sb-accent: #0f766e; }
#side-bar .sb-mod-wrap.sb-mod-manufacturing { --sb-accent: #ea580c; }
#side-bar .sb-mod-wrap.sb-mod-pdt { --sb-accent: #4f46e5; }
#side-bar .sb-mod-wrap.sb-mod-connector { --sb-accent: #475569; }
#side-bar .sb-mod-wrap.sb-mod-mayar { --sb-accent: #059669; }
#side-bar .sb-mod-wrap.sb-mod-superadmin { --sb-accent: #0891b2; }
#side-bar .sb-mod-wrap.sb-mod-affiliate { --sb-accent: #0e7490; }
#side-bar .sb-mod-wrap.sb-mod-akenassistant { --sb-accent: #7c3aed; }
#side-bar .sb-mod-wrap.sb-mod-fixedasset { --sb-accent: #0369a1; }
#side-bar .sb-mod-wrap.sb-mod-duecollection { --sb-accent: #d97706; }

/* Unavailable feature menus (superadmin gray) */
.sb-item-disabled, a.sb-item-disabled, li.sb-item-disabled > a {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  color: #9ca3af !important;
}

/* —— Sticky search —— */
.side-bar .sb-search-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  background: inherit;
}

/* —— Icon rail (collapsed) —— */
.side-bar.sb-rail {
  width: 4.25rem !important;
  min-width: 4.25rem !important;
}

.side-bar.sb-rail .side-bar-heading,
.side-bar.sb-rail .sb-search-wrap,
.side-bar.sb-rail .sb-section-label,
.side-bar.sb-rail .sb-label,
.side-bar.sb-rail .sb-chevron,
.side-bar.sb-rail .chiled,
.side-bar.sb-rail #sidebar-no-results {
  display: none !important;
}

.side-bar.sb-rail #side-bar .sb-section-group {
  margin-block: 0.15rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
}

.side-bar.sb-rail #side-bar {
  padding-inline: 0.35rem !important;
}

.side-bar.sb-rail #side-bar a.sb-item,
.side-bar.sb-rail #side-bar a.drop_down {
  justify-content: center;
  padding-inline: 0.5rem;
}

.side-bar.sb-rail #side-bar a.sb-item .sb-icon,
.side-bar.sb-rail #side-bar a.drop_down svg:first-of-type,
.side-bar.sb-rail #side-bar a.sb-item > svg:first-of-type {
  margin: 0;
}

/* —— Dark mode —— */
html[data-color-mode="dark"] #side-bar .sb-section-group.sb-sec-ops {
  --sb-sec-fg: #6ee7b7;
  --sb-sec-hdr-bg: #064e3b;
  --sb-sec-box-bg: rgba(6, 78, 59, 0.35);
  --sb-sec-border: #047857;
}

html[data-color-mode="dark"] #side-bar .sb-section-group.sb-sec-finance {
  --sb-sec-fg: #fcd34d;
  --sb-sec-hdr-bg: #78350f;
  --sb-sec-box-bg: rgba(120, 53, 15, 0.35);
  --sb-sec-border: #b45309;
}

html[data-color-mode="dark"] #side-bar .sb-section-group.sb-sec-reports {
  --sb-sec-fg: #a5b4fc;
  --sb-sec-hdr-bg: #312e81;
  --sb-sec-box-bg: rgba(49, 46, 129, 0.4);
  --sb-sec-border: #4338ca;
}

html[data-color-mode="dark"] #side-bar .sb-section-group.sb-sec-system {
  --sb-sec-fg: #e2e8f0;
  --sb-sec-hdr-bg: #334155;
  --sb-sec-box-bg: rgba(51, 65, 85, 0.45);
  --sb-sec-border: #64748b;
}

html[data-color-mode="dark"] #side-bar .sb-section-label {
  color: var(--sb-sec-fg, #e2e8f0);
  background: var(--sb-sec-hdr-bg, #334155);
}

html[data-color-mode="dark"] #side-bar .sb-child-section {
  color: #6b7280;
}

html[data-color-mode="dark"] #side-bar .sb-mod-wrap {
  border-inline-start-color: color-mix(in srgb, var(--sb-accent) 70%, transparent);
}
