:root {
  --expert-sidebar-width: 228px;
  --expert-sidebar-bg: #132737;
  --expert-sidebar-active: #0ba4b6;
}

.expert-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: var(--expert-sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  color: #dce8ef;
  background: var(--expert-sidebar-bg);
  font-family: Inter, Arial, sans-serif;
}

.expert-sidebar-brand,
.expert-mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

.expert-sidebar-brand {
  padding: 0 8px 22px;
}

.expert-sidebar-brand img {
  width: 38px;
}

.expert-sidebar-brand em,
.expert-mobile-brand em {
  color: #27d4aa;
  font-style: normal;
}

.workspace-switcher {
  position: relative;
  margin: 0 0 12px;
}

.workspace-switcher-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: #fff;
  background: #1b3446;
  text-align: left;
}

.workspace-switcher-button span,
.workspace-switcher-item span { min-width: 0; }
.workspace-switcher-button small,
.workspace-switcher-button strong,
.workspace-switcher-item small,
.workspace-switcher-item strong { display: block; }
.workspace-switcher-button small { color: #8fa8b8; font-size:calc(12px * var(--ui-text-scale, 1)); text-transform: uppercase; }
.workspace-switcher-button strong { overflow: hidden; margin-top: 3px; font-size:calc(13px * var(--ui-text-scale, 1)); text-overflow: ellipsis; white-space: nowrap; }
.workspace-switcher-button > svg { width: 15px; flex: 0 0 auto; }
.workspace-switcher.is-platform-preview .workspace-switcher-button {
  border-color: rgba(39, 212, 170, 0.55);
}
.workspace-switcher.is-platform-preview .workspace-switcher-button small {
  color: #48dfb9;
}

.workspace-switcher-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  left: 0;
  width: min(310px, calc(100vw - 28px));
  padding: 6px;
  border: 1px solid #d9e3e9;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(7, 24, 36, 0.24);
}

