/* Two-level desktop navigation: module rail (Gestão Chef / ERP) + module panel.
   The ERP panel keeps its own classes in erp.css; this file styles the rail
   switcher and the Gestão Chef panel with the same geometry. */
.module-panel, .module-brand-header { display: none; }

.module-navigation {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .625rem 0 0;
}
.module-navigation .module-menu-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  min-height: 4rem;
  padding: 0 1rem;
  border-radius: .625rem;
  color: #2f3953;
  font-size: .96875rem;
  font-weight: 500;
}
.module-navigation .module-menu-icon { flex: none; width: 1.625rem; height: 1.625rem; }
.module-navigation .module-menu-item:hover { color: #45b336; }
.module-navigation .module-menu-item[aria-current="page"] { background: #e7f3e7; color: #45b336; }
.module-navigation .module-menu-item:focus-visible { outline: 2px solid #45b336; outline-offset: -2px; }

@media (min-width: 721px) {
  html[data-module-workspace] { --module-menu-width: clamp(232px, 26vw, 17rem); }
  html[data-module-workspace] .sidebar-symbol { display: none; }
  html[data-module-workspace].sidebar-collapsed .main-wrap {
    margin-left: calc(80px + var(--module-menu-width));
  }
  .module-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 80px;
    width: var(--module-menu-width);
    z-index: 9;
    overflow-y: auto;
    padding: 106px 1.25rem 1.125rem;
    background: #fff;
    border-inline-end: 1px solid #f0f0f0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }
  .module-panel:hover { scrollbar-color: #d5dbd6 transparent; }
  .module-brand-header {
    position: fixed;
    inset: 0 auto auto 0;
    z-index: 11;
    width: calc(80px + var(--module-menu-width));
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid #f2f2f2;
    border-inline-end: 1px solid #f0f0f0;
  }
  .module-brand-header a { display: block; border-radius: 10px; }
  .module-brand-header img { display: block; width: 188px; height: auto; }
  .module-brand-header .module-brand-dark,
  html[data-app-theme="dark"] .module-brand-header .module-brand-light { display: none; }
  html[data-app-theme="dark"] .module-brand-header { background: #202124; border-color: #34373d; }
  html[data-app-theme="dark"] .module-brand-header .module-brand-dark { display: block; }
  html[data-app-theme="dark"] .module-panel { background: #202124; border-color: #34373d; }
  html[data-app-theme="dark"] .module-navigation .module-menu-item { color: #d7d9de; }
  html[data-app-theme="dark"] .module-navigation .module-menu-item[aria-current="page"] { background: #24382a; color: #6fd062; }

  /* Rail switcher: icon with a short caption underneath. */
  .sidebar .sidebar-rail .module-switcher { display: flex; flex-direction: column; gap: 10px; padding: 20px 12px; }
  .sidebar .sidebar-rail .module-switch {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 64px;
    padding: 8px 0;
    border-radius: 14px;
    color: #4a5466;
  }
  .sidebar .sidebar-rail .module-switch > span:not(.nav-icon) {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
  }
  /* Legacy rules give .nav-icon a fixed 24px box and active spans an 8px right
     margin; both pull the switch content off-centre. */
  .sidebar .sidebar-rail .module-switch > span { margin: 0; }
  .sidebar .sidebar-rail .module-switch .nav-icon { width: auto; height: auto; }
  .sidebar .sidebar-rail .module-switch .icon { width: 24px; height: 24px; }
  /* The brand glyph is airier than solid glyphs like "building"; enlarge it to match optically. */
  .sidebar .sidebar-rail .module-switch .icon.module-switch-brand { width: 30px; height: 30px; margin: -3px 0; }
  .sidebar .sidebar-rail .module-switch:hover { background: #f2f8f2; color: #2e9b37; }
  .sidebar .sidebar-rail .module-switch.active { background: #e7f3e7; color: #2e9b37; }
  .sidebar .sidebar-rail .module-switch:focus-visible { outline: 2px solid #45b336; outline-offset: -2px; }
  html[data-app-theme="dark"] .sidebar .sidebar-rail .module-switch { color: #b9bcc4; }
  html[data-app-theme="dark"] .sidebar .sidebar-rail .module-switch.active { background: #24382a; color: #6fd062; }
}

/* Collapse button: shrinks the module panel (Gestão Chef or ERP) to its icons. */
.menu-collapse-toggle { display: none; }
@media (min-width: 721px) {
  html[data-module-workspace].menu-compact { --module-menu-width: 88px; }
  html[data-erp-workspace].menu-compact { --erp-menu-width: 88px; }
  html:is([data-module-workspace], [data-erp-workspace]):not([data-embed]) .menu-collapse-toggle {
    display: grid;
    place-items: center;
    position: fixed;
    top: 72px;
    left: calc(80px + var(--module-menu-width) - 16px);
    z-index: 12;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e3e6e3;
    border-radius: 50%;
    background: #fff;
    color: #4a5466;
    box-shadow: 0 2px 8px #1f2a2014;
    cursor: pointer;
  }
  html[data-erp-workspace]:not([data-embed]) .menu-collapse-toggle { left: calc(80px + var(--erp-menu-width) - 16px); }
  .menu-collapse-toggle .icon { width: 16px; height: 16px; transform: rotate(180deg); }
  html.menu-compact .menu-collapse-toggle .icon { transform: none; }
  .menu-collapse-toggle:hover { color: #2e9b37; border-color: #b9dcb9; background: #f2f8f2; }
  .menu-collapse-toggle:focus-visible { outline: 2px solid #45b336; outline-offset: 2px; }
  html[data-app-theme="dark"] .menu-collapse-toggle { background: #202124; border-color: #34373d; color: #b9bcc4; }

  /* Compact panel: icons centred, names kept for screen readers. */
  html.menu-compact .module-panel, html.menu-compact .erp-sidebar { padding-left: .75rem; padding-right: .75rem; overflow-x: hidden; }
  html.menu-compact .module-brand-header img, html.menu-compact .erp-brand-header img { width: 136px; }
  html.menu-compact .module-navigation .module-menu-item,
  html.menu-compact .erp-navigation .erp-menu-item { justify-content: center; gap: 0; padding: 0; }
  html.menu-compact .module-navigation .module-menu-item > span,
  html.menu-compact .erp-navigation .erp-menu-item > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  html.menu-compact .erp-navigation .erp-menu-group > summary::after,
  html.menu-compact .erp-navigation .erp-submenu { display: none; }
}
@media (min-width: 721px) and (prefers-reduced-motion: no-preference) {
  html.menu-ready .module-panel, html.menu-ready .erp-sidebar, html.menu-ready .module-brand-header,
  html.menu-ready .erp-brand-header, html.menu-ready .main-wrap, html.menu-ready .menu-collapse-toggle {
    transition: width 220ms ease, left 220ms ease, margin-left 220ms ease;
  }
}

/* Compact menu: floating list with the options of the icon under the pointer or focus. */
.menu-flyout { display: none; }
@media (min-width: 721px) {
  html.menu-compact .menu-flyout:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: fixed;
    z-index: 40;
    min-width: 190px;
    max-width: 280px;
    padding: 6px;
    border: 1px solid #ebedeb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 28px #1f2a2024, 0 2px 6px #1f2a2014;
  }
  .menu-flyout-title { margin: 4px 10px 6px; color: #8a909c; font-size: .75rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
  .menu-flyout a {
    display: flex;
    align-items: center;
    min-height: 2.375rem;
    padding: 0 .75rem;
    border-radius: 8px;
    color: #2f3953;
    font-size: .90625rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
  }
  .menu-flyout.is-single a { min-height: 2.25rem; font-weight: 600; }
  .menu-flyout a:hover, .menu-flyout a[aria-current="page"] { color: #45b336; background: #f2f8f2; }
  .menu-flyout a:focus-visible { outline: 2px solid #45b336; outline-offset: -2px; }
  html[data-app-theme="dark"] .menu-flyout:not([hidden]) { background: #202124; border-color: #34373d; box-shadow: 0 10px 28px #0008; }
  html[data-app-theme="dark"] .menu-flyout a { color: #d6d8de; }
  html[data-app-theme="dark"] .menu-flyout a:hover, html[data-app-theme="dark"] .menu-flyout a[aria-current="page"] { color: #6fcf62; background: #2a2d31; }
}
@media (min-width: 721px) and (prefers-reduced-motion: no-preference) {
  html.menu-compact .menu-flyout:not([hidden]) { animation: menu-flyout-in 140ms ease-out; }
  @keyframes menu-flyout-in { from { opacity: 0; transform: translateX(-4px); } }
}
