.sidebar-header > div {
  width: auto;
}

.sidebar-header img {
  max-width: 60px !important;
}

.xui-sidebar-version {
  flex: 1;
  align-self: end;
  font-weight: var(--x-typography-font-weight-medium, 500);
  color: var(--x-color-text-muted, #424f60);
  line-height: 1;
}

.search-field {
  border-radius: var(--x-border-radius-medium, 6px) !important;
  box-shadow: 0 0 0 1px var(--x-color-border-subtle, #cfd1d5) !important;
  padding-left: var(--x-size-spacing-8, 8px) !important;
  padding-right: var(--x-size-spacing-8, 8px) !important;
}

/* Hide the "Create a new story" button */
button[aria-label='Create a new story'] {
  display: none;
}

/* Indent children beneath their parent group */
.sidebar-header + label + div {
  margin-left: var(--x-size-spacing-16, 16px);
}

#storybook-explorer-menu .sidebar-item:not([data-parent-id]) button,
#storybook-explorer-menu .sidebar-item:not([data-parent-id]) a {
  font-size: var(--x-typography-font-size-15, 15px);
  color: var(--x-color-text-default, #1e3145);
}

#storybook-explorer-menu a,
#storybook-explorer-menu button {
  font-size: var(--x-typography-font-size-14, 14px);
  line-height: 1;
  color: var(--x-color-text-muted, #424f60);
  padding-top: 6px;
  padding-bottom: 6px;
  align-items: center;
}

#storybook-explorer-menu [data-item-id] {
  border-radius: var(--x-border-radius-large, 8px);
}

#storybook-explorer-menu [data-item-id]:hover {
  background-color: var(--x-color-background-secondary, #f6f6f8);
}

/* Remove filled background on keyboard focus */
#storybook-explorer-menu [data-item-id]:focus {
  background: none;
}

#storybook-explorer-menu [data-selected='true'],
#storybook-explorer-menu [data-selected='true']:hover {
  background: none;
}

#storybook-explorer-menu [data-selected='true'] a,
#storybook-explorer-menu [data-selected='true'] button,
#storybook-explorer-menu [data-selected='true'] a svg,
#storybook-explorer-menu [data-selected='true'] button svg {
  color: var(--x-color-text-default, #1e3145);
}

#storybook-explorer-menu .sidebar-item:has(> button[aria-expanded='true']) {
  background: var(--x-color-sentiment-inform-background, #eff9ff);
  border-radius: var(--x-border-radius-large, 8px);
}

#storybook-explorer-menu svg {
  color: var(--x-color-text-muted, #424f60);
}

/* Leaf story and document items keep their bookmark/page icons (see screenshot) */
.sidebar-item:not([data-nodetype='story']):not([data-nodetype='document']) > button > div > svg,
.sidebar-item:not([data-nodetype='story']):not([data-nodetype='document']) > a > div > svg {
  display: none;
}

#storybook-explorer-menu .sidebar-item button[aria-expanded] > div {
  margin-top: 0;
}

#storybook-explorer-menu .sidebar-item [aria-expanded] {
  margin-left: 6px;
}

#storybook-explorer-menu .sidebar-item {
  margin-left: -6px;
}

#storybook-explorer-menu button[data-item-id] {
  width: calc(100% - 16px);
}

[data-parent-id]:has(+ :not([data-parent-id])) {
  margin-bottom: var(--x-size-spacing-16, 16px) !important;
}

[data-nodetype='document'] a {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

[data-nodetype='document']:not([data-parent-id]) a {
  padding-left: 6px !important;
}

.sidebar-subheading button {
  font-size: var(--x-typography-font-size-15, 15px) !important;
  font-weight: normal !important;
  color: var(--x-color-text-default, #1e3145) !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

/* The "..." actions button that appears on hover — hidden entirely */
button[aria-label='Open context menu'],
[data-testid='context-menu'] {
  display: none !important;
}

div[role='main'] > div {
  box-shadow: none !important;
  border-right: 1px solid var(--x-color-border-soft, #e1e2e5);
  border-radius: 0;
}

div[role='main'] > div > div > div > div {
  border-bottom: 1px solid var(--x-color-border-soft, #e1e2e5);
  box-shadow: none !important;
}

.tablist > div > div > div > div {
  font-size: var(--x-typography-font-size-11, 11px) !important;
  font-weight: var(--x-typography-font-weight-semibold, 600);
  text-transform: uppercase;
}
