/* One company navigation surface across the dashboard and operational pages. */
:root { --sidebar: 248px; }
.workspace-sidebar {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  max-width: none;
  color: var(--ink);
  background: var(--white);
  border: 0;
  border-right: 1px solid var(--line);
  padding: 18px 12px 10px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sidebar-heading { padding: 0 10px 14px; }
.sidebar-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: .94rem; font-weight: 650; letter-spacing: -.02em; text-decoration: none; }
.sidebar-brand-mark { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: var(--accent); color: var(--white); font-size: .85rem; }
.workspace-sidebar .company-context { margin: 0 2px 10px; padding: 10px 8px; border-block: 1px solid var(--line); }
.workspace-sidebar .company-identity { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.workspace-sidebar .company-identity > span:last-child { min-width: 0; }
.workspace-sidebar .company-symbol { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: .9rem; }
.workspace-sidebar .company-context-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: .66rem; line-height: 1.3; }
.workspace-sidebar .company-identity strong { display: block; font-size: .83rem; line-height: 1.4; overflow-wrap: anywhere; }
.workspace-sidebar .company-context-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 9px; font-size: .69rem; }
.workspace-sidebar .company-context-actions a { margin-left: auto; color: var(--muted); }
.workspace-sidebar .badge { padding: 2px 6px; font-size: .63rem; background: var(--surface-soft); color: var(--muted); }
.workspace-sidebar .workspace-search { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; padding: 9px 8px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--muted); font-size: .75rem; text-decoration: none; }
.workspace-sidebar .workspace-search kbd { margin-left: auto; font-size: .6rem; white-space: nowrap; color: var(--muted); }
.workspace-sidebar .workspace-search .ui-icon { width: 16px; height: 16px; }
.workspace-sidebar .company-menu { min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; border-radius: 0; }
.workspace-sidebar .company-menu > summary { display: flex; align-items: center; gap: 10px; padding: 10px; color: var(--muted); list-style: none; }
.workspace-sidebar .company-menu > summary strong { color: var(--ink); font-size: .85rem; }
.workspace-sidebar .company-menu > summary > .ui-icon { margin-left: auto; }
.workspace-sidebar summary::-webkit-details-marker { display: none; }
.workspace-sidebar .company-nav { display: block; padding: 0 3px 14px; margin: 0; border: 0; box-shadow: none; background: transparent; }
.workspace-sidebar .company-nav a, .sidebar-account {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; position: relative;
  padding: 8px 11px; min-height: 36px; border-radius: 8px;
  color: var(--muted); font-size: .82rem; font-weight: 500; line-height: 1.35;
  text-decoration: none; white-space: normal; overflow-wrap: anywhere;
  transition: background-color 140ms ease, color 140ms ease;
}
.workspace-sidebar .company-nav a::before { content: none; }
.workspace-sidebar .company-nav a:hover, .sidebar-account:hover, .workspace-sidebar .workspace-search:hover { background: var(--surface-soft); color: var(--ink); text-decoration: none; }
.workspace-sidebar .company-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong, var(--accent)); font-weight: 650; box-shadow: none; }
.workspace-sidebar .company-nav a[aria-current="page"]::after { content: ''; position: absolute; inset: 11px auto 11px 0; width: 3px; border-radius: 3px; background: var(--accent); }
.workspace-sidebar .ui-icon { flex: 0 0 18px; width: 18px; height: 18px; opacity: .86; }
.navigation-group { margin: 4px 0 0; }
.workspace-sidebar .navigation-group > summary { display: flex; align-items: center; gap: 7px; min-height: 32px; margin: 0; padding: 7px 10px; list-style: none; cursor: pointer; color: var(--muted); font-size: .67rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; border-radius: 7px; }
.workspace-sidebar .navigation-group > summary:hover { background: var(--surface-soft); color: var(--ink); }
.navigation-group > summary .ui-icon { margin-left: auto; width: 13px; height: 13px; flex-basis: 13px; transform: rotate(-90deg); transition: transform 140ms ease; }
.navigation-group[open] > summary .ui-icon { transform: rotate(0); }
.navigation-current-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.navigation-group-links { display: grid; gap: 2px; }
.sidebar-footer { flex: 0 0 auto; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.workspace-sidebar .context-return { display: flex; gap: 7px; margin: 0; padding: 8px 10px; font-size: .71rem; line-height: 1.4; }
.workspace-sidebar :is(a, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* Group dashboards share the theme, while retaining their six group destinations. */
.bi-rail { background: var(--white); color: var(--ink); border-right: 1px solid var(--line); }
.bi-rail > nav a, .bi-rail-bottom { color: var(--muted); }
.bi-rail > nav a:hover, .bi-rail-bottom:hover { color: var(--ink); background: var(--surface-soft); }
.bi-rail > nav a[aria-current] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.bi-brand { border-color: var(--line); }
.bi-brand span, .bi-brand span:nth-child(2), .bi-brand span:nth-child(3) { background: var(--accent); }
.bi-brand span:nth-child(2) { opacity: .55; }
@media screen and (min-width: 1101px) {
  body:has(.workspace-sidebar), body.bi-shell:has(.workspace-sidebar) { padding-left: var(--sidebar); }
  body:has(.workspace-sidebar) > .topbar { margin-left: 0; }
  body:has(.workspace-sidebar) > .topbar .brand { display: none; }
  body:has(.workspace-sidebar) > .topbar nav { margin-left: auto; }
  .bi-shell:has(.workspace-sidebar) { --bi-rail: var(--sidebar); }
  .workspace-sidebar, .bi-shell .workspace-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 65; width: var(--sidebar); height: 100dvh; min-height: 0; }
  .workspace-sidebar .company-menu { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .workspace-sidebar .company-menu > summary { display: none; }
}
@media screen and (max-width: 1100px) {
  body:has(.workspace-sidebar), body.bi-shell:has(.workspace-sidebar) { padding-left: 0; }
  body:has(.workspace-sidebar) > .topbar { margin-left: 0; }
  .workspace-sidebar, .bi-shell .workspace-sidebar { position: relative; inset: auto; width: 100%; height: auto; min-height: 0; max-width: none; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-sidebar .sidebar-heading, .workspace-sidebar .sidebar-footer, .workspace-sidebar .workspace-search { display: none; }
  .workspace-sidebar .company-context { margin: 0; padding: 4px 0 10px; border: 0; }
  .workspace-sidebar .company-context-actions { margin-top: 5px; }
  .workspace-sidebar .company-identity strong { font-size: .9rem; }
  .workspace-sidebar .company-menu { border-top: 1px solid var(--line); }
  .workspace-sidebar .company-nav { max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; padding-top: 8px; }
  .workspace-sidebar .company-nav a { min-height: 44px; }
  .workspace-sidebar:has(.company-menu[open]) .sidebar-footer { display: block; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace-sidebar a, .navigation-group > summary .ui-icon { transition: none; }
}
@media print { .workspace-sidebar { display: none !important; } }

/* Embedded editors retain the whole viewport while their navigation is hidden. */
@media screen {
  body.setup-panel:has(.workspace-sidebar), body.setup-panel.bi-shell { padding-inline: 0; }
  body.setup-panel .workspace-sidebar { display: none; }
}
