:root {
  --sidebar-width: 236px;
  --sidebar-collapsed-width: 68px;
  --sidebar-bg: #04152d;
  --sidebar-panel: rgba(48,139,255,.075);
  --sidebar-panel-hover: rgba(55,151,255,.115);
  --sidebar-text: #dceaff;
  --sidebar-muted: #7f9fc2;
  --sidebar-line: rgba(88,166,255,.13);
  --sidebar-accent: #39bfff;
}

body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

.sidebar {
  width: var(--sidebar-width);
  padding: 12px 10px 10px;
  background:
    radial-gradient(circle at 17% 0%, rgba(36,126,255,.22), transparent 31%),
    radial-gradient(circle at 100% 82%, rgba(0,184,255,.075), transparent 34%),
    linear-gradient(180deg, #04142c 0%, #062047 50%, #031326 100%);
  border-right: 1px solid var(--sidebar-line);
  box-shadow: inset -1px 0 0 rgba(118,194,255,.035), 12px 0 28px rgba(0,18,44,.055);
  transition: width .18s ease, transform .2s ease;
}

.main-content {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  transition: width .18s ease, margin-left .18s ease;
}

.sidebar-head {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 4px 34px 4px 4px;
  gap: 9px;
  border-radius: 10px;
  transition: background .14s ease;
}

.brand:hover {
  background: rgba(55,151,255,.075);
}

.brand-symbol {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,111,255,.08);
}

.brand-symbol img {
  width: 34px;
  height: 34px;
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  color: #f7fbff;
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 2.4px;
  text-shadow: 0 0 18px rgba(93,191,255,.10);
}

.brand small {
  margin-top: 2px;
  color: #77a9d8;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.sidebar-collapse-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #83a6c8;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background .14s ease, color .14s ease;
}

.sidebar-collapse-toggle:hover {
  background: rgba(55,151,255,.10);
  color: #eaf7ff;
}

.sidebar-collapse-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform .18s ease;
}

.nav-section {
  display: none;
}

.sidebar > nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 3px 1px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.sidebar:hover > nav {
  scrollbar-color: rgba(108,166,220,.34) transparent;
}

.sidebar > nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar > nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: transparent;
}

.sidebar:hover > nav::-webkit-scrollbar-thumb {
  background: rgba(108,166,220,.34);
}

.nav-item,
.nav-group-toggle {
  position: relative;
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.nav-item::before,
.nav-group-toggle::before {
  display: none;
}

.nav-item:hover,
.nav-group-toggle:hover {
  background: linear-gradient(90deg, rgba(49,137,255,.115), rgba(64,182,255,.055));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(103,183,255,.045);
  transform: none;
}

.nav-item img,
.nav-group-toggle img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  filter: brightness(0) invert(1);
  opacity: .74;
  transition: opacity .12s ease, filter .12s ease;
}

.nav-item:hover img,
.nav-group-toggle:hover img,
.nav-item-active img {
  opacity: 1;
}

.nav-item span,
.nav-group-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-active {
  background: linear-gradient(90deg, rgba(33,129,255,.22), rgba(65,181,255,.09));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(92,177,255,.10), 0 8px 22px rgba(0,86,196,.065);
}

.nav-item-active::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #61dcff, #2b83ff);
  box-shadow: 0 0 12px rgba(57,191,255,.55);
}

.nav-item:focus-visible,
.nav-group-toggle:focus-visible,
.sidebar-collapse-toggle:focus-visible,
.sidebar-account-trigger:focus-visible,
.sidebar-account-menu a:focus-visible,
.sidebar-account-menu button:focus-visible {
  outline: 2px solid rgba(64,190,255,.72);
  outline-offset: 1px;
}

.nav-group-toggle b {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  margin-left: auto;
  color: #7398bd;
  font-size: 13px;
  font-weight: 700;
  transition: transform .16s ease, color .12s ease;
}

.nav-group-toggle[aria-expanded="false"] b {
  transform: rotate(-90deg);
}

.nav-group-toggle[aria-expanded="true"] {
  color: #fff;
}

.nav-group-toggle[aria-expanded="true"] b {
  color: #8fd5ff;
}

.nav-group {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 1px 0 4px 28px;
  padding: 2px 0 2px 9px;
}

.nav-group[hidden] {
  display: none;
}

.nav-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg, rgba(90,183,255,.18), rgba(255,255,255,.04));
}

.nav-item-sub {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  color: #a8bed5;
  font-size: 11.5px;
  font-weight: 530;
}

.nav-item-sub.nav-item-active {
  background: rgba(54,153,255,.115);
  color: #edf8ff;
  box-shadow: inset 0 0 0 1px rgba(98,186,255,.055);
}

.nav-item-sub.nav-item-active::after {
  display: none;
}

.nav-badge {
  min-width: 19px;
  height: 19px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  box-shadow: none;
  font-size: 9px;
}

.sidebar-pinned {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 7px 1px 6px;
  border-top: 1px solid var(--sidebar-line);
}

.sidebar-pinned .nav-item {
  min-height: 38px;
  color: #c5d7e9;
}

.sidebar-footer {
  position: relative;
  flex: 0 0 auto;
  padding-top: 5px;
  border-top: 1px solid rgba(87,163,235,.075);
}

