/* ---------------------------------------------------------------
   ERP Shell — sidebar + topbar layout
   --------------------------------------------------------------- */

:root {
  --shell-sidebar-bg: #0B1220;
  --shell-sidebar-bg-hover: rgba(255, 255, 255, 0.07);
  --shell-sidebar-bg-active: rgba(16, 185, 129, 0.14);
  --shell-sidebar-border: rgba(255, 255, 255, 0.08);
  --shell-sidebar-text: #e2e8f0;        /* slate-200, was #cbd5e1 */
  --shell-sidebar-text-dim: #94a3b8;    /* slate-400, was #64748b — too dim on near-black */
  --shell-sidebar-text-strong: #ffffff; /* pure white on hover/active for max contrast */
  --shell-accent: #10b981;
  --shell-accent-hover: #34d399;
  --shell-topbar-bg: #ffffff;
  --shell-topbar-border: #e5e7eb;
  --shell-content-bg: #f6f7f9;
  --shell-sidebar-width-collapsed: 64px;
  --shell-sidebar-width-expanded: 248px;
  --shell-topbar-height: 56px;
}

/* ---------- Body / overall layout ---------- */

body.erp-shell-body {
  margin: 0;
  background: var(--shell-content-bg);
  color: #0f172a;
  font-family: "Roboto Flex", "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

.erp-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.erp-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--shell-sidebar-width-collapsed);
  background: var(--shell-sidebar-bg);
  color: var(--shell-sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width 200ms cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  border-right: 1px solid var(--shell-sidebar-border);
}

/* Defeat any global a {} / button {} colors from older CSS files
   (erp-standard.css, erp-bootstrap-layout.css, Bootstrap defaults). */
.erp-sidebar a,
.erp-sidebar button,
.erp-sidebar i {
  color: inherit;
}
.erp-sidebar a:hover,
.erp-sidebar a:focus,
.erp-sidebar a:visited {
  color: inherit;
  text-decoration: none;
}

/* Hover-to-expand on desktop */
@media (min-width: 992px) {
  .erp-sidebar:hover,
  .erp-sidebar:focus-within,
  .erp-sidebar.is-open {
    width: var(--shell-sidebar-width-expanded);
    box-shadow: 0 12px 40px rgba(2, 6, 23, 0.18);
  }
}

/* Mobile: hidden by default, slid in via .is-open */
@media (max-width: 991.98px) {
  .erp-sidebar {
    width: var(--shell-sidebar-width-expanded);
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }
  .erp-sidebar.is-open {
    transform: translateX(0);
  }
}

/* Brand block */
.erp-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--shell-topbar-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--shell-sidebar-border);
  white-space: nowrap;
  flex-shrink: 0;
}

.erp-sidebar__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--shell-accent) 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.erp-sidebar__brand-text {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--shell-sidebar-text-strong);
  opacity: 0;
  transition: opacity 200ms ease 60ms;
}

.erp-sidebar__brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #94a3b8;       /* slate-400 — readable on near-black */
  text-transform: uppercase;
  margin-top: 1px;
}

/* Nav scroll area */
.erp-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.erp-sidebar__nav::-webkit-scrollbar { width: 6px; }
.erp-sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.erp-sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.erp-sidebar__nav-list { list-style: none; padding: 0; margin: 0; }

.erp-sidebar__group { margin-bottom: 2px; }

/* Section label (visible only when expanded) */
.erp-sidebar__section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #94a3b8;
  padding: 14px 14px 6px;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 200ms ease 60ms;
  list-style: none;
  position: relative;
}

/* When collapsed, replace each section label with a subtle horizontal divider
   so the icon stack still has visible group rhythm. */
@media (min-width: 992px) {
  .erp-sidebar:not(:hover):not(:focus-within):not(.is-open) .erp-sidebar__section-label {
    padding: 12px 12px 6px;
    height: 1px;
    overflow: hidden;
    color: transparent;
  }
  .erp-sidebar:not(:hover):not(:focus-within):not(.is-open) .erp-sidebar__section-label::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    height: 1px;
    background: var(--shell-sidebar-border);
  }
  /* Skip the divider for the very first section label (right under the brand). */
  .erp-sidebar:not(:hover):not(:focus-within):not(.is-open) .erp-sidebar__nav-list > .erp-sidebar__section-label:first-child::after {
    display: none;
  }
}

/* Module item */
.erp-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  margin: 1px 6px;
  border-radius: 8px;
  color: var(--shell-sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: calc(100% - 12px);
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}

.erp-sidebar__item:hover,
.erp-sidebar__item:focus-visible {
  background: var(--shell-sidebar-bg-hover);
  color: var(--shell-sidebar-text-strong);
  outline: none;
}
.erp-sidebar__item:focus-visible {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.45);
}

