/* Sidebar navigation. Single source for desktop rail, tablet rail, and mobile drawer. */
.app-sidebar {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: 236px;
  padding: 12px 10px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(248, 250, 252, 0.94);
  box-shadow: none;
}

.app-sidebar-nav {
  display: grid;
  gap: 3px;
}

.app-sidebar-nav-primary {
  margin-bottom: 2px;
}

.app-sidebar-nav-secondary {
  margin-top: -4px;
}

.app-sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  transform: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.app-sidebar-link:hover {
  border-color: rgba(16, 24, 40, 0.08);
  background: #ffffff;
  color: #101828;
}

.app-sidebar-link.is-active {
  border-color: rgba(37, 99, 235, 0.22);
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 3px 0 0 #2563eb;
}

.support-contact-sidebar-trigger {
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.app-sidebar-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: currentColor;
  line-height: 1;
}

.app-sidebar-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.app-sidebar-panel,
.sidebar-generation {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
}

.sidebar-generation summary {
  list-style: none;
}

.sidebar-generation summary::-webkit-details-marker {
  display: none;
}

.sidebar-generation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.sidebar-generation-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #667085;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-credit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(8, 145, 178, 0.18);
  border-radius: 8px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 12px;
  font-weight: 700;
}

.app-sidebar-footer {
  display: grid;
  gap: 10px;
  align-content: end;
}

.app-sidebar-footer .btn {
  min-height: 34px;
  border-color: rgba(10, 99, 216, 0.13);
  border-radius: 8px;
  background: #ffffff;
  color: #475467;
}

.app-sidebar-mobile-account-nav,
.app-sidebar-mobile-close,
.app-mobile-nav-backdrop {
  display: none;
}

@media (min-width: 769px) and (max-width: 991.98px) {
  html,
  body {
    overflow-x: clip;
  }

  .app-sidebar {
    position: static;
    inset: auto;
    z-index: auto;
    display: block;
    width: 100vw;
    max-width: 100vw;
    min-height: 0;
    margin: 56px 0 0 calc(50% - 50vw);
    padding: 7px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    border-right: 0;
    border-bottom: 1px solid rgba(16, 24, 40, 0.08);
    background: rgba(248, 250, 252, 0.94);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .app-sidebar::-webkit-scrollbar {
    display: none;
  }

  .app-sidebar-nav,
  .app-sidebar-panel,
  .sidebar-generation,
  .app-sidebar-footer {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    vertical-align: middle;
  }

  .sidebar-generation-head {
    display: inline-flex;
    min-height: 32px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.52);
  }

  .app-sidebar-link {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
  }

  .support-contact-sidebar-trigger {
    width: auto;
  }

  .app-sidebar-icon {
    width: 15px;
    height: 15px;
  }

  .app-sidebar-footer {
    margin-left: 4px;
  }

  .app-sidebar-footer .btn {
    display: none;
  }

  .sidebar-credit {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
  }

  .app-main {
    min-height: 0;
    margin-left: 0;
    padding: 14px 10px 18px;
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: clip;
  }

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

  .app-sidebar {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: auto;
    z-index: 130;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    width: min(300px, calc(100vw - 24px));
    min-height: 0;
    margin: 0;
    padding: 12px 10px;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: normal;
    border: 1px solid rgba(10, 99, 216, 0.14);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(16, 24, 40, 0.18);
    transform: translateX(calc(100% + 16px));
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.28s;
  }

  body.mobile-nav-open .app-sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .app-sidebar-mobile-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--app-mobile-nav-border, rgba(16, 24, 40, 0.12));
    border-radius: 6px;
    color: var(--app-mobile-nav-color, #475467);
    background: var(--app-mobile-nav-bg, #ffffff);
    cursor: pointer;
    transition:
      border-color 0.18s ease,
      color 0.18s ease,
      background 0.18s ease;
  }

  .app-sidebar-mobile-close:hover {
    border-color: var(--app-mobile-nav-hover-border, rgba(37, 99, 235, 0.34));
    color: var(--app-mobile-nav-hover-color, #1d4ed8);
    background: var(--app-mobile-nav-hover-bg, #eff6ff);
  }

  .app-sidebar-mobile-close:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--app-mobile-nav-focus, rgba(37, 99, 235, 0.18));
  }

  .app-sidebar-mobile-close i {
    font-size: 20px;
    line-height: 1;
  }

  body.mobile-nav-open .app-sidebar a,
  body.mobile-nav-open .app-sidebar button:not(.app-sidebar-mobile-close),
  body.mobile-nav-open .app-sidebar details,
  body.mobile-nav-open .app-sidebar summary {
    position: relative;
    z-index: 1;
    pointer-events: auto;
  }

  .app-mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: block;
    background: rgba(3, 7, 18, 0.56);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
  }

  body.mobile-nav-open .app-mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar-nav,
  .app-sidebar-panel,
  .sidebar-generation,
  .app-sidebar-footer {
    display: grid;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .app-sidebar-nav {
    gap: 2px;
  }

  .sidebar-generation-head {
    min-height: 36px;
    margin: 0 2px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.52);
  }

  .app-sidebar-link {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 13px;
  }

  .app-sidebar-icon {
    width: 17px;
    height: 17px;
  }

  .app-sidebar-footer {
    align-self: end;
    gap: 6px;
  }

  .app-sidebar-footer .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
  }

  .sidebar-credit {
    min-height: 34px;
    font-size: 12px;
  }

  .app-sidebar-mobile-account-nav {
    display: grid;
    align-content: end;
    align-self: stretch;
    grid-auto-rows: min-content;
    gap: 2px;
  }

  .app-main {
    min-height: 0;
    margin-left: 0;
    padding: 70px 10px 18px;
  }
}
