@layer lf-layout {

/* ===== LAYOUT/SIDEBAR.CSS ===== */
/* Single visual owner for the shared authenticated sidebar. */
body.dashboard-client-flat-theme .sidebar {
  background: transparent;
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1), min-width 0.85s cubic-bezier(0.22, 1, 0.36, 1), padding 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

body.dashboard-client-flat-theme .sidebar-menu-toggle,
body[data-company-theme] > .shell .sidebar-menu-toggle {
  position: static;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--lf-rgb-muted), 0.22);
  border-radius: var(--lf-radius-sm);
  background: transparent;
  color: var(--lf-color-muted);
  box-shadow: none;
  cursor: pointer;
  transition: color 0.45s ease, border-color 0.45s ease, background 0.45s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

body.dashboard-client-flat-theme .sidebar-menu-toggle svg,
body[data-company-theme] > .shell .sidebar-menu-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

body.dashboard-client-flat-theme .sidebar-menu-toggle:hover,
body[data-company-theme] > .shell .sidebar-menu-toggle:hover,
body.dashboard-client-flat-theme .sidebar-menu-toggle[aria-expanded="false"],
body[data-company-theme] > .shell .sidebar-menu-toggle[aria-expanded="false"] {
  color: var(--lf-color-primary);
  border-color: rgba(var(--lf-rgb-primary), 0.24);
  background: rgba(var(--lf-rgb-primary), 0.06);
}

body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-menu-toggle svg,
body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-menu-toggle svg {
  transform: rotate(180deg);
}

