.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: #111315;
  padding: 28px 16px 24px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.06em;
  padding: 0 12px;
  margin-bottom: 32px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group {
  display: grid;
  gap: 24px;
}

.nav-section,
.nav-group--locked {
  display: grid;
  gap: 4px;
}

.nav-group--locked {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #969ba3;
  padding: 0 12px 8px;
}

.nav a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #b2b7bf;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link-label {
  display: block;
  grid-column: 2;
}

.nav-lock-note {
  display: block;
  grid-column: 2;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.42);
}

.nav a.active {
  background: #24292f;
  border-color: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 600;
}

.nav a:not(.is-locked):hover {
  background: #202429;
  color: #fff;
}

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid #bcd7ee;
  outline-offset: 3px;
}

.nav a.is-locked {
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.56);
  opacity: 1;
  cursor: not-allowed;
}

.nav a.is-locked.active {
  background: rgba(255, 255, 255, 0.02);
}

.nav .nav-admin-link {
  margin-top: 0;
  border-top-color: var(--border);
  border-radius: 9px;
}

.views {
  display: grid;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.view {
  display: none;
  min-height: 0;
  min-width: 0;
}

.view.active {
  display: flex;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 76px;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-context {
  flex: 1;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding: 0 0 0 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 10px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
}

.sidebar-toggle__icon {
  position: relative;
  width: 18px;
  height: 14px;
  display: inline-block;
}

.sidebar-toggle__icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform-origin: 50% 50%;
  transition:
    transform 0.28s ease,
    opacity 0.28s ease,
    top 0.28s ease,
    bottom 0.28s ease;
}

.sidebar-toggle__icon span:nth-child(1) {
  top: 0;
}

.sidebar-toggle__icon span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.sidebar-toggle__icon span:nth-child(3) {
  bottom: 0;
}

.sidebar-toggle__text {
  line-height: 1;
}

.sidebar-toggle.is-active .sidebar-toggle__icon span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.sidebar-toggle.is-active .sidebar-toggle__icon span:nth-child(2) {
  opacity: 0;
}

.sidebar-toggle.is-active .sidebar-toggle__icon span:nth-child(3) {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.sidebar-backdrop {
  display: none;
}

@media (min-width: 901px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 320px;
    height: 100dvh;
    box-sizing: border-box;
    padding: 82px 16px 24px;
    overflow: hidden;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.24s ease, visibility 0.24s ease;
  }
  .sidebar .brand { display: none; }
  .sidebar .nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .app.is-sidebar-open .sidebar { transform: translateX(0); visibility: visible; }
  .topbar-left { padding-left: 60px; }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 16px;
    left: 28px;
    z-index: 60;
    width: 44px;
    height: 44px;
    padding: 0;
    gap: 0;
    border-color: transparent;
    border-radius: 14px;
    background: #17191c;
  }
  .sidebar-toggle__text { display: none; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    border: 0;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .app.is-sidebar-open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
}

.company {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}

.account {
  position: relative;
}

.avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #24292f;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: #191c20;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  display: none;
  z-index: 5;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.account-menu.is-open {
  display: grid;
  gap: 4px;
}

.account-menu button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  min-height: 44px;
}

.account-menu button:hover {
  background: var(--panel-strong);
  border-color: var(--border);
}

.content {
  padding: 26px 28px 28px;
  display: grid;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.views {
  min-height: 0;
}

.view.active {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.view.active > .card,
.view.active > .overview-shell,
.view.active > .company-knowledge-shell,
.view.active > .company-proposals-shell,
.view.active > .team-shell,
.view.active > .integrations-shell,
.view.active > .settings-shell {
  display: grid;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.view.active > .consumer-chat-shell,
.view.active > .training-room-shell,
.view.active > .widget-history-shell {
  display: grid;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
html,
body {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .app,
  .sidebar,
  .nav a,
  .sidebar-toggle__icon span,
  .sidebar-backdrop {
    transition: none !important;
  }
}

@media (min-width: 901px) {
  .app {
    height: 100dvh;
    overflow: hidden;
  }

  .main {
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
  }
}
