:root {
  --cj-brand: #1769e0;
  --cj-bar-height: 42px;
  --cj-sidebar-width: 188px;
  --cj-collapsed-sidebar-width: 64px;
  --cj-page-title: 20px;
  --cj-section-title: 16px;
  --cj-body-size: 14px;
  --cj-control-size: 13px;
  --cj-control-height: 34px;
  --cj-control-gap: 8px;
  --cj-panel-padding: 16px;
  --cj-panel-radius: 7px;
}

.cj-workspace-sidebar summary:is(:hover, :focus-visible) { background: var(--primary-light); color: var(--primary); border-radius: 6px; }

.cj-workspace-sidebar summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  color: var(--text);
  font-size: 14px;
}
.cj-workspace-sidebar summary::-webkit-details-marker { display: none; }
.cj-workspace-sidebar summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
}
.cj-workspace-sidebar details[open] > summary::after { transform: rotate(45deg); }
.cj-workspace-sidebar .cj-sidebar-home {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.cj-sidebar-home::before {
  content: "";
  flex: 0 0 16px;
  height: 16px;
  background: currentColor;
  clip-path: polygon(50% 3%, 100% 44%, 100% 96%, 65% 96%, 65% 66%, 35% 66%, 35% 96%, 0 96%, 0 44%);
}
.cj-workspace-sidebar summary { gap: 10px; }
.cj-workspace-sidebar summary::before {
  content: "";
  flex: 0 0 14px;
  height: 12px;
  background: var(--muted);
  clip-path: polygon(0 0, 43% 0, 56% 25%, 100% 25%, 100% 100%, 0 100%);
}
.cj-workspace-sidebar summary::after { margin-inline-start: auto; flex-shrink: 0; }
.cj-workspace-sidebar details a { padding-inline-start: 34px; }

.cj-sidebar-toggle { display: none; }
@media (min-width: 768px) {
  .cj-workspace-sidebar { display: flex; flex-direction: column; }
  .cj-sidebar-toggle:not([hidden]) {
    display: grid;
    place-items: center;
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    width: 100%;
    min-height: 36px;
    margin-top: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
  }
  .cj-sidebar-toggle:is(:hover, :focus-visible) { background: var(--primary-light); color: var(--primary); }
  .cj-sidebar-toggle span {
    width: 8px;
    height: 8px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(45deg);
  }
  .cj-sidebar-collapsed .cj-workspace-sidebar :is(.cj-sidebar-home, summary) {
    position: relative;
    justify-content: center;
    min-height: 36px;
    padding: 0;
    gap: 0;
  }
  .cj-sidebar-collapsed .cj-workspace-sidebar :is(.cj-sidebar-home, summary) span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .cj-sidebar-collapsed .cj-workspace-sidebar details a,
  .cj-sidebar-collapsed .cj-workspace-sidebar summary::after { display: none; }
  .cj-sidebar-collapsed .cj-sidebar-toggle span { transform: rotate(225deg); }
}

.cj-tab-bar {
  order: 1;
  display: flex;
  align-self: stretch;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  gap: 4px;
}
.cj-tab-bar .cj-workspace-tabs { white-space: nowrap; }
.cj-tab-overflow {
  position: relative;
  order: 2;
  flex: none;
  align-self: center;
  font-size: var(--cj-control-size);
}
.cj-tab-overflow > summary {
  padding: 5px 8px;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
}
.cj-tab-overflow > summary:is(:hover, :focus-visible) { background: rgb(255 255 255 / 18%); }
.cj-tab-menu {
  position: absolute;
  inset: calc(100% + 5px) 0 auto auto;
  z-index: 10;
  min-inline-size: 12rem;
  max-block-size: min(65vh, 400px);
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--cj-panel-radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 18px rgb(20 36 65 / 16%);
}
.cj-tab-menu .cj-workspace-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  gap: 8px;
}
.cj-tab-menu .cj-workspace-tab:hover { background: var(--primary-light); }
#header .cj-tab-menu a, .topbar .cj-tab-menu a { color: var(--text); }
.cj-tab-menu .cj-workspace-tab button {
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
