:root {
  --workspace-global-width: var(--sy-shell-rail-width, 52px);
  --workspace-module-width: 0px;
  --workspace-shell-gap: 0px;
  --workspace-motion-fast: var(--sy-motion-fast);
  --workspace-motion: var(--sy-shell-collapse-motion, 240ms);
  --workspace-ease: cubic-bezier(0.22, 0.75, 0.18, 1);
  --workspace-line: var(--sy-border);
  --workspace-surface: var(--sy-bg-surface);
  --workspace-subtle: var(--sy-bg-hover);
  --workspace-accent: var(--sy-primary);
  --workspace-accent-soft: var(--sy-primary-soft);
  --workspace-text: var(--sy-text-primary);
  --workspace-muted: var(--sy-text-tertiary);
}

@media (min-width: 651px) {
  .app.workspace-shell {
    position: relative;
    display: flex !important;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden;
  }

  .workspace-shell > .workspace-global-sidebar {
    position: relative;
    z-index: 6;
    width: var(--workspace-global-width) !important;
    min-width: 0 !important;
    height: 100dvh !important;
    flex: 0 0 var(--workspace-global-width) !important;
    margin-right: 0;
    padding: 12px 4px !important;
    overflow: visible !important;
    border: 0 !important;
    border-right: 1px solid var(--workspace-line) !important;
    border-radius: 0 !important;
    background: var(--sy-bg-panel) !important;
    box-shadow: none !important;
    transition:
      width var(--workspace-motion) var(--workspace-ease),
      flex-basis var(--workspace-motion) var(--workspace-ease),
      margin var(--workspace-motion) var(--workspace-ease),
      padding var(--workspace-motion) var(--workspace-ease),
      opacity var(--workspace-motion-fast) ease;
  }

  .workspace-shell.workspace-is-resizing,
  .workspace-shell.workspace-is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
  }

  .workspace-shell.workspace-is-resizing > .workspace-global-sidebar,
  .workspace-shell.workspace-is-resizing > .workspace-module-sidebar,
  .workspace-shell.workspace-is-resizing > .workspace-main {
    transition: none !important;
  }

  .workspace-global-sidebar .brand {
    flex: 0 0 auto;
    position: relative;
    min-height: 36px;
    margin: 0;
    padding: 0 0 20px;
    gap: 10px;
    overflow: visible;
    cursor: pointer;
  }

  .workspace-global-sidebar .brand:focus-visible {
    outline: 2px solid var(--sy-focus);
    outline-offset: 2px;
    border-radius: var(--sy-radius-sm);
  }

  .workspace-global-sidebar .brand .logo {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    overflow: hidden;
  }

  .workspace-global-sidebar .online {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .workspace-global-sidebar .online i {
    flex: 0 0 7px;
    margin-right: 0;
  }

  .workspace-global-sidebar .brand > div:last-of-type {
    min-width: 0;
    white-space: nowrap;
    opacity: 1;
    transform: translateX(0);
    transition:
      opacity var(--workspace-motion-fast) ease,
      transform var(--workspace-motion-fast) var(--workspace-ease);
  }

  .workspace-global-sidebar nav {
    display: grid;
    gap: 3px;
    min-height: 0;
    flex: 1 1 auto;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }
  .workspace-global-sidebar nav:hover { scrollbar-color: #bbb7b2 transparent; }
  .workspace-global-sidebar nav.is-scrolling { scrollbar-color: #bbb7b2 transparent; }
  .workspace-global-sidebar nav::-webkit-scrollbar { width: 6px; }
  .workspace-global-sidebar nav::-webkit-scrollbar-thumb { border-radius: var(--sy-radius-full); background: transparent; }
  .workspace-global-sidebar nav:hover::-webkit-scrollbar-thumb { background: #bbb7b2; }
  .workspace-global-sidebar nav.is-scrolling::-webkit-scrollbar-thumb { background: #bbb7b2; }

  .workspace-global-sidebar .side-btn {
    position: relative;
    min-height: 36px;
    white-space: nowrap;
    overflow: visible;
    transition:
      background-color var(--workspace-motion-fast) ease,
      color var(--workspace-motion-fast) ease,
      transform var(--workspace-motion-fast) var(--workspace-ease);
  }

  .workspace-global-sidebar .side-btn:active {
    transform: scale(0.96);
  }

  .workspace-global-sidebar .side-btn .ico {
    display: grid;
    place-items: center;
    width: var(--sy-icon-md);
    min-width: var(--sy-icon-md);
    height: var(--sy-icon-md);
    transition: transform var(--workspace-motion-fast) var(--workspace-ease);
  }

  .workspace-global-sidebar .side-bottom {
    min-width: 0;
    flex: 0 0 auto;
  }

  .workspace-global-sidebar .side-label { display: none; }

  .workspace-shell .workspace-global-sidebar .side-btn .sy-icon {
    width: 20px;
    height: 20px;
  }

  .workspace-sidebar-collapse,
  .workspace-module-collapse,
  .workspace-global-reveal,
  .workspace-module-reveal {
    display: grid;
    place-items: center;
    border: 0;
    color: var(--workspace-muted);
    background: transparent;
    font: inherit;
    cursor: pointer;
    transition:
      color var(--workspace-motion-fast) ease,
      background-color var(--workspace-motion-fast) ease,
      transform var(--workspace-motion-fast) var(--workspace-ease),
      opacity var(--workspace-motion-fast) ease;
  }

  .workspace-sidebar-collapse {
    position: absolute;
    top: 50%;
    right: -11px;
    z-index: 4;
    width: 22px;
    height: 42px;
    border: var(--sy-icon-button-border-width) solid var(--sy-icon-button-border-color);
    border-radius: calc(var(--sy-icon-button-radius) + 2px);
    background: var(--sy-icon-button-bg);
    box-shadow: 0 4px 14px rgba(59, 44, 35, 0.08);
    opacity: 0;
    transform: translate(2px, -50%);
  }

  .workspace-global-sidebar:has(> .workspace-resizer:hover) .workspace-sidebar-collapse,
  .workspace-global-sidebar:has(> .workspace-resizer:focus-visible) .workspace-sidebar-collapse,
  .workspace-sidebar-collapse:hover,
  .workspace-sidebar-collapse:focus-visible {
    opacity: 1;
    transform: translate(0, -50%);
  }

  .workspace-resizer {
    position: absolute;
    top: 16px;
    right: -4px;
    bottom: 16px;
    z-index: 3;
    width: 8px;
    cursor: col-resize;
    outline: 0;
  }

  .workspace-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    right: 3px;
    bottom: 0;
    width: 1px;
    border-radius: 99px;
    background: rgba(102, 83, 70, 0.08);
    transition:
      width var(--workspace-motion-fast) ease,
      background-color var(--workspace-motion-fast) ease;
  }

  .workspace-resizer:hover::after,
  .workspace-resizer:focus-visible::after,
  .workspace-shell.workspace-is-resizing .workspace-resizer::after {
    width: 2px;
    background: rgba(237, 125, 59, 0.42);
  }

  .workspace-shell.workspace-global-compact > .workspace-global-sidebar {
    padding-right: 7px !important;
    padding-left: 7px !important;
  }

  .workspace-shell.workspace-global-compact .workspace-global-sidebar .brand {
    justify-content: center;
    padding: 0 0 20px;
  }

  .workspace-shell.workspace-global-compact .workspace-global-sidebar .brand > div:last-of-type,
  .workspace-shell.workspace-global-compact .workspace-global-sidebar .side-label,
  .workspace-shell.workspace-global-compact .workspace-global-sidebar .online span,
  .workspace-shell.workspace-global-compact .workspace-global-sidebar .profile > div,
  .workspace-shell.workspace-global-compact .workspace-global-sidebar .profile > strong {
    display: none;
  }

  .workspace-shell.workspace-global-compact
    .workspace-global-sidebar
    .side-btn {
    justify-content: center;
    gap: 0;
    width: 36px;
    height: 36px;
    min-height: 36px;
    margin-inline: auto;
    padding: 0;
    border-radius: var(--sy-radius-sm);
  }

  .workspace-shell.workspace-global-compact
    .workspace-global-sidebar
    .side-btn
    .ico {
    color: currentColor;
    font-size: 18px;
  }

  .workspace-shell.workspace-global-compact
    .workspace-global-sidebar
    .side-btn:hover
    .ico,
  .workspace-shell.workspace-global-compact
    .workspace-global-sidebar
    .side-btn.active
    .ico {
    color: var(--workspace-accent);
    transform: scale(1.02);
  }

  .workspace-shell.workspace-global-compact
    .workspace-global-sidebar
    .side-bottom {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 14px 0 0;
  }

  .workspace-shell.workspace-global-compact .workspace-global-sidebar .online {
    justify-content: center;
    margin: 0;
  }

  .workspace-shell.workspace-global-compact .workspace-global-sidebar .profile {
    justify-content: center;
    width: 36px;
    min-height: 36px;
    padding: 3px;
  }

  .workspace-shell.workspace-global-compact .workspace-global-sidebar .profile-avatar,
  .workspace-shell.workspace-global-compact .workspace-global-sidebar .profile-avatar img {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .workspace-shell.workspace-global-hidden > .workspace-global-sidebar {
    width: 0 !important;
    flex-basis: 0 !important;
    margin-right: 0;
    padding-right: 0 !important;
    padding-left: 0 !important;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
  }

  .workspace-module-sidebar {
    position: relative;
    z-index: 5;
    display: flex;
    width: var(--workspace-module-width);
    min-width: 0;
    height: 100dvh;
    min-height: 0;
    flex: 0 0 var(--workspace-module-width);
    flex-direction: column;
    padding: 0 !important;
    margin-right: 0;
    overflow: visible;
    border: 0;
    border-right: 1px solid var(--workspace-line);
    border-radius: 0;
    background: var(--sy-bg-panel);
    box-shadow: none;
    backdrop-filter: none;
    transition:
      width var(--workspace-motion) var(--workspace-ease),
      flex-basis var(--workspace-motion) var(--workspace-ease),
      margin var(--workspace-motion) var(--workspace-ease),
      opacity var(--workspace-motion-fast) ease,
      transform var(--workspace-motion) var(--workspace-ease);
  }

  #app.workspace-shell > #workspaceModuleSidebar {
    width: var(--workspace-module-width) !important;
    flex: 0 0 var(--workspace-module-width) !important;
  }

  .workspace-module-sidebar[hidden],
  .workspace-shell.workspace-module-hidden > .workspace-module-sidebar {
    display: flex !important;
    width: 0;
    flex-basis: 0;
    margin-right: 0;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
  }

  .workspace-module-header {
    display: flex;
    min-height: 58px;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--workspace-line);
  }

  .workspace-module-header span {
    min-width: 0;
    flex: 1;
  }

  .workspace-module-header b,
  .workspace-module-header small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-module-header b {
    color: var(--workspace-text);
    font-size: var(--sy-type-module-size);
    font-weight: 600;
  }

  .workspace-module-header small {
    margin-top: 2px;
    color: var(--sy-text-secondary);
    font-size: var(--sy-type-helper-size);
  }

  .workspace-module-collapse {
    width: var(--sy-icon-button-size-sm);
    height: var(--sy-icon-button-size-sm);
    flex: none;
    padding: var(--sy-icon-button-padding);
    border: var(--sy-icon-button-border-width) solid var(--sy-icon-button-border-color);
    border-radius: var(--sy-icon-button-radius);
    background: var(--sy-icon-button-bg);
    box-shadow: var(--sy-icon-button-shadow);
    opacity: .68;
  }

  .workspace-module-header:hover .workspace-module-collapse,
  .workspace-module-collapse:focus-visible,
  .workspace-module-collapse:hover { opacity: 1; }

  .workspace-module-content {
    min-width: 0;
    min-height: 0;
    flex: 1;
    overflow: hidden;
  }

  .workspace-knowledge-root,
  .workspace-knowledge-context {
    box-sizing: border-box;
    min-width: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }
  .workspace-knowledge-root:hover,
  .workspace-knowledge-context:hover { scrollbar-color: rgba(0,0,0,.18) transparent; }
  .workspace-knowledge-root[hidden],
  .workspace-knowledge-context[hidden] { display: none !important; }
  .workspace-knowledge-root { padding: 12px 10px; }
  .workspace-knowledge-root .docs-category-head { padding: 7px 10px 10px; }
  .workspace-knowledge-root .docs-category { width: 100%; min-height: var(--sy-shell-item-height, 36px); border-radius: var(--sy-radius-sm, 8px); }
  .workspace-knowledge-context { padding: 12px 10px; }
  .workspace-knowledge-list { display: grid; gap: 3px; min-width: 0; margin: 12px 0; }
  .workspace-knowledge-back,
  .workspace-knowledge-item,
  .workspace-knowledge-new {
    display: flex; align-items: center; gap: 8px; box-sizing: border-box;
    width: 100%; min-height: 36px; padding: 6px 9px;
    border: 0; border-radius: var(--sy-radius-sm, 8px);
    background: transparent; color: var(--sy-text-secondary); text-align: left;
    font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1.35; cursor: pointer;
    transition: background-color var(--sy-motion-fast, 120ms) ease, color var(--sy-motion-fast, 120ms) ease;
  }
  .workspace-knowledge-back { color: var(--sy-text-primary); font-weight: 600; }
  .workspace-knowledge-new { border-top: 1px solid var(--workspace-line); border-radius: 0; color: var(--sy-primary); }
  .workspace-knowledge-back:hover,
  .workspace-knowledge-item:hover,
  .workspace-knowledge-new:hover { background: var(--sy-bg-hover); }
  .workspace-knowledge-item.active { background: var(--sy-primary-soft); color: var(--sy-primary-active); }
  .workspace-knowledge-context i,
  .workspace-knowledge-context .sy-icon { width: 17px; height: 17px; flex: none; }
  .workspace-knowledge-context span { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-knowledge-context button:focus-visible,
  .workspace-knowledge-root button:focus-visible { outline: 2px solid var(--sy-focus); outline-offset: -2px; }

  .workspace-module-content button > span,
  .workspace-module-content .docs-category > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-module-content > .docs-categories,
  .workspace-module-content > .chat-sidebar {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .workspace-module-content > .docs-categories .docs-category-head {
    display: none;
  }

  .workspace-module-content > .chat-sidebar.workspace-chat-ported > .chat-sidebar-head {
    display: none !important;
  }

  .workspace-module-chat .workspace-chat-actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 5px;
    margin-left: auto;
  }

  .workspace-module-chat .workspace-chat-actions .round {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 8px !important;
  }

  .workspace-module-chat .workspace-module-header {
    min-height: 58px;
    gap: 6px;
    padding: 0 12px;
  }

  .workspace-module-chat .workspace-module-header b {
    font-size: 15px;
  }

  .workspace-module-chat .workspace-chat-actions {
    gap: 4px;
  }

  .workspace-module-menu {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }

  .workspace-module-menu:hover,
  .workspace-module-menu.is-scrolling {
    scrollbar-color: #bbb7b2 transparent;
  }
  .workspace-module-menu::-webkit-scrollbar { width: 6px; }
  .workspace-module-menu::-webkit-scrollbar-thumb { border-radius: 99px; background: transparent; }
  .workspace-module-menu:hover::-webkit-scrollbar-thumb,
  .workspace-module-menu.is-scrolling::-webkit-scrollbar-thumb { background: #bbb7b2; }

  .workspace-module-menu button {
    display: flex;
    min-height: var(--sy-shell-item-height, 36px);
    flex: 0 0 auto;
    align-items: center;
    gap: var(--sy-icon-text-gap);
    width: 100%;
    padding: 0 10px;
    border: 0;
    border-radius: var(--sy-radius-sm);
    background: transparent;
    color: var(--sy-text-secondary);
    font: 500 13px/18px var(--sy-font-family);
    text-align: left;
    cursor: pointer;
    transition:
      background-color var(--workspace-motion-fast) ease,
      color var(--workspace-motion-fast) ease,
      transform var(--workspace-motion-fast) var(--workspace-ease);
  }

  .workspace-module-menu button[hidden] { display: none; }

  .workspace-module-menu button:hover {
    color: var(--workspace-text);
    background: var(--workspace-subtle);
  }

  .workspace-module-menu button:active {
    transform: scale(0.985);
  }

  .workspace-module-menu button.active {
    color: var(--sy-primary-active);
    background: var(--workspace-accent-soft);
  }

  .workspace-module-menu button i {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: none;
    color: currentColor;
    font-style: normal;
  }

  .workspace-module-menu .workspace-module-separator {
    height: 1px;
    flex: none;
    margin: 7px 6px;
    background: var(--workspace-line);
  }

  .workspace-module-menu small {
    display: block;
    margin: -1px 9px 5px;
    color: var(--workspace-muted);
    font-size: 11px;
  }

  .workspace-sidebar-section {
    min-width: 0;
    flex: 0 0 auto;
  }

  .workspace-module-menu .workspace-sidebar-section-toggle {
    display: flex;
    width: 100%;
    min-height: 30px;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: var(--sy-text-tertiary);
    font-size: 12px;
    font-weight: 600;
  }

  .workspace-sidebar-section-toggle .sy-icon {
    flex: none;
    transition: transform var(--sy-shell-section-motion, 180ms) ease;
  }

  .workspace-sidebar-section.is-collapsed .workspace-sidebar-section-toggle .sy-icon {
    transform: rotate(-90deg);
  }

  .workspace-sidebar-section-body {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows var(--sy-shell-section-motion, 180ms) ease,
      opacity var(--sy-shell-section-motion, 180ms) ease;
  }

  .workspace-sidebar-section-body > div {
    min-height: 0;
    overflow: hidden;
  }

  .workspace-sidebar-section.is-collapsed .workspace-sidebar-section-body {
    grid-template-rows: 0fr;
    opacity: 0;
    pointer-events: none;
  }

  .workspace-sidebar-section-body .workspace-ai-project-list {
    padding: 0 0 2px;
  }

  .workspace-ai-project-heading {
    padding: 5px 10px 7px;
    color: var(--workspace-muted);
    font: 600 12px/18px var(--sy-font-family);
  }

  .workspace-ai-project-list {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 2px;
  }

  .workspace-ai-project-row {
    display: flex;
    align-items: center;
    min-width: 0;
    border-radius: var(--sy-radius-sm, 8px);
  }

  .workspace-ai-project-row > button[data-workspace-ai-project] {
    min-height: var(--sy-shell-item-height, 36px);
    max-height: 40px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .workspace-ai-project-row > button[data-workspace-ai-project] span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-module-menu .workspace-ai-project-more {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--workspace-muted);
    opacity: 0;
    border-radius: var(--sy-radius-sm, 8px);
  }
  .workspace-ai-project-row:hover .workspace-ai-project-more,
  .workspace-ai-project-more:focus-visible { opacity: 1; }
  .workspace-module-menu .workspace-ai-project-more:hover { background: var(--sy-bg-hover); color: var(--sy-primary); }
  .workspace-ai-project-actions {
    position: fixed;
    z-index: 10010;
    width: 132px;
    padding: 4px;
    border: 1px solid var(--workspace-line);
    border-radius: var(--sy-radius-sm, 8px);
    background: #fff;
    box-shadow: 0 8px 24px rgba(35, 28, 22, .12);
  }
  .workspace-ai-project-actions button {
    display: block;
    width: 100%;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
  }
  .workspace-ai-project-actions button:hover { background: var(--sy-bg-hover); }
  .workspace-ai-project-actions button.danger { color: #ba4c42; }

  .workspace-module-menu .workspace-ai-new {
    margin-top: 6px;
    border-top: 1px solid var(--workspace-line);
    border-radius: 0 0 var(--sy-radius-sm) var(--sy-radius-sm);
  }

  .workspace-main {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100dvh !important;
    flex: 1 1 auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0;
    border-radius: 0;
    background: var(--sy-bg-surface);
    box-shadow: none;
    transition: padding var(--workspace-motion) var(--workspace-ease);
  }

  /* The Shell owns the single outer frame. Global main scrollbar reservation
     and legacy page cards otherwise expose a second strip at the right/bottom. */
  .workspace-module-chat .workspace-main,
  .workspace-module-aiCanvas .workspace-main,
  .workspace-module-users .workspace-main {
    scrollbar-gutter: auto;
  }

  .workspace-module-chat #content .message-workspace,
  .workspace-module-aiCanvas #content .ai-canvas-workspace {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .workspace-main > header {
    flex: 0 0 auto;
    min-height: 58px;
    margin: 0 !important;
    padding: 10px 18px !important;
    border-bottom: 1px solid var(--workspace-line);
    background: var(--workspace-surface);
  }

  .workspace-main > #content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 16px 18px 24px;
    overflow: auto;
  }

  .workspace-shell.workspace-global-hidden > .workspace-module-sidebar,
  .workspace-shell.workspace-global-hidden.workspace-module-visible > .workspace-module-sidebar {
    border-radius: 0;
  }

  .workspace-shell.workspace-global-hidden.workspace-module-hidden > .workspace-main {
    border-left: 0;
    border-radius: 0;
  }

  .workspace-global-reveal,
  .workspace-module-reveal {
    position: absolute;
    z-index: 12;
    width: 32px;
    height: 32px;
    border: 1px solid var(--workspace-line);
    border-radius: 10px;
    background: rgba(255, 253, 251, 0.95);
    box-shadow: 0 5px 18px rgba(59, 44, 35, 0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
  }

  .workspace-global-reveal {
    top: 50%;
    left: 0;
    width: 22px;
    height: 42px;
    border-radius: 0 10px 10px 0;
    transform: translate(-2px, -50%);
  }

  .workspace-module-reveal {
    top: 54px;
    left: calc(4px + var(--workspace-global-width));
  }

  /* Shared visual language only: the edge handle keeps its own dimensions and position. */
  .workspace-module-collapse,
  .workspace-sidebar-collapse,
  .workspace-module-reveal {
    color: var(--sy-icon-button-color);
    border-color: var(--sy-icon-button-border-color);
    transition:
      color var(--sy-motion-fast) ease,
      background-color var(--sy-motion-fast) ease,
      border-color var(--sy-motion-fast) ease,
      transform var(--workspace-motion-fast) var(--workspace-ease),
      opacity var(--workspace-motion-fast) ease;
  }

  .workspace-module-collapse:hover,
  .workspace-sidebar-collapse:hover,
  .workspace-module-reveal:hover {
    color: var(--sy-icon-button-color-hover);
    background: var(--sy-icon-button-bg-hover);
    border-color: var(--sy-border-strong);
  }

  .workspace-module-collapse:active,
  .workspace-sidebar-collapse:active,
  .workspace-module-reveal:active {
    background: var(--sy-icon-button-bg-pressed);
  }

  .workspace-module-collapse:focus-visible,
  .workspace-sidebar-collapse:focus-visible,
  .workspace-module-reveal:focus-visible {
    outline: 2px solid var(--sy-border-focus);
    outline-offset: 2px;
  }

  .workspace-module-collapse .sy-icon {
    width: var(--sy-icon-xs);
    height: var(--sy-icon-xs);
    pointer-events: none;
  }

  .workspace-sidebar-collapse .sy-icon,
  .workspace-module-reveal .sy-icon {
    width: var(--sy-icon-sm);
    height: var(--sy-icon-sm);
    pointer-events: none;
  }

  .workspace-shell.workspace-module-hidden.workspace-has-module
    > .workspace-module-reveal {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  body:has(> .workspace-hot-zone:hover)
    > .workspace-shell.workspace-global-hidden
    > .workspace-global-reveal,
  body:has(> .workspace-hot-zone:focus-visible)
    > .workspace-shell.workspace-global-hidden
    > .workspace-global-reveal,
  .workspace-shell.workspace-global-hidden > .workspace-global-reveal:hover,
  .workspace-shell.workspace-global-hidden > .workspace-global-reveal:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
  }

  .workspace-hot-zone {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 11;
    display: none;
    width: 10px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .workspace-hot-zone:focus,
  .workspace-hot-zone:focus-visible {
    outline: 0;
  }

  .workspace-shell.workspace-global-hidden ~ .workspace-hot-zone,
  body:has(.workspace-shell.workspace-global-hidden) > .workspace-hot-zone {
    display: block;
  }

  .workspace-tooltip {
    position: fixed;
    z-index: 12000;
    max-width: 220px;
    padding: 6px 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(45, 40, 36, 0.94);
    color: #fff;
    box-shadow: 0 7px 20px rgba(31, 25, 21, 0.17);
    font-size: 12px;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px) scale(0.98);
    transition:
      opacity 120ms ease,
      transform 120ms var(--workspace-ease);
  }

  .workspace-tooltip.open {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  .docs-shell.workspace-with-module,
  .md-docs-shell.workspace-with-module {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #content .docs-shell.workspace-with-module,
  #content .md-docs-shell.workspace-with-module {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  @media (min-width: 1024px) {
    .workspace-module-documents #content .docs-shell > .docs-categories,
    .workspace-module-documents #content .md-docs-shell > .docs-categories { display: none !important; }
  }

  .chat-shell.workspace-with-module,
  main.message-page .chat-shell.workspace-with-module,
  .view-chat .chat-shell.workspace-with-module {
    grid-template-columns: minmax(0, 1fr) !important;
    background: #fffdfb !important;
  }

  #content .chat-shell.workspace-with-module,
  main.message-page #content .chat-shell.workspace-with-module,
  #content.view-chat .chat-shell.workspace-with-module {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #content .chat-shell.workspace-with-module > .chat-main {
    grid-column: 1 !important;
  }

  .workspace-module-attendance #content .sv2-tabs,
  .workspace-module-attendance #content .sv2-subtabs,
  .workspace-module-users #content .account-tabs {
    display: none !important;
  }

  .workspace-module-attendance #content .schedule-v2,
  .workspace-module-users #content .admin-page-shell {
    padding-top: 0;
  }

  .workspace-module-users #content .admin-tab-stage,
  .workspace-module-attendance #content .sv2-body {
    padding-top: 12px;
  }

  .workspace-module-users
    #content
    .admin-tab-stage:has(> .account-logs-view) {
    padding-top: 0;
  }

  .workspace-module-users #content .admin-page-shell,
  .workspace-module-attendance #content .schedule-v2 {
    grid-template-rows: minmax(0, 1fr) !important;
  }

  .workspace-module-users #content .admin-tab-stage,
  .workspace-module-attendance #content .sv2-body {
    grid-row: 1;
  }

  .workspace-module-users .workspace-main > header,
  .workspace-module-attendance .workspace-main > header,
  .workspace-module-documents .workspace-main > header {
    display: none !important;
  }

  .workspace-module-users .workspace-main > #content,
  .workspace-module-attendance .workspace-main > #content,
  .workspace-module-documents .workspace-main > #content,
  .workspace-module-chat .workspace-main > #content,
  .workspace-module-aiCanvas .workspace-main > #content {
    width: 100%;
    height: 100%;
    padding: 0 !important;
    overflow: hidden;
  }

  .workspace-module-documents #content .docs-shell.workspace-with-module {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .workspace-module-documents #content .docs-shell.workspace-with-module > .docs-main {
    min-height: 0;
    height: 100%;
    padding: 18px 20px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .workspace-module-chat .workspace-module-content > .chat-sidebar {
    display: grid !important;
    grid-template-rows: 42px 40px minmax(0, 1fr) !important;
    padding: 8px !important;
  }

  .workspace-module-chat .conversation-search {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 5px;
    height: 34px;
    margin: 2px 2px 6px;
    padding: 0 8px;
    border: 1px solid var(--workspace-line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--workspace-muted);
  }

  .workspace-module-chat .conversation-search input {
    width: 100%;
    height: 30px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
  }

  .workspace-module-chat .conversation-search button {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--workspace-muted);
    cursor: pointer;
  }

  .workspace-module-chat .conversation-mode-switch {
    height: 34px !important;
    margin: 0 2px 6px !important;
  }

  .workspace-module-chat .conversation-list {
    grid-row: 3 !important;
    min-height: 0 !important;
    padding: 0 0 8px !important;
    overflow-y: auto !important;
  }

  .conversation-list-state {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 28px 12px;
    color: var(--workspace-muted);
    text-align: center;
  }

  .conversation-list-state b {
    color: #625750;
    font-size: 12px;
  }

  .conversation-list-state small,
  .conversation-category-note {
    color: var(--workspace-muted);
    font-size: 10px;
  }

  .conversation-category-note {
    padding: 2px 9px 7px;
  }

  .workspace-global-hidden.workspace-module-hidden .workspace-main {
    padding: 0 !important;
  }
}