.erp-sidebar__item.is-active,
.erp-sidebar__group.has-active-child > .erp-sidebar__item {
  background: var(--shell-sidebar-bg-active);
  color: var(--shell-sidebar-text-strong);
}

.erp-sidebar__item.is-active::before,
.erp-sidebar__group.has-active-child > .erp-sidebar__item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--shell-accent);
  border-radius: 0 3px 3px 0;
}

.erp-sidebar__icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  border-radius: 6px;
  transition: background-color 140ms ease, color 140ms ease;
}
.erp-sidebar__group.has-active-child > .erp-sidebar__item .erp-sidebar__icon,
.erp-sidebar__item.is-active .erp-sidebar__icon {
  color: var(--shell-accent);
}

.erp-sidebar__label {
  opacity: 0;
  transition: opacity 200ms ease 60ms;
  flex: 1;
}

.erp-sidebar__chevron {
  font-size: 10px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 200ms ease 60ms, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--shell-sidebar-text-dim);
}

.erp-sidebar__group.is-open > .erp-sidebar__item .erp-sidebar__chevron {
  transform: rotate(90deg);
  color: var(--shell-sidebar-text-strong);
}

.erp-sidebar__group.is-open > .erp-sidebar__item {
  color: var(--shell-sidebar-text-strong);
}

/* Reveal labels when expanded */
.erp-sidebar:hover .erp-sidebar__brand-text,
.erp-sidebar:hover .erp-sidebar__section-label,
.erp-sidebar:hover .erp-sidebar__label,
.erp-sidebar:hover .erp-sidebar__chevron,
.erp-sidebar:focus-within .erp-sidebar__label,
.erp-sidebar:focus-within .erp-sidebar__brand-text,
.erp-sidebar:focus-within .erp-sidebar__section-label,
.erp-sidebar:focus-within .erp-sidebar__chevron,
.erp-sidebar.is-open .erp-sidebar__brand-text,
.erp-sidebar.is-open .erp-sidebar__section-label,
.erp-sidebar.is-open .erp-sidebar__label,
.erp-sidebar.is-open .erp-sidebar__chevron {
  opacity: 1;
}

/* Collapsed-mode tooltip: show the item label as a small pill to the right
   of the icon when hovering the row in collapsed mode. Desktop only. */
@media (min-width: 992px) {
  .erp-sidebar__item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
    z-index: 1041;
  }
  .erp-sidebar:not(:hover):not(:focus-within):not(.is-open) .erp-sidebar__item:hover::after,
  .erp-sidebar:not(:hover):not(:focus-within):not(.is-open) .erp-sidebar__item:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    transition: opacity 120ms ease, transform 120ms ease, visibility 0s;
  }
  /* Hide tooltip once the sidebar itself expands — labels become visible instead. */
  .erp-sidebar:hover .erp-sidebar__item::after,
  .erp-sidebar:focus-within .erp-sidebar__item::after,
  .erp-sidebar.is-open .erp-sidebar__item::after {
    display: none;
  }
}

/* Submenu (collapsible inline list) */
.erp-sidebar__submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 4px 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
/* Vertical connector line — only visible when sidebar is expanded AND
   group is open. Anchors the sublinks to their parent icon. */
.erp-sidebar:hover .erp-sidebar__group.is-open > .erp-sidebar__submenu::before,
.erp-sidebar:focus-within .erp-sidebar__group.is-open > .erp-sidebar__submenu::before,
.erp-sidebar.is-open .erp-sidebar__group.is-open > .erp-sidebar__submenu::before {
  content: "";
  position: absolute;
  left: 31px;
  top: 4px;
  bottom: 8px;
  width: 1px;
  background: var(--shell-sidebar-border);
}

/* Submenus open only when sidebar is hovered/focused AND group is marked open. */
.erp-sidebar:hover .erp-sidebar__group.is-open > .erp-sidebar__submenu,
.erp-sidebar:focus-within .erp-sidebar__group.is-open > .erp-sidebar__submenu,
.erp-sidebar.is-open .erp-sidebar__group.is-open > .erp-sidebar__submenu {
  max-height: 1000px;
}

/* Suppress submenu animation on initial page load. */
.erp-sidebar--no-anim .erp-sidebar__submenu,
.erp-sidebar--no-anim .erp-sidebar__chevron {
  transition: none !important;
}

.erp-sidebar__sublink {
  display: block;
  padding: 6px 14px 6px 46px;
  color: var(--shell-sidebar-text-dim);
  text-decoration: none;
  font-size: 12.5px;
  border-radius: 6px;
  margin: 1px 6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  position: relative;
  transition: color 140ms ease, background-color 140ms ease;
}

