/* Shared navigation for the customer workbench and its knowledge pages.
   Match Wanxiang's studio rail and member chrome. */
:root { --portal-header-height: 80px; }
.portal-sidebar-layout {
  --portal-sidebar-width: 212.4px;
  --portal-sidebar-bg: #f6f3ed;
  --portal-sidebar-border: #e2ddd4;
  --portal-sidebar-hover: #ece6dc;
  --portal-sidebar-ink: #292d37;
  --portal-sidebar-selected: rgb(17 24 39 / 9%);
}
html[data-sidebar-collapsed="true"] .portal-sidebar-layout { --portal-sidebar-width: 76px; }
/* Own the shared shell here: page-specific compact and knowledge styles must
   not resize the header (or move the sidebar) when switching sections. */
body.portal-sidebar-layout > .app-header {
  position: sticky; top: 0; z-index: 80; box-sizing: border-box;
  height: 80px; min-height: 80px; flex: none; flex-wrap: nowrap;
  padding: 0 36px; gap: 24px;
}
body.portal-sidebar-layout > .app-header > .brand {
  height: auto; min-height: 0; padding: 0; gap: 12px; justify-content: flex-start;
  border: 0; background: none; font-size: 19px;
}
body.portal-sidebar-layout > .app-header > .brand strong { font-size: inherit; }
body.portal-sidebar-layout > .app-header > .header-actions {
  display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 26px;
}
body.portal-sidebar-layout > .app-header .header-actions > .download {
  box-sizing: border-box; height: 46px; min-height: 46px; padding: 0 20px;
  gap: 8px; font-size: 15px; line-height: 1.5;
}
@media (max-width: 900px) {
  body.portal-sidebar-layout > .app-header { padding-inline: 18px; gap: 16px; }
  body.portal-sidebar-layout > .app-header > .header-actions { gap: 16px; }
}
@media (max-width: 760px) {
  body.portal-sidebar-layout > .app-header {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    height: auto; padding: 14px 16px; gap: 12px;
  }
  body.portal-sidebar-layout > .app-header > .brand { grid-area: 1 / 1; font-size: 16px; }
  body.portal-sidebar-layout > .app-header > .header-actions { display: contents; }
  body.portal-sidebar-layout > .app-header .header-actions > #account-menu { grid-area: 1 / 2; justify-self: end; margin: 0; }
  body.portal-sidebar-layout > .app-header .header-actions > .portal-header-tools { grid-area: 2 / 1; justify-self: start; }
  body.portal-sidebar-layout > .app-header .header-actions > .download { grid-area: 2 / 2; justify-self: end; margin: 0; }
}
.portal-sidebar-layout .workspace-sidebar {
  position: fixed; inset: var(--portal-header-height) auto 0 0; z-index: 70;
  display: flex; flex-direction: column; align-items: stretch; gap: 24px; width: var(--portal-sidebar-width);
  max-width: none; margin: 0; padding: 20px 14px; box-sizing: border-box;
  background: var(--portal-sidebar-bg); color: var(--portal-sidebar-ink);
  border: 0; border-right: 1px solid var(--portal-sidebar-border);
  overflow: hidden; overscroll-behavior: contain;
}
.portal-sidebar-layout .workspace-sidebar-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 36px; }
.portal-sidebar-layout .workspace-sidebar-caption { padding-left: 12px; color: var(--portal-muted, #667085); font-size: 12px; font-weight: 600; white-space: nowrap; }
.portal-sidebar-layout .portal-sidebar-toggle {
  position: fixed; left: calc(var(--portal-sidebar-width) - 18px); z-index: 75;
  top: calc(50vh + var(--portal-header-height) / 2);
  top: calc(50dvh + var(--portal-header-height) / 2); transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 44px; min-height: 44px; margin: 0; padding: 7px; box-sizing: border-box;
  border: 1px solid var(--portal-sidebar-border); border-radius: 9px; background: var(--portal-sidebar-bg); color: var(--portal-sidebar-ink); cursor: pointer;
  box-shadow: 0 2px 6px rgb(16 24 40 / 8%);
}
.portal-sidebar-layout .portal-sidebar-toggle:hover { background: var(--portal-sidebar-hover); color: var(--portal-sidebar-ink); }
.portal-sidebar-layout .portal-sidebar-toggle svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.portal-sidebar-toggle [data-sidebar-toggle-label] { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.portal-sidebar-layout .workspace-sidebar svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.portal-sidebar-layout .workspace-sidebar .workspace-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; width: 100%; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.portal-sidebar-layout .workspace-nav-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.portal-sidebar-layout .workspace-nav-group + .workspace-nav-group { margin-top: 14px; }
.portal-sidebar-layout .workspace-nav-heading { padding: 0 16px 5px; color: var(--portal-muted, #667085); font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; }
html[data-sidebar-collapsed="true"] .workspace-sidebar .workspace-nav-heading { display: none; }
html[data-sidebar-collapsed="true"] .workspace-sidebar .workspace-nav-group + .workspace-nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--portal-sidebar-border); }
.portal-sidebar-layout .workspace-sidebar :is(.nav-item,.workspace-module-link) {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex: none;
  width: 100%; min-height: 46px; margin: 0; padding: 0 16px; box-sizing: border-box;
  border: 0; border-radius: 9px; background: transparent; color: var(--portal-sidebar-ink);
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 20px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.portal-sidebar-layout .workspace-sidebar :is(.nav-item,.workspace-module-link) > svg { display: block; width: 21px; height: 21px; }
.portal-sidebar-layout .workspace-sidebar .workspace-nav-group .nav-item { min-height: 42px; }
.portal-sidebar-layout .workspace-sidebar :is(.nav-item,.workspace-module-link):hover { background: var(--portal-sidebar-hover); color: var(--portal-sidebar-ink); }
.portal-sidebar-layout .workspace-sidebar .nav-item.active { background: var(--portal-sidebar-selected); color: #111827; font-weight: 650; }
.portal-sidebar-layout .workspace-sidebar .nav-item:has(.workspace-nav-badge) { position: relative; }
.portal-sidebar-layout .workspace-sidebar .workspace-nav-badge {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: auto; padding: 0 5px; box-sizing: border-box;
  border-radius: 10px; background: #b42318; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px;
}
html[data-sidebar-collapsed="true"] .workspace-sidebar .workspace-nav-badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding-inline: 3px; font-size: 10px; line-height: 16px; }
.portal-sidebar-layout .workspace-modules { display: grid; flex: none; gap: 4px; width: 100%; min-width: 0; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--portal-sidebar-border); }
.portal-sidebar-layout .workspace-module-heading { margin: 0 12px 4px; color: var(--portal-muted, #667085); font-size: 12px; font-weight: 500; white-space: nowrap; }
.portal-sidebar-layout .workspace-sidebar .workspace-external-icon { margin-left: auto; width: 14px; height: 14px; opacity: .6; }
.portal-sidebar-layout :is(.portal-sidebar-toggle,.nav-item,.workspace-module-link):focus-visible { outline: 2px solid var(--portal-sidebar-ink); outline-offset: -2px; }
.portal-sidebar-layout .workspace-sidebar [hidden] { display: none !important; }
.portal-sidebar-layout .workspace-main,
.portal-sidebar-layout #workspace[data-view] .workspace-main,
body.portal-sidebar-layout.download-knowledge > :is(#knowledge-main,.context-bar) {
  width: calc(100% - var(--portal-sidebar-width)); max-width: none;
  min-width: 0; margin-left: var(--portal-sidebar-width); margin-right: 0; box-sizing: border-box;
}
/* Knowledge subpages use the same available width as their navigation shell. */
body.portal-sidebar-layout.download-knowledge #knowledge-main > :is(.kb-page,.quick-start) {
  width: 100%; max-width: none; min-width: 0; margin-inline: 0; box-sizing: border-box;
}
.portal-sidebar-layout .workspace-sidebar-backdrop { display: none; }
html[data-sidebar-collapsed="true"] .workspace-sidebar-head { justify-content: center; }
html[data-sidebar-collapsed="true"] .workspace-sidebar :is(.workspace-sidebar-caption,.workspace-nav-label,.workspace-module-heading,.workspace-external-icon) { display: none; }
html[data-sidebar-collapsed="true"] .workspace-sidebar :is(.nav-item,.workspace-module-link) { justify-content: center; padding-inline: 0; }
html[data-sidebar-collapsed="true"] .portal-sidebar-toggle .workspace-sidebar-arrow { transform: rotate(180deg); transform-origin: 15px 12px; }
@media (max-width: 760px) {
  .portal-sidebar-layout { --portal-sidebar-width: 64px; }
  html[data-sidebar-collapsed="true"] .portal-sidebar-layout { --portal-sidebar-width: 64px; }
  .portal-sidebar-layout .workspace-sidebar { width: 212.4px; padding: 16px 10px; }
  html[data-sidebar-collapsed="true"] .portal-sidebar-layout .workspace-sidebar { width: 64px; }
  .portal-sidebar-layout .portal-sidebar-toggle { left: 194.4px; }
  html[data-sidebar-collapsed="true"] .portal-sidebar-layout .portal-sidebar-toggle { left: 46px; }
  .portal-sidebar-layout .workspace-sidebar-backdrop:not([hidden]) {
    display: block; position: fixed; inset: var(--portal-header-height) 0 0 212.4px; z-index: 65;
    width: auto; height: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: rgb(24 34 48 / 24%);
  }
  .portal-sidebar-layout .app-header { padding: 14px 16px; }
  .portal-sidebar-layout .workspace-main,
  .portal-sidebar-layout #workspace[data-view] .workspace-main,
  body.portal-sidebar-layout.download-knowledge > :is(#knowledge-main,.context-bar) { padding-left: 12px; padding-right: 12px; }
}
@media (forced-colors: active) {
  .portal-sidebar-layout .workspace-sidebar { border-color: CanvasText; }
  .portal-sidebar-layout .workspace-sidebar .nav-item.active { outline: 1px solid Highlight; }
}

/* Low-frequency entries stay available without filling the daily work rail. */
.portal-sidebar-layout { --portal-sidebar-width: 196px; }
.portal-sidebar-layout .workspace-sidebar { gap: 18px; padding-top: 18px; }
.portal-sidebar-layout .workspace-fold { min-width: 0; }
.portal-sidebar-layout .workspace-fold:not([open]) > :not(summary) { display: none; }
.portal-sidebar-layout .workspace-fold-label { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; list-style: none; }
.portal-sidebar-layout .workspace-fold-label::-webkit-details-marker { display: none; }
.portal-sidebar-layout .workspace-fold-label > svg { width: 21px; height: 21px; }
.portal-sidebar-layout .workspace-fold-label:hover { background: var(--portal-sidebar-hover); }
.portal-sidebar-layout .workspace-fold-label:focus-visible { outline: 2px solid var(--portal-sidebar-ink); outline-offset: -2px; }
.portal-sidebar-layout .workspace-fold-arrow { margin-left: auto; }
.portal-sidebar-layout .workspace-fold[open] > summary .workspace-fold-arrow { transform: rotate(180deg); }
html[data-sidebar-collapsed="true"] .workspace-fold-label { justify-content: center; padding-inline: 0; }
html[data-sidebar-collapsed="true"] .workspace-fold-arrow { display: none; }
.portal-sidebar-layout .app-header .portal-header-tools .portal-header-tool { border-color: transparent; background: transparent; border-radius: 6px; }
.portal-sidebar-layout .app-header .portal-header-tool-help .portal-header-tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width:760px) {
  .portal-sidebar-layout { --portal-sidebar-width:64px; }
  .portal-sidebar-layout .app-header .portal-header-tools { display:flex; width:auto; flex-basis:auto; gap:2px; }
  .portal-sidebar-layout .app-header .portal-header-tools .portal-header-tool { width:auto; padding:6px; }
  .portal-sidebar-layout .app-header .portal-header-tool-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
}
:root .workspace-nav .notification-locked{color:#929aa6;background:#f3f4f6;opacity:.72}

/* Knowledge sections share one expandable group across workbench pages. */
.portal-sidebar-layout .workspace-knowledge { min-width: 0; }
.portal-sidebar-layout .workspace-knowledge-row { display: flex; align-items: center; min-width: 0; }
.portal-sidebar-layout .workspace-knowledge-row .nav-item { flex: 1; width: auto; min-width: 0; padding-right: 0; }
.portal-sidebar-layout .workspace-knowledge.is-current .workspace-knowledge-row .nav-item { color: #111827; font-weight: 650; }
.portal-sidebar-layout .workspace-knowledge-toggle {
  display: flex; align-items: center; justify-content: center; flex: 0 0 28px;
  width: 28px; min-width: 28px; height: 36px; margin: 0; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--portal-sidebar-ink); cursor: pointer;
}
.portal-sidebar-layout .workspace-knowledge-toggle:hover { background: var(--portal-sidebar-hover); }
.portal-sidebar-layout .workspace-knowledge-toggle svg { width: 17px; height: 17px; }
.portal-sidebar-layout .workspace-knowledge-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.portal-sidebar-layout .workspace-knowledge-links { display: grid; gap: 3px; margin: 2px 0 7px 26px; padding-left: 10px; border-left: 1px solid var(--portal-sidebar-border); }
.portal-sidebar-layout .workspace-knowledge-link {
  display: flex; align-items: center; min-height: 36px; padding: 6px 11px; box-sizing: border-box;
  border-radius: 7px; color: var(--portal-sidebar-ink); text-decoration: none; font-size: 14px; line-height: 20px; white-space: nowrap;
}
.portal-sidebar-layout .workspace-knowledge-link:hover { background: var(--portal-sidebar-hover); }
.portal-sidebar-layout .workspace-knowledge-link[aria-current="page"] { background: var(--portal-sidebar-selected); color: #111827; font-weight: 650; }
.portal-sidebar-layout :is(.workspace-knowledge-toggle,.workspace-knowledge-link):focus-visible { outline: 2px solid var(--portal-sidebar-ink); outline-offset: -2px; }
html[data-sidebar-collapsed="true"] .workspace-sidebar :is(.workspace-knowledge-links,.workspace-knowledge-toggle) { display: none; }
@media (pointer: coarse) { .portal-sidebar-layout .workspace-knowledge-link { min-height: 44px; } .portal-sidebar-layout .workspace-knowledge-toggle { flex-basis: 36px; width: 36px; height: 44px; } }
@media (forced-colors: active) { .portal-sidebar-layout .workspace-knowledge-link[aria-current="page"] { outline: 1px solid Highlight; } }