@media (max-width: 1440px) and (min-width: 901px) {
  :root {
    --workspace-shell-gap: 0px;
  }

  .workspace-main {
    padding: 0 !important;
  }
}

@media (max-width: 900px) and (min-width: 651px) {
  .app.workspace-shell {
    padding: 8px !important;
  }

  .workspace-shell > .workspace-global-sidebar,
  .workspace-module-sidebar,
  .workspace-main {
    height: calc(100vh - 16px) !important;
  }

  .workspace-module-sidebar {
    max-width: min(240px, 32vw);
  }

  .workspace-main {
    padding: 0 !important;
  }
}

@media (max-width: 650px) {
  .workspace-module-sidebar,
  .workspace-global-reveal,
  .workspace-module-reveal,
  .workspace-hot-zone,
  .workspace-tooltip,
  .workspace-resizer,
  .workspace-sidebar-collapse {
    display: none !important;
  }
}

/* The arrow beside the chat avatar is a separate return control, not the
   module-sidebar toggle. Match its desktop IconButton visual without changing
   its existing click handler or the 44px mobile touch target. */
@media (min-width: 1024px) {
  .chat-main-head > .mobile-chat-back {
    display: var(--sy-chat-back-display-desktop, none);
    place-items: center;
    width: var(--sy-icon-button-size-sm);
    height: var(--sy-icon-button-size-sm);
    flex: none;
    padding: var(--sy-icon-button-padding);
    border: var(--sy-icon-button-border-width) solid var(--sy-icon-button-border-color);
    border-radius: var(--sy-icon-button-radius);
    background: var(--sy-icon-button-bg);
    box-shadow: var(--sy-icon-button-shadow);
    color: var(--sy-icon-button-color);
    cursor: pointer;
    transition: color var(--sy-motion-fast), background-color var(--sy-motion-fast), border-color var(--sy-motion-fast);
  }
  .chat-main-head > .mobile-chat-back:hover {
    color: var(--sy-icon-button-color-hover);
    background: var(--sy-icon-button-bg-hover);
    border-color: var(--sy-border-strong);
  }
  .chat-main-head > .mobile-chat-back:active { background: var(--sy-icon-button-bg-pressed); }
  .chat-main-head > .mobile-chat-back:focus-visible {
    outline: 2px solid var(--sy-border-focus);
    outline-offset: 2px;
  }
  .chat-main-head > .mobile-chat-back .sy-icon {
    width: var(--sy-chat-back-icon-size, var(--sy-icon-xs));
    height: var(--sy-chat-back-icon-size, var(--sy-icon-xs));
    color: var(--sy-chat-back-icon-color, currentColor);
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-shell > .workspace-global-sidebar,
  .workspace-module-sidebar,
  .workspace-main,
  .workspace-global-sidebar .brand > div:last-of-type,
  .workspace-global-reveal,
  .workspace-module-reveal,
  .workspace-module-collapse,
  .workspace-sidebar-collapse,
  .chat-main-head > .mobile-chat-back,
  .workspace-tooltip {
    transition-duration: 1ms !important;
  }
}