.erp-sidebar__sublink:hover,
.erp-sidebar__sublink:focus-visible {
  background: var(--shell-sidebar-bg-hover);
  color: var(--shell-sidebar-text-strong);
  outline: none;
}

.erp-sidebar__sublink.is-active {
  background: var(--shell-sidebar-bg-active);
  color: var(--shell-sidebar-text-strong);
}

.erp-sidebar__sublink.is-active::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--shell-accent);
}

/* Footer in sidebar */
.erp-sidebar__footer {
  padding: 10px 12px;
  border-top: 1px solid var(--shell-sidebar-border);
  flex-shrink: 0;
  font-size: 11px;
  color: var(--shell-sidebar-text-dim);
  white-space: nowrap;
  overflow: hidden;
}

/* ---------- Topbar ---------- */

.erp-topbar-shell {
  position: sticky;
  top: 0;
  height: var(--shell-topbar-height);
  background: var(--shell-topbar-bg);
  border-bottom: 1px solid var(--shell-topbar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  z-index: 1030;
}

.erp-topbar-shell__hamburger {
  display: none;
  background: transparent;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
}
.erp-topbar-shell__hamburger:hover { background: #f1f5f9; }

@media (max-width: 991.98px) {
  .erp-topbar-shell__hamburger { display: inline-flex; }
}

.erp-topbar-shell__title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  flex: 1;
  letter-spacing: -0.01em;
}

.erp-topbar-shell__title-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
  margin-top: 1px;
  letter-spacing: 0;
}

.erp-topbar-shell__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.erp-topbar-shell .btn-create {
  background: #0f172a;
  color: #fff;
  border: 1px solid #0f172a;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.erp-topbar-shell .btn-create:hover {
  background: #1e293b;
  color: #fff;
}

.erp-topbar-shell .btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.erp-topbar-shell .btn-icon:hover { background: #f8fafc; }

.erp-topbar-shell .btn-user {
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 5px 10px 5px 6px;
  font-size: 13px;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.erp-topbar-shell .btn-user:hover { background: #f8fafc; }

.erp-topbar-shell .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

/* ---------- Content ---------- */

.erp-shell__main {
  flex: 1;
  min-width: 0;
  margin-left: var(--shell-sidebar-width-collapsed);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (max-width: 991.98px) {
  .erp-shell__main { margin-left: 0; }
}

.erp-shell__content {
  flex: 1;
  padding: 20px 24px 32px;
}

.erp-shell__footer {
  position: relative;
  padding: 14px 24px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  border-top: 1px solid var(--shell-topbar-border);
  background:
    linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.erp-shell__footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(99, 102, 241, 0.55) 30%,
    rgba(168, 85, 247, 0.55) 70%,
    transparent 100%);
}
.erp-shell__footer-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.erp-shell__footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-weight: 500;
}
.erp-shell__footer-mark b {
  color: #312e81;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.erp-shell__footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(168,85,247,0.10));
  border: 1px solid rgba(168,85,247,0.30);
  border-radius: 999px;
  color: #5b21b6;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.erp-shell__footer-pill i {
  color: #7c3aed;
  font-size: 9px;
}
.erp-shell__footer-dot {
  width: 3px; height: 3px;
  background: #cbd5e1;
  border-radius: 50%;
}

/* Mobile backdrop */
.erp-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 1035;
}
.erp-sidebar-backdrop.is-open { display: block; }

/* Print: hide shell */
@media print {
  .erp-sidebar,
  .erp-topbar-shell,
  .erp-topnav,
  .erp-shell__footer,
  .erp-sidebar-backdrop { display: none !important; }
  .erp-shell__main { margin-left: 0 !important; }
  .erp-shell__content { padding: 0 !important; }
}

/* =================================================================
   Topnav mode — pages opt in via body class .erp-shell-body--topnav.
   Sidebar and inner topbar are hidden; the new horizontal mega-nav
   takes their place.
   ================================================================= */

/* Hide the inner topbar (Create + user) since the new topnav owns those.
   Sidebar stays visible — pushed below the 60px topnav. The sidebar's brand
   block is hidden to avoid the double "N" collision with the topnav brand. */
.erp-shell-body--topnav .erp-topbar-shell { display: none !important; }

.erp-shell-body--topnav .erp-sidebar { top: 60px; }
.erp-shell-body--topnav .erp-sidebar__brand { display: none !important; }
.erp-shell-body--topnav .erp-sidebar__nav { padding-top: 16px; }
.erp-shell-body--topnav .erp-shell__content { padding: 24px 28px 40px; }

/* On mobile, the topnav drops its nav and becomes a compact header. The
   sidebar slides in as a drawer (full primary nav). Bring its brand back so
   the drawer has a visible header. */
@media (max-width: 991.98px) {
  .erp-shell-body--topnav .erp-sidebar { top: 0; }
  .erp-shell-body--topnav .erp-sidebar__brand { display: flex !important; }
  .erp-shell-body--topnav .erp-sidebar__nav { padding-top: 12px; }
}

.erp-topnav {
  position: sticky;
  top: 0;
  z-index: 1050;
  background: var(--shell-sidebar-bg);
  color: var(--shell-sidebar-text);
  border-bottom: 1px solid var(--shell-sidebar-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: box-shadow 200ms ease;
}
.erp-topnav.is-scrolled {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04),
              0 10px 24px rgba(2, 6, 23, 0.30);
}

.erp-topnav__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 60px;
  width: 100%;
}

