:root { --sidebar-collapsed: 68px; }
.sidebar.sidebar-modern { background:#1A1D2E; color:#C9CBD6; padding:14px 10px; height:100dvh; overflow-x:hidden; overflow-y:auto; box-shadow:none; font-size:14px; scrollbar-width:thin; scrollbar-color:transparent transparent; z-index:45; }
.sidebar.sidebar-modern:hover, .sidebar.sidebar-modern:focus-within { scrollbar-color:#2A2E45 transparent; }
.sidebar-modern::-webkit-scrollbar { width:6px; }
.sidebar-modern::-webkit-scrollbar-thumb { background:transparent; border-radius:9px; }
.sidebar-modern:hover::-webkit-scrollbar-thumb, .sidebar-modern:focus-within::-webkit-scrollbar-thumb { background:#2A2E45; }
.sidebar.sidebar-modern .brand-row { display:flex; height:44px; gap:10px; margin:0 0 14px; }
.sidebar.sidebar-modern .brand-mark { display:grid; width:32px; height:32px; border-radius:9px; background:#534AB7; font-size:16px; font-weight:600; color:#fff; }
.sidebar.sidebar-modern .brand-text { font-size:16px; font-weight:600; color:#fff; white-space:nowrap; }
.sidebar.sidebar-modern .menu-toggle { position:static; display:grid; place-items:center; margin-left:auto; width:28px; height:30px; padding:0; border:0; background:transparent; color:#6B6F85; border-radius:6px; box-shadow:none; font-size:19px; }
.sidebar.sidebar-modern .menu-toggle:hover { color:#fff; }
.sidebar.sidebar-modern nav { display:grid; gap:3px; padding:0 0 44px; overflow:visible; }
.sidebar.sidebar-modern .menu-group { display:block; gap:0; min-width:0; }
.sidebar.sidebar-modern .menu-group-toggle, .sidebar.sidebar-modern .sidebar-direct { position:relative; display:flex; align-items:center; justify-content:flex-start; gap:10px; padding:8px 10px; width:100%; min-height:44px; border:0; border-radius:10px; background:transparent; color:#C9CBD6; box-shadow:none; font:inherit; cursor:pointer; }
.sidebar.sidebar-modern .menu-group-toggle strong, .sidebar.sidebar-modern .sidebar-direct strong { display:block; flex:1; min-width:0; text-align:left; font-size:14px; font-weight:500; letter-spacing:0; text-transform:none; line-height:1.4; }
.sidebar.sidebar-modern .nav-area-icon { display:grid; place-items:center; width:28px; height:28px; flex:0 0 28px; border-radius:8px; background:var(--group-color); color:#fff; }
.sidebar-modern .nav-area-icon svg { display:block; width:16px; height:16px; }
.sidebar.sidebar-modern .menu-group-toggle i { display:grid; place-items:center; margin-left:auto; width:14px; height:14px; flex:0 0 14px; background:transparent; border-radius:0; color:#6B6F85; transform:rotate(0); transition:transform 150ms; }
.sidebar-modern .menu-group-toggle i svg { width:14px; height:14px; }
.sidebar.sidebar-modern .menu-group-toggle:hover, .sidebar.sidebar-modern .sidebar-direct:hover { background:#24283C; color:#fff; }
.sidebar.sidebar-modern .menu-group.is-open > .menu-group-toggle, .sidebar.sidebar-modern .menu-group.has-current > .menu-group-toggle, .sidebar.sidebar-modern .sidebar-direct[aria-current=page] { background:#2A2E45; color:#fff; }
.sidebar.sidebar-modern .menu-group.is-open > .menu-group-toggle i { transform:rotate(90deg); }
.sidebar.sidebar-modern .menu-items { display:grid; grid-template-rows:0fr; padding:0; margin:0; visibility:hidden; transition:grid-template-rows 200ms, visibility 200ms; }
.sidebar.sidebar-modern .menu-items-inner { min-height:0; overflow:hidden; display:flex; flex-direction:column; }
.sidebar.sidebar-modern .menu-group.is-open > .menu-items { grid-template-rows:1fr; visibility:visible; }
.sidebar.sidebar-modern .menu-items a { display:flex; gap:0; min-height:0; margin-left:22px; border:0; border-left:2px solid #2A2E45; border-radius:0; padding:5px 0 5px 12px; color:#C9CBD6; background:transparent; font-size:13.5px; line-height:1.45; }
.sidebar.sidebar-modern .menu-items a > span { display:none; }
.sidebar.sidebar-modern .menu-items a strong { display:block; font-size:inherit; font-weight:400; text-transform:none; overflow-wrap:anywhere; }
.sidebar.sidebar-modern .menu-items a:hover { color:#fff; background:#24283C; }
.sidebar.sidebar-modern .menu-items a[aria-current=page] { color:#AFA9EC; border-left-color:var(--group-color); }
.sidebar.sidebar-modern .menu-items a[aria-current=page] strong { font-weight:600; }
.sidebar-modern .sidebar-flyout-title { display:none; }
.sidebar.sidebar-modern .sidebar-divider { width:100%; height:1px; border:0; background:#2A2E45; margin:10px 0; }
.sidebar.sidebar-modern .nav-count-badge { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; margin-left:auto; width:auto; min-width:20px; height:18px; padding:0 7px; border-radius:999px; background:#E24B4A !important; color:#fff; font-size:11px; font-weight:600; line-height:18px; }
.sidebar-modern :is(a,button):focus-visible { outline:2px solid #7F77DD; outline-offset:-2px; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking), #sidebar.sidebar-modern.is-collapsed:not(.is-peeking):hover, #sidebar.sidebar-modern.is-collapsed:not(.is-peeking):focus-within { width:68px; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .brand-row { justify-content:center; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .brand-text, #sidebar.sidebar-modern.is-collapsed:not(.is-peeking) nav strong, #sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .menu-group-toggle i { display:none; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .brand-mark, #sidebar.sidebar-modern.is-collapsed:not(.is-peeking) nav { display:grid; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .menu-toggle { position:fixed; left:20px; bottom:12px; margin:0; background:#1A1D2E; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .menu-group-toggle, #sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .sidebar-direct { justify-content:center; padding:7px 10px; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .menu-group > .menu-items { display:none; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .nav-count-badge { position:absolute; top:3px; right:4px; width:8px; min-width:8px; height:8px; padding:0; font-size:0; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .menu-group.is-flyout-open > .menu-items { position:fixed; display:block; left:72px; top:var(--flyout-top, 70px); width:min(248px, calc(100vw - 84px)); max-height:calc(100dvh - 24px); border:1px solid #2A2E45; border-radius:12px; background:#1A1D2E; padding:10px; visibility:visible; box-shadow:0 8px 24px #0004; overflow-y:auto; z-index:60; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .is-flyout-open .menu-items-inner { overflow:visible; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .is-flyout-open .sidebar-flyout-title { display:block; width:auto; height:auto; padding:4px 10px 10px; background:transparent; color:#fff; font-size:13px; font-weight:600; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .is-flyout-open .menu-items a { padding:6px 0 6px 12px; margin-left:10px; justify-content:flex-start; }
#sidebar.sidebar-modern.is-collapsed:not(.is-peeking) .is-flyout-open .menu-items a strong { display:block; }
.sidebar-modern .sidebar-tooltip { position:fixed; left:72px; top:var(--flyout-top); padding:10px 14px; border:1px solid #2A2E45; border-radius:9px; color:#fff; background:#1A1D2E; white-space:nowrap; z-index:60; }
@media (max-width:860px) {
  .sidebar.sidebar-modern { width:min(82vw, 320px); }
  #sidebar.sidebar-modern.is-collapsed + .topbar { left:68px; }
  #sidebar.sidebar-modern.is-collapsed ~ .app-shell { margin-left:68px; }
}
@media (prefers-reduced-motion:reduce) { .sidebar-modern *, .sidebar.sidebar-modern { transition:none !important; } }

/* Expansão temporária sobre o conteúdo, sem alterar a preferência salva. */
#sidebar.sidebar-modern.is-collapsed.is-peeking { width:var(--sidebar); box-shadow:8px 0 24px #0002; }
#sidebar.sidebar-modern.is-peeking .brand-row { justify-content:flex-start; }
#sidebar.sidebar-modern.is-peeking .brand-text, #sidebar.sidebar-modern.is-peeking nav strong { display:block; }
#sidebar.sidebar-modern.is-peeking .menu-group-toggle i { display:grid; }
#sidebar.sidebar-modern.is-peeking .menu-toggle { position:static; margin-left:auto; }
#sidebar.sidebar-modern.is-peeking .menu-items { display:grid; padding:0; }
#sidebar.sidebar-modern.is-peeking .menu-group-toggle, #sidebar.sidebar-modern.is-peeking .sidebar-direct { justify-content:flex-start; padding:8px 10px; }
#sidebar.sidebar-modern.is-peeking .sidebar-tooltip { display:none; }
@media (max-width:860px) { #sidebar.sidebar-modern.is-collapsed.is-peeking { width:min(82vw, 320px); } }
