/* Desktop navigation rail (src/ui/layout/appRail.js) — Preline Help Desk template, first built for
   the CRM inbox. renderShell docks it as the desktop nav of every page; the inbox places it in the
   first column of its grid. The account menu reuses the crm-menu / crm-avatar primitives and the
   --crm-* tokens from crm-inbox.css (declared on .app-rail there as well). */

.app-rail-host {
  min-height: 0;
}

.app-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-height: 0;
  padding: 0.75rem 0 1rem;
  overflow-y: auto;
  scrollbar-width: none;
}

.app-rail__logo {
  display: inline-flex;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
}

.app-rail__logo img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.app-rail__nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  width: 100%;
}

.app-rail__divider {
  width: 1.5rem;
  height: 1px;
  margin: 0.375rem auto;
  background: var(--fsm-line-1);
}

.app-rail__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.125rem;
  border-radius: 0.5rem;
  color: var(--fsm-foreground);
  text-decoration: none;
}

.app-rail__link:focus-visible,
.app-rail__logo:focus-visible,
.app-rail__avatar-btn:focus-visible {
  outline: 2px solid var(--crm-link);
  outline-offset: 2px;
}

.app-rail__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  color: var(--fsm-muted-foreground);
}

.app-rail__link:hover .app-rail__icon {
  background: var(--fsm-muted);
  color: var(--fsm-foreground);
}

.app-rail__link.is-active .app-rail__icon {
  background: color-mix(in srgb, var(--fsm-foreground) 10%, transparent);
  color: var(--fsm-foreground);
}

.app-rail__label {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.6875rem;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-rail__badge {
  position: absolute;
  top: -0.3125rem;
  right: -0.3125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: var(--crm-alert);
  box-shadow: 0 0 0 2px var(--fsm-background);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}

.app-rail__footer {
  margin-top: 0.75rem;
}

.app-rail__avatar-btn {
  display: inline-flex;
  border-radius: 9999px;
}

/* Shell desktop nav: full-height column beside the header + page content. */
.fsm-shell-layout-desktop > .app-rail-host {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 60;
  flex: 0 0 var(--fsm-desktop-sidebar-w, 4rem);
  align-self: flex-start;
  width: var(--fsm-desktop-sidebar-w, 4rem);
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid var(--fsm-line-1);
  background: var(--fsm-background);
}
