.sb-nav a.nav-item {
  display: flex;
  align-items: center;
  text-decoration: none;
  min-height: 35px;
}
.sb-foot [aria-label='退出登录'] { cursor: pointer; }
.workspace-group > summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; min-height: 40px; padding: 7px 10px;
  font-size: 13px; letter-spacing: 0; text-transform: none; color: inherit;
}
.workspace-group > summary::-webkit-details-marker { display: none; }
.workspace-group > summary::after {
  content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg); margin-right: 4px;
}
.workspace-group[open] > summary::after { transform: rotate(45deg); }
.workspace-group + .workspace-group { border-top: 1px solid var(--maltai-line, var(--line)); }
.workspace-backdrop[hidden] { display: none; }
.workspace-backdrop { position: fixed; inset: 0; background: rgb(10 22 40 / .38); border: 0; z-index: 25; }
.app:has(.workspace-backdrop:not([hidden])) { height: 100dvh; overflow: hidden; }
.app .mob-menu { font-size: 0; }
.mob-menu::before {
  content: ''; display: block; width: 16px; height: 12px;
  border-block: 2px solid currentColor; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.native-host {
  --primary: var(--maltai-navy);
  --primary-foreground: #fff;
  --ring: var(--maltai-gold);
  --background: var(--maltai-card);
  --foreground: var(--maltai-ink);
  --card: var(--maltai-card);
  --card-foreground: var(--maltai-ink);
  --muted: var(--maltai-bg-subtle);
  --muted-foreground: var(--maltai-sub);
  --border: var(--maltai-line);
  --sidebar: var(--maltai-card);
  --sidebar-foreground: var(--maltai-ink);
  --sidebar-accent: var(--maltai-gold-soft);
  --sidebar-accent-foreground: var(--maltai-gold-ink);
  --sidebar-border: var(--maltai-line);
}
:root[data-theme='dark'] .native-host { --primary-foreground: #0a1628; }
.native-host #root { min-width: 0; font: 1rem/1.5 var(--maltai-font-sans); color: var(--foreground); }
.native-host .main { min-width: 0; }
.native-host .gateway-account-note { color: var(--muted-foreground); font-size: 12px; line-height: 1.4; }
@media (max-width: 820px) {
  .native-host .tb-left:has(.gateway-account-note) { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 0; }
  .native-host .tb-left:has(.gateway-account-note) .mob-menu { grid-row: span 2; }
}
.native-host .content { max-width: none; padding: 12px 18px; }
.native-host #root [data-slot='sidebar-wrapper'] { min-height: 0; background: transparent; }
.native-host #root [data-slot='sidebar-wrapper'] > header,
.native-host #root [data-slot='sidebar'] { display: none; }
.native-host #root [data-slot='sidebar-inset'] {
  min-width: 0;
  height: calc(100dvh - 88px);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
body.company-host .content { width: 100%; max-width: 1250px; margin-inline: auto; }
.native-settings .sb-nav { display: none; }
.native-settings [data-sidebar='menu-sub-button'][data-active='true'] {
  color: var(--maltai-gold-ink);
  background: var(--maltai-gold-soft);
  font-weight: 650;
}
@media (min-width: 768px) {
  /* The native category tree and editor occupy the shell's own grid cells.
     React retains ownership of its links, form state and navigation. */
  .native-settings .app {
    grid-template-columns: var(--maltai-sidebar-w) minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr) auto;
    grid-template-areas: 'brand bar' 'menu editor' 'account editor';
    height: 100dvh;
    min-height: 0;
  }
  .native-settings .app > .sidebar, .native-settings .app > .main,
  .native-settings .main > .content, .native-settings #root,
  .native-settings #root :has([data-slot='sidebar-wrapper']),
  .native-settings #root [data-slot='sidebar-wrapper'],
  .native-settings #root [data-slot='sidebar-wrapper'] > :has(> [data-slot='sidebar-inset']) {
    display: contents;
  }
  .native-settings .sb-head, .native-settings .sb-foot {
    min-width: 0;
    background: var(--maltai-card);
    border-right: 1px solid var(--maltai-line);
  }
  .native-settings .sb-head { grid-area: brand; }
  .native-settings .sb-foot { grid-area: account; }
  .native-settings .topbar { grid-area: bar; }
  .native-settings .mob-menu { display: none; }
  .native-settings #root [data-slot='sidebar'] {
    display: block;
    grid-area: menu;
    min-height: 0;
    overflow: hidden;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
  }
  .native-settings #root [data-slot='sidebar-container'] {
    display: flex;
    position: static;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
  }
  .native-settings #root [data-slot='sidebar-gap'],
  .native-settings [data-sidebar='rail'] { display: none; }
  .native-settings #root [data-slot='sidebar-inset'] {
    grid-area: editor;
    margin: 16px clamp(12px, 2vw, 28px);
    height: auto;
    width: auto;
  }
}
@media (max-width: 767px) {
  .native-host .content { padding: 8px; }
  .native-host #root [data-slot='sidebar-inset'] { height: calc(100dvh - 80px); }
  .native-settings .app > .sidebar { display: none; }
  .native-settings .mob-menu { min-height: 40px; min-width: 40px; }
}
.plan-tabs {
  flex: none; display: flex; align-items: stretch; gap: 24px; height: 45px;
  padding-inline: clamp(16px, 2vw, 28px);
  border-bottom: 1px solid var(--maltai-line, var(--line));
  background: var(--maltai-card, var(--card));
}
.plan-tabs a { display: inline-flex; align-items: center; font-size: 14px; color: var(--maltai-sub, var(--sub)); }
.plan-tabs a[aria-current='page'] {
  border-bottom: 2px solid var(--maltai-gold, var(--gold));
  color: var(--maltai-ink, var(--ink)); font-weight: 700;
}
.native-host.plan-workspace #root [data-slot='sidebar-inset'] { height: calc(100dvh - 133px); }
.gateway-host #root header.pointer-events-none,
.gateway-host #root header.pointer-events-none + .fixed.inset-0,
.gateway-host #root footer { display: none; }
.gateway-host { --primary: var(--maltai-navy); --ring: var(--maltai-gold); }
.workspace-switch { display: block; margin: 4px 10px 12px; padding: 9px 14px; border: 1px solid var(--maltai-line, var(--line)); border-radius: 8px; font-weight: 650; text-align: center; }
#gateway-error { margin: 12px auto; width: fit-content; }
#gateway-error button { text-decoration: underline; margin-inline-start: 12px; }
.gateway-host #root .pt-16 { padding-top: 1rem; }