body.dashboard-client-flat-theme .sidebar-section-title--toggle,
body[data-company-theme] > .shell .sidebar-section-title--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.dashboard-client-flat-theme .sidebar-section-title--toggle > span,
body[data-company-theme] > .shell .sidebar-section-title--toggle > span,
body.dashboard-client-flat-theme .sidebar-brand-copy,
body[data-company-theme] > .shell .sidebar-brand-copy,
body.dashboard-client-flat-theme .nav-label,
body[data-company-theme] > .shell .nav-label,
body.dashboard-client-flat-theme .sidebar-industry,
body[data-company-theme] > .shell .sidebar-industry,
body.dashboard-client-flat-theme .sidebar-section-title:not(.sidebar-section-title--toggle),
body[data-company-theme] > .shell .sidebar-section-title:not(.sidebar-section-title--toggle),
body.dashboard-client-flat-theme .sidebar-footer-link > span:nth-child(2),
body[data-company-theme] > .shell .sidebar-footer-link > span:nth-child(2),
body.dashboard-client-flat-theme .sidebar-footer-link span:last-child,
body[data-company-theme] > .shell .sidebar-footer-link span:last-child {
  transition: opacity 0.45s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

body.dashboard-client-flat-theme > .shell > aside.sidebar,
body.dashboard-client-flat-theme > .shell > .sidebar,
body[data-company-theme] > .shell > aside.sidebar,
body[data-company-theme] > .shell > .sidebar,
body.lf-clean-theme > .shell > aside.sidebar,
body.lf-clean-theme > .shell > .sidebar {
  width: var(--lf-sidebar-width);
  min-width: var(--lf-sidebar-width);
  max-width: var(--lf-sidebar-width);
}

.shell > .sidebar,
.shell.is-sidebar-collapsed > .sidebar {
  width: var(--lf-sidebar-width, 220px);
  min-width: var(--lf-sidebar-width, 220px);
  max-width: var(--lf-sidebar-width, 220px);
}

.shell.is-sidebar-collapsed {
  grid-template-columns: var(--lf-sidebar-width-collapsed, 68px) minmax(0, 1fr);
}

.shell.is-sidebar-collapsed > .sidebar {
  width: var(--lf-sidebar-width-collapsed, 68px);
  min-width: var(--lf-sidebar-width-collapsed, 68px);
  max-width: var(--lf-sidebar-width-collapsed, 68px);
}

@media (min-width: 901px) {
  body.dashboard-client-flat-theme > .shell,
  body[data-company-theme] > .shell:has(> .sidebar) {
    grid-template-columns: var(--lf-sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.dashboard-client-flat-theme > .shell.is-sidebar-collapsed,
  body[data-company-theme] > .shell:has(> .sidebar).is-sidebar-collapsed {
    grid-template-columns: var(--lf-sidebar-width-collapsed) minmax(0, 1fr);
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed {
    width: var(--lf-sidebar-width-collapsed);
    min-width: var(--lf-sidebar-width-collapsed);
    max-width: var(--lf-sidebar-width-collapsed);
    padding-left: 12px;
    padding-right: 12px;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-brand,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-brand {
    padding: 6px 0 12px;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-brand .logo-link.has-image,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-brand .logo-link.has-image {
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-brand-copy,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-brand-copy,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .nav-label,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .nav-label,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-industry,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-industry,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-section-title:not(.sidebar-section-title--toggle),
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-section-title:not(.sidebar-section-title--toggle),
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle > span,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle > span,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-footer-link > span:nth-child(2),
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-footer-link > span:nth-child(2),
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-footer-link span:last-child,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-footer-link span:last-child {
    width: 0;
    max-width: 0;
    opacity: 0;
    transform: translateX(-10px);
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle {
    justify-content: center;
    padding-inline: 0;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .nav-dot,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .nav-dot,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-footer-link,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-footer-link {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 4px;
    justify-content: center;
    grid-template-columns: 34px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .nav-icon,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .nav-icon,
  body.dashboard-client-flat-theme .sidebar.is-sidebar-collapsed .sidebar-footer-icon,
  body[data-company-theme] > .shell .sidebar.is-sidebar-collapsed .sidebar-footer-icon {
    margin: 0 auto;
  }

}

/* No white panel behind the shared app menu. */
body.lf-clean-theme > .shell > aside.sidebar,
body.lf-clean-theme > .shell > .sidebar,
body.dashboard-client-flat-theme > .shell > aside.sidebar,
body[data-company-theme] > .shell > aside.sidebar {
  position: relative;
  z-index: 12000;
  background: transparent;
  background-color: transparent;
  background-image: none;
  border-color: transparent;
  box-shadow: none;
  overflow: visible;
}

body.lf-clean-theme > .shell > aside.sidebar::before,
body.lf-clean-theme > .shell > aside.sidebar::after,
body.dashboard-client-flat-theme > .shell > aside.sidebar::before,
body.dashboard-client-flat-theme > .shell > aside.sidebar::after,
body[data-company-theme] > .shell > aside.sidebar::before,
body[data-company-theme] > .shell > aside.sidebar::after {
  display: none !important;
  background: transparent;
  box-shadow: none;
}

body.lf-clean-theme > .shell > aside.sidebar :is(
  .sidebar-brand,
  .sidebar-nav-shell,
  .sidebar-menu-panel,
  .sidebar-footer-actions,
  .sidebar-footer-card,
  .nav-group,
  .nav-group-children
),
body.dashboard-client-flat-theme > .shell > aside.sidebar :is(
  .sidebar-brand,
  .sidebar-nav-shell,
  .sidebar-menu-panel,
  .sidebar-footer-actions,
  .sidebar-footer-card,
  .nav-group,
  .nav-group-children
) {
  background: transparent;
  background-color: transparent;
  background-image: none;
  box-shadow: none;
}

body.dashboard-client-flat-theme:not(.leads-page) .lead-table tbody tr .lead-avatar,
body[data-company-theme]:not(.leads-page) > .shell .lead-table tbody tr .lead-avatar {
  background: rgba(var(--lf-rgb-primary), 0.16);
  color: var(--lf-color-primary);
}

body.dashboard-client-flat-theme:not(.leads-page) .lead-table tbody tr:nth-child(2n) .lead-avatar,
body[data-company-theme]:not(.leads-page) > .shell .lead-table tbody tr:nth-child(2n) .lead-avatar {
  background: rgba(var(--lf-rgb-secondary), 0.16);
  color: var(--lf-color-secondary);
}

body.dashboard-client-flat-theme:not(.leads-page) .lead-table tbody tr:nth-child(3n) .lead-avatar,
body[data-company-theme]:not(.leads-page) > .shell .lead-table tbody tr:nth-child(3n) .lead-avatar {
  background: rgba(8, 145, 178, 0.15);
  color: #0891b2;
}

body.dashboard-client-flat-theme:not(.leads-page) .lead-table tbody tr:nth-child(4n) .lead-avatar,
body[data-company-theme]:not(.leads-page) > .shell .lead-table tbody tr:nth-child(4n) .lead-avatar {
  background: rgba(var(--lf-rgb-success-strong), 0.15);
  color: var(--lf-color-success-strong);
}

body.dashboard-client-flat-theme > .shell > .sidebar {
  width: var(--lf-sidebar-width);
  display: flex;
  flex-direction: column;
  gap: var(--lf-space-4);
  padding: var(--lf-space-5) var(--lf-space-4);
  border-right: 1px solid transparent;
  background: transparent;
  color: var(--lf-color-text);
  box-shadow: none;
}

body.dashboard-client-flat-theme > .shell > .sidebar :is(.sidebar-brand, .sidebar-menu-panel, .sidebar-nav-shell, .sidebar-footer-actions) {
  min-width: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-menu-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--lf-space-3);
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-nav-shell {
  display: grid;
  gap: var(--lf-space-2);
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group,
body[data-company-theme] > .shell > .sidebar .nav-group,
body.lf-clean-theme > .shell > .sidebar .nav-group {
  display: grid;
  gap: 2px;
  min-width: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-head,
body[data-company-theme] > .shell > .sidebar .nav-group-head,
body.lf-clean-theme > .shell > .sidebar .nav-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-head > .nav-dot,
body[data-company-theme] > .shell > .sidebar .nav-group-head > .nav-dot,
body.lf-clean-theme > .shell > .sidebar .nav-group-head > .nav-dot {
  min-width: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-toggle,
body[data-company-theme] > .shell > .sidebar .nav-group-toggle,
body.lf-clean-theme > .shell > .sidebar .nav-group-toggle {
  width: 26px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--lf-radius-sm);
  color: var(--lf-color-muted, var(--lf-color-muted));
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-toggle:hover,
body[data-company-theme] > .shell > .sidebar .nav-group-toggle:hover,
body.lf-clean-theme > .shell > .sidebar .nav-group-toggle:hover {
  color: var(--primary-color, var(--lf-color-primary));
  background: rgba(var(--lf-rgb-primary), 0.07);
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-toggle svg,
body[data-company-theme] > .shell > .sidebar .nav-group-toggle svg,
body.lf-clean-theme > .shell > .sidebar .nav-group-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.24s ease;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group.is-expanded .nav-group-toggle svg,
body[data-company-theme] > .shell > .sidebar .nav-group.is-expanded .nav-group-toggle svg,
body.lf-clean-theme > .shell > .sidebar .nav-group.is-expanded .nav-group-toggle svg {
  transform: rotate(180deg);
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-children,
body[data-company-theme] > .shell > .sidebar .nav-group-children,
body.lf-clean-theme > .shell > .sidebar .nav-group-children {
  display: grid;
  gap: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 0.3s ease,
    opacity 0.2s ease,
    transform 0.28s ease,
    margin 0.28s ease;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group-children > *,
body[data-company-theme] > .shell > .sidebar .nav-group-children > *,
body.lf-clean-theme > .shell > .sidebar .nav-group-children > * {
  min-height: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-group.is-expanded .nav-group-children,
body[data-company-theme] > .shell > .sidebar .nav-group.is-expanded .nav-group-children,
body.lf-clean-theme > .shell > .sidebar .nav-group.is-expanded .nav-group-children {
  gap: 2px;
  max-height: 420px;
  margin-top: 2px;
  opacity: 1;
  transform: translateY(0);
}

body.dashboard-client-flat-theme > .shell > .sidebar :is(.nav-dot, .sidebar-footer-link) {
  min-height: 42px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: var(--lf-space-3);
  padding: 4px var(--lf-space-3);
  border: 1px solid transparent;
  border-radius: var(--lf-radius-md);
  background: transparent;
  color: var(--lf-color-muted);
  text-decoration: none;
  box-shadow: none;
  transform: none;
  transition:
    background var(--lf-transition-fast),
    border-color var(--lf-transition-fast),
    color var(--lf-transition-fast);
}

body.dashboard-client-flat-theme > .shell > .sidebar :is(.nav-icon svg, .nav-icon i, .sidebar-footer-icon svg) {
  width: 16px;
  height: 16px;
  color: inherit;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-label {
  min-width: 0;
  color: inherit;
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-600);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-dot-sub {
  min-height: 36px;
  margin-left: var(--lf-space-5);
  grid-template-columns: 28px minmax(0, 1fr);
  padding-left: var(--lf-space-2);
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-dot-sub .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--lf-radius-sm);
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-dot-sub .nav-label {
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-500);
}

body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .nav-dot-sub {
  margin-left: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-head,
body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .nav-group-head,
body.lf-clean-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-head {
  grid-template-columns: 42px;
  justify-content: center;
}

body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-toggle,
body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .nav-group-toggle,
body.lf-clean-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-toggle,
body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-children,
body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .nav-group-children,
body.lf-clean-theme > .shell > .sidebar.is-sidebar-collapsed .nav-group-children {
  display: none !important;
}

body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .nav-label,
body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-brand-copy,
body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-industry,
body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-section-title:not(.sidebar-section-title--toggle) {
  display: none !important;
}

body.dashboard-client-flat-theme > .shell > .sidebar .nav-icon-image {
  width: 24px;
  max-width: 24px;
  height: 24px;
  max-height: 24px;
  object-fit: contain;
}

.sidebar-usage-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(var(--lf-rgb-white), 0.08);
  border-radius: var(--lf-radius-lg);
  background: #151515;
  color: var(--lf-color-surface-muted);
  box-shadow: 0 16px 34px rgba(var(--lf-rgb-text), 0.18);
}

.sidebar-usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-usage-head strong {
  min-width: 0;
  color: inherit;
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-500);
  line-height: 1.2;
  letter-spacing: 0;
}

.sidebar-usage-head button {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--lf-radius-pill);
  background: transparent;
  color: rgba(var(--lf-rgb-surface-muted), 0.55);
  cursor: pointer;
  font-size: var(--lf-font-size-lg);
  line-height: 1;
}

.sidebar-usage-head button:hover {
  color: var(--lf-color-on-primary);
  background: rgba(var(--lf-rgb-white), 0.08);
}

.sidebar-usage-card p {
  margin: 0;
  color: rgba(var(--lf-rgb-surface-muted), 0.68);
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-400);
  line-height: 1.35;
}

.sidebar-usage-card .sidebar-usage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: rgba(var(--lf-rgb-surface-muted), 0.82);
  font-size: var(--lf-font-size-xs);
}

.sidebar-usage-track {
  height: 5px;
  overflow: hidden;
  border-radius: var(--lf-radius-pill);
  background: rgba(var(--lf-rgb-white), 0.16);
}

.sidebar-usage-track span {
  display: block;
  width: 8%;
  min-width: 12px;
  height: 100%;
  border-radius: inherit;
  background: var(--lf-color-on-primary);
}

.sidebar-usage-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.sidebar-usage-actions a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--lf-rgb-white), 0.12);
  border-radius: var(--lf-radius-pill);
  background: transparent;
  color: rgba(var(--lf-rgb-surface-muted), 0.9);
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-500);
  line-height: 1;
  text-decoration: none;
}

.sidebar-usage-actions a.is-primary {
  border-color: var(--lf-color-on-primary);
  background: var(--lf-color-on-primary);
  color: #1f2937;
}

.sidebar.is-sidebar-collapsed .sidebar-usage-card {
  display: none !important;
}

/* Authenticated sidebar viewport lock: the shared side menu must not scroll away with page content. */
@media (min-width: 901px) {
  body.lf-clean-theme > .shell > aside.sidebar,
  body.lf-clean-theme > .shell > .sidebar,
  body.dashboard-client-flat-theme > .shell > aside.sidebar,
  body.dashboard-client-flat-theme > .shell > .sidebar,
  body[data-company-theme] > .shell > aside.sidebar,
  body[data-company-theme] > .shell > .sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-menu-panel,
  body[data-company-theme] > .shell > .sidebar .sidebar-menu-panel {
    min-height: 0;
    overflow: visible;
  }

  body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-nav-shell,
  body[data-company-theme] > .shell > .sidebar .sidebar-nav-shell {
    min-height: 0;
  }
}

/* ===== BRAND ===== */
.shell > .sidebar :is(.logo-link, .logo-mark, .sidebar-company-logo-card, .sidebar-scope-logo) {
  flex-shrink: 0;
}

.shell > .sidebar .sidebar-brand {
  position: relative;
  background: transparent;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-brand:has(.logo-link.has-image) {
  align-items: center;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 8px 6px 12px;
  text-align: center;
}

.shell > .sidebar .sidebar-brand .logo-link,
.shell > .sidebar .sidebar-brand .logo-link.has-image,
.shell > .sidebar .sidebar-brand .logo-link--company.has-image {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  overflow: hidden;
}

.shell > .sidebar .sidebar-brand .logo-link.has-image {
  width: 54px;
  height: 54px;
  min-width: 54px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--lf-radius-md);
}

.shell > .sidebar .sidebar-brand .logo-link::before,
.shell > .sidebar .sidebar-brand .logo-link::after {
  display: none !important;
  background: transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-brand .logo-link.has-image .logo-mark {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
  padding: 0;
  border-radius: var(--lf-radius-md);
  overflow: hidden;
}

.shell > .sidebar .sidebar-brand:has(.logo-link.has-image) .sidebar-brand-copy {
  justify-items: center;
  gap: 0;
  width: 100%;
}

.shell > .sidebar .sidebar-brand:has(.logo-link.has-image) .sidebar-brand-copy strong {
  font-size: var(--lf-font-size-md);
  line-height: 1.2;
  text-align: center;
}

.shell > .sidebar .sidebar-company-logo-card {
  width: 100%;
  min-height: 108px;
  display: grid;
  place-items: center;
  padding: 2px 8px 4px;
  border: 0 solid transparent;
  border-radius: var(--lf-radius-md);
  background: transparent;
  overflow: hidden;
  box-shadow: none;
}

.shell > .sidebar:has(.sidebar-company-logo-card) {
  padding-top: 8px;
}

.shell > .sidebar .sidebar-scope-card {
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 6px 8px 10px;
  border-color: transparent;
  background: transparent;
  text-align: center;
}

.shell > .sidebar .sidebar-scope-logo {
  width: min(100%, 174px);
  max-width: 174px;
  height: 104px;
  display: block;
  object-fit: contain;
  object-position: center center;
  border-radius: var(--lf-radius-sm);
  background: transparent;
  transform: scale(1.55);
}

.shell > .sidebar .sidebar-scope-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.shell > .sidebar .sidebar-scope-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

body[data-company-theme="legal"] > .shell > .sidebar .sidebar-scope-copy span {
  font-size: 10px;
}

body[data-company-theme="legal"] > .shell > .sidebar .sidebar-menu-panel {
  gap: var(--lf-space-2);
}

body[data-company-theme="legal"] > .shell > .sidebar .sidebar-nav-shell {
  gap: 3px;
}

body[data-company-theme="legal"] > .shell > .sidebar .nav-dot {
  min-height: 38px;
  padding-block: 3px;
}

.shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) {
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px 14px;
  text-align: center;
}

.shell > .sidebar .sidebar-brand .logo-link--app.has-image {
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 0;
  border-radius: 0;
  overflow: visible;
}

.shell > .sidebar .sidebar-brand .logo-link--app.has-image .logo-mark {
  width: 36px;
  height: 36px;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  object-position: center center;
  border-radius: 0;
  overflow: visible;
}

.shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) .sidebar-brand-copy {
  justify-items: center;
  width: 100%;
  min-width: 0;
}

.shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) .sidebar-brand-copy strong {
  max-width: 100%;
  font-size: var(--lf-font-size-lg);
  line-height: 1.08;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--lf-space-3);
  padding: 0 var(--lf-space-2) var(--lf-space-3);
  border-bottom: 1px solid var(--lf-color-border);
}

body.dashboard-client-flat-theme > .shell > .sidebar:has(.logo-link--app.has-image) {
  padding-top: 10px;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) {
  align-items: center;
  flex-direction: row;
  justify-content: flex-start;
  gap: var(--lf-space-3);
  padding: 0 var(--lf-space-2) var(--lf-space-3);
  text-align: left;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand .logo-link--app.has-image {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  transform: translateY(-1px);
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand .logo-link--app.has-image .logo-mark {
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) .sidebar-brand-copy {
  justify-items: start;
  width: auto;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand:has(.logo-link--app.has-image) .sidebar-brand-copy strong {
  font-size: var(--lf-font-size-lg);
  line-height: 1.05;
  text-align: left;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand-copy strong {
  color: var(--lf-color-text);
  font-size: var(--lf-font-size-md);
  line-height: var(--lf-line-tight);
  font-weight: var(--lf-font-weight-700);
  letter-spacing: 0;
}

body.dashboard-client-flat-theme > .shell > .sidebar .sidebar-brand-copy span,
body.dashboard-client-flat-theme > .shell > .sidebar :is(.sidebar-industry, .sidebar-section-title) {
  color: var(--lf-color-muted);
  font-size: var(--lf-font-size-xs);
  font-weight: var(--lf-font-weight-600);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.lf-clean-theme > .shell > .sidebar .logo-mark,
body.dashboard-client-flat-theme > .shell > .sidebar .logo-mark,
body[data-company-theme] > .shell > .sidebar .logo-mark {
  background: transparent;
}

/* ===== NAVIGATION ===== */
.shell > .sidebar .nav-dot,
.shell > .sidebar .nav-dot.active,
.shell > .sidebar .nav-dot.is-active,
.shell > .sidebar .sidebar-footer-link {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.shell > .sidebar .nav-dot.active,
.shell > .sidebar .nav-dot.is-active {
  color: var(--primary-color, var(--lf-color-primary));
  background: color-mix(in srgb, var(--primary-color, var(--lf-color-primary)) 8%, transparent);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--primary-color, var(--lf-color-primary));
}

.shell > .sidebar .nav-dot.active .nav-label,
.shell > .sidebar .nav-dot.is-active .nav-label {
  font-weight: var(--lf-font-weight-700);
}

.shell > .sidebar .nav-dot.active .nav-label,
.shell > .sidebar .nav-dot.is-active .nav-label,
.shell > .sidebar .nav-dot.active .nav-icon,
.shell > .sidebar .nav-dot.is-active .nav-icon,
.shell > .sidebar .nav-dot.active svg,
.shell > .sidebar .nav-dot.is-active svg {
  color: var(--primary-color, var(--lf-color-primary));
}

.shell > .sidebar .nav-dot:hover:not(.active) {
  color: var(--primary-color, var(--lf-color-primary));
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.shell > .sidebar :is(.nav-icon, .sidebar-footer-icon) {
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}

.shell > .sidebar .nav-dot[data-nav-key] .nav-icon,
.shell > .sidebar .nav-dot[data-nav-key] .nav-icon svg,
.shell > .sidebar .nav-dot[data-nav-key] .nav-icon i {
  color: var(--lf-nav-icon-color, var(--lf-color-muted));
}

.shell > .sidebar .nav-icon svg,
.shell > .sidebar .nav-icon i,
.shell > .sidebar .sidebar-footer-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.1;
}

.shell > .sidebar .nav-dot[data-nav-key="analytics"] {
  --lf-nav-icon-color: var(--lf-color-primary);
}

.shell > .sidebar .nav-dot[data-nav-key="leads"] {
  --lf-nav-icon-color: var(--lf-color-secondary);
}

.shell > .sidebar .nav-dot[data-nav-key="clients"],
.shell > .sidebar .nav-dot[data-nav-key="agents"],
.shell > .sidebar .nav-dot[data-nav-key="team"],
.shell > .sidebar .nav-dot[data-nav-key="operations-team"] {
  --lf-nav-icon-color: #0891b2;
}

.shell > .sidebar .nav-dot[data-nav-key="whatsapp"] {
  --lf-nav-icon-color: var(--lf-color-success-strong);
}

.shell > .sidebar .nav-dot[data-nav-key="campaigns"] {
  --lf-nav-icon-color: var(--lf-palette-orange-500);
}

.shell > .sidebar .nav-dot[data-nav-key="social"] {
  --lf-nav-icon-color: #db2777;
}

.shell > .sidebar .nav-dot[data-nav-key="commercial_ai_assistant"] {
  --lf-nav-icon-color: var(--lf-color-secondary);
}

.shell > .sidebar .nav-dot[data-nav-key="billing"] {
  --lf-nav-icon-color: var(--lf-palette-indigo-600);
}

.shell > .sidebar .nav-dot[data-nav-key="modules-admin"] {
  --lf-nav-icon-color: #0d9488;
}

.shell > .sidebar .nav-dot[data-nav-key="help"] {
  --lf-nav-icon-color: var(--lf-palette-amber-600);
}

.shell > .sidebar .nav-dot[data-nav-key="support_tickets"],
.shell > .sidebar .nav-dot[data-nav-key="support_tickets"] .nav-label {
  font-weight: var(--lf-font-weight-650);
}

.shell > .sidebar .nav-dot[data-nav-key="support_tickets"].active .nav-label,
.shell > .sidebar .nav-dot[data-nav-key="support_tickets"].is-active .nav-label {
  font-weight: var(--lf-font-weight-750);
}

.shell > .sidebar .nav-dot[data-nav-key="settings"],
.shell > .sidebar .nav-dot[data-nav-key^="settings-"] {
  --lf-nav-icon-color: var(--lf-palette-slate-600);
}

.shell > .sidebar .nav-dot.active .nav-icon,
.shell > .sidebar .nav-dot.is-active .nav-icon,
.shell > .sidebar .nav-dot.active .nav-icon svg,
.shell > .sidebar .nav-dot.is-active .nav-icon svg,
.shell > .sidebar .nav-dot.active .nav-icon i,
.shell > .sidebar .nav-dot.is-active .nav-icon i {
  color: var(--primary-color, var(--lf-nav-icon-color, var(--lf-color-primary)));
}

body.lf-clean-theme > .shell > .sidebar .nav-icon-image,
body.dashboard-client-flat-theme > .shell > .sidebar .nav-icon-image,
body[data-company-theme] > .shell > .sidebar .nav-icon-image {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  display: block;
  object-fit: contain;
}

/* Global has more primary destinations than a client workspace. Keep the full
   navigation visible without changing the denser client-specific sidebars. */
@media (min-width: 901px) {
  body[data-company-theme="global"] > .shell > .sidebar .sidebar-menu-panel {
    gap: 6px;
  }

  body[data-company-theme="global"] > .shell > .sidebar .sidebar-nav-shell {
    gap: 4px;
  }

  body[data-company-theme="global"] > .shell > .sidebar .nav-dot {
    min-height: 38px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 3px 8px;
  }

  body[data-company-theme="global"] > .shell > .sidebar .nav-dot-sub {
    min-height: 34px;
  }

  body[data-company-theme="global"] > .shell > .sidebar :is(.nav-icon, .sidebar-footer-icon) {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
}

/* ===== FOOTER ===== */
.shell > .sidebar .sidebar-footer-card {
  position: relative;
  z-index: 12000;
  display: grid;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: var(--lf-radius-sm);
  background: transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-footer-link {
  width: 100%;
  appearance: none;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--lf-radius-md);
  background: transparent;
  color: var(--lf-palette-slate-600);
  box-shadow: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.shell > .sidebar .sidebar-footer-link:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-help-chevron {
  width: 18px;
  height: 18px;
  color: var(--lf-color-muted-light);
  transition: transform 0.45s ease, color 0.45s ease;
}

.shell > .sidebar .sidebar-help-trigger[aria-expanded="true"] .sidebar-help-chevron {
  transform: rotate(-90deg);
  color: var(--primary-color, var(--lf-color-primary));
}

.shell > .sidebar .sidebar-help-menu {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: calc(100% + 8px);
  z-index: 12050;
  width: auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(var(--lf-rgb-muted), 0.32);
  border-radius: var(--lf-radius-lg);
  background: rgba(var(--lf-rgb-surface-muted), 0.96);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 24px 60px rgba(var(--lf-rgb-text), 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: center bottom;
  transition: opacity 0.36s ease, visibility 0.36s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.shell > .sidebar .sidebar-help-menu::before {
  content: "";
  position: absolute;
  left: 28px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(var(--lf-rgb-muted), 0.32);
  border-bottom: 1px solid rgba(var(--lf-rgb-muted), 0.32);
  background: rgba(var(--lf-rgb-surface-muted), 0.96);
  transform: rotate(45deg);
  box-shadow: 8px 8px 18px rgba(var(--lf-rgb-text), 0.06);
}

.shell > .sidebar .sidebar-help-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.shell > .sidebar .sidebar-help-menu a {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 5px 10px 5px 12px;
  border: 0;
  border-radius: var(--lf-radius-md);
  background: transparent;
  color: var(--lf-color-text-soft);
  box-shadow: none;
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-750);
  text-decoration: none;
}

.shell > .sidebar .sidebar-help-menu a:hover {
  color: var(--primary-color, var(--lf-color-primary));
  background: transparent;
}

.shell > .sidebar .sidebar-help-menu-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color, var(--lf-color-primary));
}

.shell > .sidebar .sidebar-help-menu-icon svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 901px) {
  .shell > .sidebar.is-sidebar-collapsed .sidebar-footer-card {
    padding: 4px 0;
    border-color: transparent;
  }

  .shell > .sidebar.is-sidebar-collapsed .sidebar-help-menu {
    display: none !important;
  }
}

/* ===== PLAN CARD ===== */
.shell > .sidebar .sidebar-plan-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(var(--lf-rgb-secondary), 0.14);
  border-radius: var(--lf-radius-sm);
  background: transparent;
  color: #0b102f;
  text-decoration: none;
  box-shadow: none;
}

.shell > .sidebar .sidebar-plan-card:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--lf-rgb-secondary), 0.26);
  background: transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-plan-card.active {
  border-color: rgba(79, 70, 229, 0.42);
  border-left: 3px solid var(--lf-palette-indigo-600);
  background: transparent;
  box-shadow: none;
}

.shell > .sidebar .sidebar-plan-head,
.shell > .sidebar .sidebar-plan-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.shell > .sidebar .sidebar-plan-title {
  color: var(--primary-color, var(--lf-color-primary));
  font-size: var(--lf-font-size-xs);
  font-weight: var(--lf-font-weight-700);
  letter-spacing: 0;
}

.shell > .sidebar .sidebar-plan-kicker {
  color: var(--lf-palette-slate-600);
  font-size: var(--lf-font-size-sm);
  font-weight: var(--lf-font-weight-600);
  letter-spacing: 0;
}

.shell > .sidebar .sidebar-plan-percent {
  color: var(--primary-color, var(--lf-color-primary));
  font-size: var(--lf-font-size-xl);
  font-weight: var(--lf-font-weight-800);
  line-height: 1;
}

.shell > .sidebar .sidebar-plan-usage {
  margin: 0;
  color: var(--lf-color-muted);
  font-size: var(--lf-font-size-xs);
  font-weight: var(--lf-font-weight-500);
  line-height: 1.2;
}

.shell > .sidebar .sidebar-plan-track {
  height: 6px;
  overflow: hidden;
  border-radius: var(--lf-radius-pill);
  background: rgba(109, 74, 255, 0.12);
}

.shell > .sidebar .sidebar-plan-track span {
  display: block;
  width: var(--sidebar-plan-usage-percent, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #315bff, var(--lf-palette-violet-bright));
}

.shell > .sidebar .sidebar-plan-action {
  justify-content: flex-start;
  color: #5b4bff;
  font-size: var(--lf-font-size-xs);
  font-weight: var(--lf-font-weight-700);
}

.shell > .sidebar .sidebar-plan-action svg {
  width: 14px;
  height: 14px;
}

@media (min-width: 901px) {
  .shell > .sidebar.is-sidebar-collapsed .sidebar-plan-card {
    display: none !important;
  }
}

/* ===== RESPONSIVE ===== */
/* Final responsive contract for the shared authenticated sidebar. */
@media (max-width: 900px) {
  body.dashboard-client-flat-theme > .shell,
  body[data-company-theme] > .shell:has(> .sidebar),
  body.lf-clean-theme > .shell,
  .shell.is-sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  body.lf-clean-theme > .shell > .sidebar,
  body.dashboard-client-flat-theme > .shell > .sidebar,
  body[data-company-theme] > .shell > .sidebar,
  .shell.is-sidebar-collapsed > .sidebar {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    max-height: none;
    padding: 10px 12px;
    overflow: visible;
  }

  .sidebar .sidebar-usage-card {
    display: none !important;
  }

  .sidebar.is-sidebar-collapsed .sidebar-menu-panel > :not(.sidebar-nav-shell),
  .sidebar.is-sidebar-collapsed .sidebar-nav-shell .nav-dot,
  .sidebar.is-sidebar-collapsed .sidebar-nav-shell .sidebar-footer-actions,
  .sidebar.is-sidebar-collapsed .sidebar-nav-shell .sidebar-section-title:not(.sidebar-section-title--toggle) {
    display: none !important;
  }

  body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-nav-shell a.nav-dot,
  body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .sidebar-nav-shell a.nav-dot,
  body.lf-clean-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-nav-shell a.nav-dot,
  body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-nav-shell .sidebar-footer-actions,
  body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .sidebar-nav-shell .sidebar-footer-actions {
    display: none !important;
  }

  body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-brand-copy,
  body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .sidebar-brand-copy {
    width: auto;
    max-width: none;
    display: grid;
    opacity: 1;
    transform: none;
    overflow: visible;
    pointer-events: auto;
  }

  body.dashboard-client-flat-theme > .shell > .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle,
  body[data-company-theme] > .shell > .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle {
    width: 100%;
    min-height: 40px;
    display: flex;
    justify-content: space-between;
    padding: 4px;
  }

  .sidebar.is-sidebar-collapsed .sidebar-section-title--toggle > span {
    width: auto;
    max-width: none;
    opacity: 1;
    transform: none;
    overflow: visible;
    pointer-events: auto;
  }
}
}