.workspace-switcher-item {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 0;
  border-radius: 4px;
  color: #193244;
  background: transparent;
  text-align: left;
}
.workspace-switcher-item:hover, .workspace-switcher-item.is-active { background: #edf9f7; }
.workspace-switcher-item strong { overflow: hidden; font-size:calc(14px * var(--ui-text-scale, 1)); text-overflow: ellipsis; white-space: nowrap; }
.workspace-switcher-item small { margin-top: 2px; color: #637785; font-size:calc(12px * var(--ui-text-scale, 1)); }
.workspace-switcher-item svg { width: 17px; }
.workspace-switcher-back { margin-top: 5px; border-top: 1px solid #e1e8ec; border-radius: 0 0 4px 4px; }

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

.expert-sidebar-create {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--expert-sidebar-active);
  font-size:calc(16px * var(--ui-text-scale, 1));
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

.expert-sidebar-create:hover,
.expert-sidebar-create:focus-visible {
  background: #078f9f;
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.expert-sidebar-create svg {
  width: 19px;
  height: 19px;
}

.expert-sidebar-link {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 5px;
  color: #cad8e1;
  background: transparent;
  font-size:calc(16px * var(--ui-text-scale, 1));
  text-decoration: none;
}

.expert-sidebar-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.expert-sidebar-link:hover,
.expert-sidebar-link:focus-visible {
  color: #fff;
  background: #1c3547;
  outline: none;
}

.expert-sidebar-link.is-active {
  color: #fff;
  background: var(--expert-sidebar-active);
}

.expert-sidebar-footer {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.expert-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.expert-sidebar-user + .expert-sidebar-link {
  margin-top: 8px;
}

.expert-sidebar-user > svg {
  width: 15px;
  margin-left: auto;
  color: #7892a3;
}

.expert-sidebar-user > div {
  min-width: 0;
}

.expert-sidebar-user strong,
.expert-sidebar-user div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expert-sidebar-user strong {
  color: #fff;
  font-size:calc(14px * var(--ui-text-scale, 1));
}

.expert-sidebar-user div span {
  margin-top: 3px;
  color: #91a7b6;
  font-size:calc(12px * var(--ui-text-scale, 1));
}

/* Design-only sidebar polish. Navigation and dimensions stay unchanged. */
.expert-sidebar {
  border-right: 1px solid rgba(108, 157, 177, 0.18);
  background: #122735;
  box-shadow: 10px 0 28px rgba(14, 34, 47, 0.07);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

.expert-sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 15px;
  padding-bottom: 18px;
}

.expert-sidebar-create,
.expert-sidebar-link,
.workspace-switcher-button {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}

.expert-sidebar-link {
  position: relative;
}

.expert-sidebar-link.is-active {
  background: #0a9eae;
  box-shadow: 0 7px 18px rgba(2, 18, 26, 0.17);
}

.expert-sidebar-link.is-active::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 2px;
  border-radius: 2px;
  background: #d9fff5;
}

.expert-sidebar-create {
  background: #079b78;
  box-shadow: 0 8px 18px rgba(3, 17, 24, 0.16);
}

.expert-sidebar-create:hover,
.expert-sidebar-create:focus-visible {
  background: #078565;
}

.expert-sidebar-create:active,
.expert-sidebar-link:active,
.workspace-switcher-button:active {
  transform: scale(.97);
}

@media (prefers-reduced-motion: reduce) {
  .expert-sidebar-create,
  .expert-sidebar-link,
  .workspace-switcher-button {
    transition: none;
  }
}

.expert-sidebar-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #0f6654;
  background: #fff center/cover no-repeat;
  font-size:calc(13px * var(--ui-text-scale, 1));
  font-weight: 800;
}

.expert-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 7px 0;
  border: 0;
  color: #aebfc9;
  background: transparent;
  font-size:calc(13px * var(--ui-text-scale, 1));
}

.expert-sidebar-logout:hover,
.expert-sidebar-logout:focus-visible {
  color: #fff;
  outline: none;
}

.expert-sidebar-logout svg {
  width: 15px;
}

.expert-sidebar-overlay,
.expert-sidebar-close,
.expert-mobile-header {
  display: none;
}

@media (max-width: 900px) {
  body[data-page="cabinet"] .mobile-menu-button[data-expert-sidebar-toggle] {
    display: grid;
  }

  .mobile-menu-button[data-expert-sidebar-toggle] {
    display: grid;
  }

  .expert-sidebar {
    width: min(88vw, 320px);
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 18px 0 50px rgba(7, 20, 29, 0.2);
  }

  .expert-sidebar.is-open {
    transform: translateX(0);
  }

  .expert-sidebar-link {
    min-height: 48px;
    font-size:calc(17px * var(--ui-text-scale, 1));
  }

  .expert-sidebar-footer {
    padding-top: 18px;
  }

  .expert-sidebar-logout {
    width: 100%;
    min-height: 44px;
  }

  .expert-sidebar-close {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #fff;
    background: transparent;
  }

  .expert-sidebar-close svg {
    width: 18px;
  }

  .expert-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    visibility: hidden;
    background: rgba(7, 20, 29, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .expert-sidebar-overlay.is-visible {
    visibility: visible;
    opacity: 1;
  }

  .expert-mobile-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid #d8e1e8;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
  }

  .expert-mobile-brand {
    color: #101820;
  }

  .expert-mobile-brand img {
    width: 32px;
  }

  .expert-mobile-menu-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #17212b;
    background: #fff;
    font-size:calc(16px * var(--ui-text-scale, 1));
    font-weight: 700;
  }

  .expert-mobile-create {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 0 10px;
    border-radius: 6px;
    color: #fff;
    background: var(--expert-sidebar-active);
    font-size:calc(14px * var(--ui-text-scale, 1));
    font-weight: 700;
    text-decoration: none;
  }

  .expert-mobile-create svg {
    width: 17px;
  }

  .expert-mobile-menu-button svg {
    width: 18px;
  }

  .cabinet-main,
  .inspect-main {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .expert-sidebar,
  .expert-sidebar-overlay {
    transition-duration: 0.01ms;
  }
}
