/**
 * Workspace Hub sidebar overrides — не затирается sync-handoff-full.mjs.
 * Узкий постоянный rail: без логотипа, мелкие иконки, подписи по hover.
 */
.ws-body {
  --ws-left-rail-w: 52px;
}
.ws-body #ws-hub-sidebar.catalog-sidebar {
  z-index: 90;
  width: var(--ws-left-rail-w) !important;
  padding: 10px 6px 12px;
  overflow: visible;
  background: rgba(0, 0, 0, 0.35);
  border-right: 1px solid rgba(0, 210, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.ws-body #ws-hub-sidebar.catalog-sidebar:hover,
.ws-body #ws-hub-sidebar.catalog-sidebar:focus-within,
.ws-body #ws-hub-sidebar.catalog-sidebar.is-collapsed {
  width: var(--ws-left-rail-w) !important;
  padding-inline: 6px;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__head,
.ws-body #ws-hub-sidebar .catalog-sidebar__toggle {
  display: none !important;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__nav {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
  flex: 1;
  padding-top: 4px;
  gap: 4px;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__bottom {
  padding-top: 8px;
  margin-top: 0;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__link {
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  margin-inline: auto;
  justify-content: center;
  border-radius: 10px;
  overflow: visible;
  position: relative;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__icon {
  width: 20px;
  height: 20px;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__icon svg {
  width: 18px;
  height: 18px;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__label {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  flex: none;
  max-width: none;
  width: max-content;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(12, 18, 32, 0.96);
  border: 1px solid rgba(0, 210, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  z-index: 120;
  transition: opacity 0.14s ease, visibility 0.14s ease;
}
.ws-body #ws-hub-sidebar.catalog-sidebar:hover .catalog-sidebar__label,
.ws-body #ws-hub-sidebar.catalog-sidebar:focus-within .catalog-sidebar__label {
  opacity: 0;
  visibility: hidden;
  max-width: 0;
}
.ws-body #ws-hub-sidebar .catalog-sidebar__link:hover .catalog-sidebar__label,
.ws-body #ws-hub-sidebar .catalog-sidebar__link:focus-visible .catalog-sidebar__label {
  opacity: 1 !important;
  visibility: visible !important;
  max-width: none !important;
}
body.ws-hub-sidebar-rail {
  --ws-editor-left-overlay: 0px;
}

/* ── Mobile phase 1 (≤768px) — не затирается handoff-sync ── */
@media (max-width: 768px) {
  .ws-body {
    --ws-left-rail-w: 0px;
    --ws-editor-left-overlay: 0px;
  }

  .ws-body #ws-hub-sidebar.catalog-sidebar {
    display: none !important;
  }

  .ws-shell {
    margin-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw;
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    overflow-x: clip;
  }

  .ws-cat-rail {
    display: none !important;
  }

  .ws-cat-panel:not([hidden]) {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(52vh, 420px);
    border-radius: 16px 16px 0 0;
    z-index: 220;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
  }

  body.ws-right-stack-open .ws-ai-stack--docked {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 280;
    margin: 0 !important;
    padding-top: env(safe-area-inset-top, 0px);
  }

  body.ws-right-stack-open .ws-ai-stack--docked > .ws-ai-panel,
  body.ws-right-stack-open .ws-ai-stack--docked > .ws-smeta-panel {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 48px);
  }

  body.ws-right-stack-open .ws-ai-stack__toggle {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: 8px;
    z-index: 300;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(12, 18, 32, 0.92);
    border: 1px solid rgba(0, 210, 255, 0.25);
  }

  .ws-inspector:not([hidden]),
  .ws-inspector#ws-sketch-inspector:not([hidden]) {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 260;
    border-radius: 0;
  }

  #ws-canvas,
  .ws-canvas-wrap {
    touch-action: none;
  }

  .ws-mobile-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 240;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(8, 12, 22, 0.96);
    border-top: 1px solid rgba(0, 210, 255, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .ws-mobile-tab-bar[hidden] {
    display: none !important;
  }

  .ws-mobile-tab-bar__btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 4px 2px;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .ws-mobile-tab-bar__btn i {
    font-size: 18px;
    line-height: 1;
  }

  .ws-mobile-tab-bar__btn.is-active {
    color: #67e8f9;
    background: rgba(0, 210, 255, 0.1);
  }
}

@media (min-width: 769px) {
  .ws-mobile-tab-bar {
    display: none !important;
  }
}