.sidebar-account {
  position: relative;
}

.sidebar-account-trigger {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 32px minmax(0,1fr) 22px;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, box-shadow .12s ease;
}

.sidebar-account-trigger:hover,
.sidebar-account-trigger[aria-expanded="true"] {
  background: linear-gradient(90deg, rgba(48,139,255,.105), rgba(78,194,255,.045));
  box-shadow: inset 0 0 0 1px rgba(98,186,255,.05);
}

.sidebar-account-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(117,203,255,.22);
  border-radius: 50%;
  background: linear-gradient(145deg, #124a86, #0a2b55);
  box-shadow: 0 5px 16px rgba(0,98,224,.13);
  color: #f3faff;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-account-copy {
  min-width: 0;
}

.sidebar-account-copy strong,
.sidebar-account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-copy strong {
  color: #f3f8ff;
  font-size: 11px;
  font-weight: 650;
}

.sidebar-account-copy small {
  margin-top: 2px;
  color: #789bc0;
  font-size: 9px;
  font-weight: 560;
}

.sidebar-account-chevron {
  display: grid;
  place-items: center;
  color: #7397bb;
  transition: transform .15s ease, color .12s ease;
}

.sidebar-account-trigger[aria-expanded="true"] .sidebar-account-chevron {
  transform: rotate(180deg);
  color: #cfeaff;
}

.sidebar-account-chevron svg {
  width: 14px;
  height: 14px;
}

.sidebar-account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 40;
  display: grid;
  gap: 2px;
  padding: 5px;
  border: 1px solid rgba(103,184,255,.13);
  border-radius: 11px;
  background: #071c38;
  box-shadow: 0 18px 38px rgba(0,10,28,.36), inset 0 1px 0 rgba(255,255,255,.025);
}

.sidebar-account-menu[hidden] {
  display: none;
}

.sidebar-account-menu::after {
  content: "";
  position: absolute;
  left: 17px;
  bottom: -5px;
  width: 9px;
  height: 9px;
  background: #071c38;
  border-right: 1px solid rgba(103,184,255,.13);
  border-bottom: 1px solid rgba(103,184,255,.13);
  transform: rotate(45deg);
}

.sidebar-account-menu a,
.sidebar-account-menu .link-button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #bfd4e8;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 560;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-account-menu a:hover,
.sidebar-account-menu .link-button:hover {
  background: rgba(55,151,255,.11);
  color: #fff;
}

.sidebar-account-menu form {
  margin: 0;
}

.mobile-menu-toggle {
  display: none;
}

.sidebar-backdrop {
  cursor: default;
}

/* Desktop compacto: mantém apenas a navegação essencial em ícones. */
@media (min-width: 851px) {
  body.sidebar-collapsed .sidebar {
    padding-inline: 8px;
  }

  body.sidebar-collapsed .brand {
    justify-content: center;
    padding: 4px;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-item span,
  body.sidebar-collapsed .nav-group-toggle span,
  body.sidebar-collapsed .nav-group-toggle b,
  body.sidebar-collapsed .sidebar-account-copy,
  body.sidebar-collapsed .sidebar-account-chevron {
    display: none;
  }

  body.sidebar-collapsed .sidebar-collapse-toggle {
    right: -11px;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(104,190,255,.16);
    background: #082345;
    box-shadow: 0 6px 16px rgba(0,25,62,.28);
  }

  body.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
  }

  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .nav-group-toggle,
  body.sidebar-collapsed .sidebar-pinned .nav-item {
    justify-content: center;
    padding-inline: 0;
  }

  body.sidebar-collapsed .nav-item-active::after {
    left: 1px;
  }

  body.sidebar-collapsed .nav-group {
    display: none !important;
  }

  body.sidebar-collapsed .nav-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    font-size: 8px;
  }

  body.sidebar-collapsed .sidebar-account-trigger {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-inline: 0;
  }

  body.sidebar-collapsed .sidebar-account-menu {
    left: calc(100% + 9px);
    right: auto;
    bottom: 0;
    width: 208px;
  }

  body.sidebar-collapsed .sidebar-account-menu::after {
    left: -5px;
    bottom: 17px;
    border: 0;
    border-left: 1px solid rgba(103,184,255,.13);
    border-bottom: 1px solid rgba(103,184,255,.13);
  }
}

@media (max-width: 850px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body.sidebar-collapsed {
    --sidebar-width: 236px;
  }

  .sidebar {
    display: flex;
    width: min(84vw, 276px);
    padding: 12px 10px 10px;
    transform: translateX(-105%);
    z-index: 100;
    box-shadow: 18px 0 45px rgba(0,12,34,.34);
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .main-content,
  body.sidebar-collapsed .main-content {
    width: 100%;
    margin-left: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    gap: 9px;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .mobile-menu-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    flex: 0 0 40px;
    padding: 9px;
    border: 1px solid var(--line, #e2eaf3);
    border-radius: 9px;
    background: #fff;
    place-content: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(7,27,53,.04);
    cursor: pointer;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: #17365d;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    border: 0;
    background: rgba(2,13,31,.58);
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
  }
}

@media (max-width: 520px) {
  .topbar-user {
    display: none;
  }

  .topbar-kicker {
    display: none;
  }

  .sidebar {
    width: min(88vw, 270px);
  }
}