.erp-topnav__hamburger {
  display: none;
  background: transparent;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--shell-sidebar-text);
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
  margin-right: 4px;
}
.erp-topnav__hamburger:hover,
.erp-topnav__hamburger:focus-visible {
  background: var(--shell-sidebar-bg-hover);
  color: var(--shell-sidebar-text-strong);
  outline: none;
}
@media (max-width: 991.98px) {
  .erp-topnav__hamburger { display: inline-flex; }
}

.erp-topnav__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  padding-right: 20px;
  position: relative;
}
.erp-topnav__brand:hover { color: inherit; text-decoration: none; }
.erp-topnav__brand::after {
  content: "";
  position: absolute;
  right: 0;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: var(--shell-sidebar-border);
}

.erp-topnav__brand-mark {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--shell-accent) 0%, #059669 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 15px;
}

.erp-topnav__brand-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--shell-sidebar-text-strong);
  line-height: 1.1;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
}
.erp-topnav__brand-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-top: 2px;
}

.erp-topnav__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  justify-content: center;
  margin-left: 24px;
}

.erp-topnav__group { position: relative; }

.erp-topnav__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--shell-sidebar-text);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background-color 140ms ease, color 140ms ease;
}
.erp-topnav__btn i {
  font-size: 9px;
  opacity: 0.7;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.erp-topnav__btn:hover,
.erp-topnav__group.is-open .erp-topnav__btn,
.erp-topnav__group.has-active-child .erp-topnav__btn {
  background: var(--shell-sidebar-bg-hover);
  color: var(--shell-sidebar-text-strong);
}
.erp-topnav__group.has-active-child .erp-topnav__btn::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--shell-accent);
  border-radius: 999px;
}
.erp-topnav__group.is-open .erp-topnav__btn i { transform: rotate(180deg); }

.erp-topnav__mega {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 640px;
  max-width: 92vw;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.18),
              0 4px 8px rgba(2, 6, 23, 0.06);
  padding: 18px 20px 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.985);
  transform-origin: top left;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 180ms;
}
.erp-topnav__mega::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 12px; height: 12px;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(45deg);
}
.erp-topnav__group:last-child .erp-topnav__mega::before { left: auto; right: 22px; }
.erp-topnav__group.is-open .erp-topnav__mega {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.erp-topnav__mega-grid {
  display: grid;
  gap: 18px 24px;
}
.erp-topnav__mega section h6 {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  padding-bottom: 6px;
  border-bottom: 1px solid #eef2f7;
}
.erp-topnav__mega section a {
  display: block;
  padding: 5px 8px;
  margin-left: -8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  line-height: 1.35;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease;
}
.erp-topnav__mega section a:hover {
  background: #f1f5f9;
  color: var(--shell-accent);
}
.erp-topnav__mega section a.is-active {
  background: #ecfdf5;
  color: #047857;
  font-weight: 600;
  position: relative;
}
.erp-topnav__mega section a.is-active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--shell-accent);
  border-radius: 2px;
}

/* Right-anchor mega for the last group to keep it on screen. */
.erp-topnav__group:last-child .erp-topnav__mega { left: auto; right: 0; }

.erp-topnav__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.erp-topnav__create {
  background: var(--shell-accent);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.erp-topnav__create:hover { background: #0ea371; color: #ffffff; }
.erp-topnav__create::after { display: none; }

.erp-topnav__user {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--shell-sidebar-text-strong);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.erp-topnav__user:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.erp-topnav__user::after { color: #94a3b8; }

.erp-topnav__avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  text-transform: uppercase;
}

@media (max-width: 991.98px) {
  .erp-topnav__nav { display: none; }
  .erp-topnav__inner { gap: 12px; }
}
@media (max-width: 1280px) {
  .erp-topnav__mega { min-width: 520px; }
  .erp-topnav__mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
