/* Shared navigation, including the inline mobile disclosure. */
/* Keep common navigation geometry stable even when a workspace needs scrolling. */
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  scrollbar-color: #cbd2de transparent;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) :is(.library-sidebar-brand, .studio-brand) {
  display: flex;
  align-items: center;
  flex: 0 0 30px;
  min-height: 30px;
  height: 30px;
  margin: 0 0 30px;
  padding: 0 10px;
  gap: 12px;
  border: 0;
  font: 650 14px/20px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar-brand, .studio-brand) img {
  width: 52px;
  height: auto;
  flex: 0 0 52px;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar-nav, .primary-nav) {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  flex-shrink: 0;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) :is(.library-sidebar-nav a, .primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a) {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  font: 500 13px/22px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}
body:is([data-studio-page], :has(.studio-shell)) .library-sidebar-nav :is(span, strong) {
  font: inherit;
  line-height: inherit;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) :is(.library-sidebar-nav a, .primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a).active {
  font-weight: 600;
}
body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) :is(.library-sidebar-nav, .primary-nav, .vfx-resource-nav, .vfx-local-nav, .section-nav) svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 1.65;
}
body:is([data-studio-page], :has(.studio-shell)) .vfx-resource-nav {
  flex-shrink: 0;
  gap: 4px;
  margin-top: 22px;
  padding-top: 14px;
}
body:is([data-studio-page], :has(.studio-shell)) .section-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
}
body:is([data-studio-page], :has(.studio-shell)) .section-nav a {
  color: #596270;
  text-decoration: none;
}
body:is([data-studio-page], :has(.studio-shell)) .section-nav a:hover { background: #eef0f4; color: #24272e; }
body:is([data-studio-page], :has(.studio-shell)) .section-nav a.active { color: #2459c4; background: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px #e3e7ef, 0 1px 2px #20242b04; }
.nav-caption { margin: 20px 12px 10px; color: #989fa4; font: 650 10px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 28px 8px 0; color: #858b91; font: 500 10px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; }
.sidebar-bottom .ai-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #278978; }
body:is([data-studio-page], :has(.studio-shell)) .vfx-nav-caption {
  margin: 0;
  padding: 0 12px 8px;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
.vfx-local-nav-caption {
  display: block;
  margin: 22px 12px 8px;
  padding: 0;
  color: #7b8491;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
.vfx-local-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.vfx-resource-nav { display: grid; gap: 4px; margin: 22px 0 0; padding: 14px 0 0; border-top: 1px solid #e4e7ec; }
.vfx-nav-caption { padding: 0 12px 8px; font-size: 11px; font-weight: 600; color: #7b8491; }
.vfx-resource-nav a,
.vfx-local-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #596270;
  font: 500 13px/22px Inter,"Segoe UI","Microsoft YaHei",system-ui,sans-serif;
  text-decoration: none;
}
.vfx-resource-nav a:hover,
.vfx-local-nav a:hover { background: #eef0f4; color: #24272e; }
.vfx-resource-nav a.active,
.vfx-local-nav a.active {
  background: #fff;
  color: #2459c4;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #e3e7ef, 0 1px 2px #20242b04;
}
.vfx-resource-nav svg,
.vfx-local-nav svg { width: 18px; height: 18px; stroke-width: 1.65; }
.vfx-resource-nav [data-studio-icon],
.vfx-local-nav [data-studio-icon] { display: inline-flex; align-items: center; flex: 0 0 18px; }
.vfx-mobile-bar { display: none; }

/* One sidebar contract for the creator workspace and channel monitor. */
body[data-studio-page="channel-monitor"] .studio-sidebar,
body:has(.studio-shell) .studio-sidebar {
  box-sizing: border-box;
  width: 220px;
  padding: 24px 16px;
  border-right: 1px solid #e4e7e9;
  background: #f8f9fa;
  color: #20242b;
  scrollbar-width: thin;
  scrollbar-color: #cbd2de transparent;
}
body[data-studio-page="channel-monitor"] .studio-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
}
body:has(.studio-shell) .studio-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
}
body[data-studio-page="channel-monitor"] .library-sidebar-brand,
body:has(.studio-shell) .studio-brand {
  display: flex;
  align-items: center;
  flex: 0 0 30px;
  min-height: 30px;
  height: 30px;
  margin: 0 0 30px;
  padding: 0 10px;
  gap: 12px;
  border: 0;
  color: #20242b;
  font: 650 14px/20px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  text-decoration: none;
}
body[data-studio-page="channel-monitor"] .library-sidebar-brand > span {
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
}
body[data-studio-page="channel-monitor"] .library-sidebar-brand img,
body:has(.studio-shell) .studio-brand img {
  width: 52px;
  height: auto;
  flex: 0 0 52px;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .primary-nav,
body:has(.studio-shell) .studio-sidebar .primary-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}
body[data-studio-page="channel-monitor"] .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav a),
body:has(.studio-shell) .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a) {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  border-radius: 6px;
  color: #596270;
  background: transparent;
  box-shadow: none;
  font: 500 13px/22px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
}
body[data-studio-page="channel-monitor"] .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav a):hover,
body:has(.studio-shell) .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a):hover {
  color: #24272e;
  background: #eef0f4;
}
body[data-studio-page="channel-monitor"] .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav a).active,
body:has(.studio-shell) .studio-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a).active {
  color: #2459c4;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e3e7ef, 0 1px 2px #20242b04;
  font-weight: 600;
}
body[data-studio-page="channel-monitor"] .studio-sidebar :is(.primary-nav, .vfx-resource-nav, .vfx-local-nav, .section-nav) svg,
body:has(.studio-shell) .studio-sidebar :is(.primary-nav, .vfx-resource-nav, .vfx-local-nav, .section-nav) svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 1.65;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .nav-caption,
body:has(.studio-shell) .studio-sidebar .nav-caption {
  margin: 20px 12px 8px;
  color: #7b8491;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .section-nav,
body:has(.studio-shell) .studio-sidebar .section-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .vfx-resource-nav,
body:has(.studio-shell) .studio-sidebar .vfx-resource-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 22px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid #e4e7ec;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .vfx-nav-caption,
body:has(.studio-shell) .studio-sidebar .vfx-nav-caption {
  padding: 0 12px 8px;
  color: #7b8491;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .vfx-local-nav-caption,
body:has(.studio-shell) .studio-sidebar .vfx-local-nav-caption {
  display: block;
  margin: 22px 12px 8px;
  padding: 0;
  color: #7b8491;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .vfx-local-nav,
body:has(.studio-shell) .studio-sidebar .vfx-local-nav {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}
body[data-studio-page="channel-monitor"] .studio-sidebar .sidebar-bottom,
body:has(.studio-shell) .studio-sidebar .sidebar-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 28px 8px 0;
  color: #858b91;
  font: 500 10px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

@media(max-width:850px) {
  html:has(.library-sidebar, .studio-sidebar) { scrollbar-width: thin; scrollbar-gutter: stable; }
  body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) { scrollbar-gutter: stable; margin: 0; }
  body[data-studio-page="channel-monitor"] .studio-sidebar,
  body:has(.studio-shell) .studio-sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid #e4e7e9;
  }
  body:is([data-studio-page], :has(.studio-shell)) :is(.library-sidebar, .studio-sidebar) :is(.library-sidebar-nav a, .primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .section-nav button, .section-nav a) { min-height: 44px; }
  body .vfx-mobile-bar { position: sticky; top: 0; z-index: 65; display: flex; justify-content: space-between; align-items: center; min-height: 58px; padding: 8px 18px; border-bottom: 1px solid #e4e7ec; background: #fff; box-sizing: border-box; }
  body:has(#appView[hidden]) .vfx-mobile-bar { display: none; }
  .vfx-mobile-bar a { display: inline-flex; align-items: center; gap: 12px; color: #24272e; text-decoration: none; font: 600 14px/1.5 Inter,"Segoe UI","Microsoft YaHei",system-ui,sans-serif; }
  .vfx-mobile-bar img { width: 48px; height: auto; }
  body .vfx-mobile-bar .vfx-menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px; padding: 8px; border: 1px solid #dfe4ec; border-radius: 6px; color: #364152; background: #fff; cursor: pointer; }
  .vfx-menu-toggle svg { width: 20px; height: 20px; }
  body:has(.vfx-mobile-bar) :is(.library-sidebar,.ugc-sidebar,.studio-sidebar,.sidebar) { display: none !important; }
  body.vfx-nav-open :is(.library-sidebar,.ugc-sidebar,.studio-sidebar,.sidebar) { display: flex !important; position: static !important; width: 100% !important; height: auto !important; max-height: 65vh; overflow-y: auto !important; }
  body.vfx-nav-open :is(.library-sidebar-brand,.ugc-brand,.studio-brand,.sidebar .brand-mark) { display: none !important; }
  body.vfx-nav-open :is(.library-sidebar-nav,.vfx-global-nav,.primary-nav,.vfx-resource-nav) { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 4px; overflow: visible; }
  body.vfx-nav-open .vfx-nav-caption { grid-column: 1/-1; }
  body.vfx-nav-open .vfx-local-nav-caption { grid-column: 1/-1; margin-top: 18px; }
  body.vfx-nav-open :is(.library-sidebar-nav a,.vfx-global-nav a,.primary-nav a,.vfx-resource-nav a,.vfx-local-nav a) { min-height: 44px; white-space: normal; font-size: 13px; }
  body.vfx-nav-open :is(.vfx-resource-nav,.ugc-side-nav,.vfx-local-nav) { margin-top: 12px; }
  body.vfx-nav-open .section-nav { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 0; }
  body.vfx-nav-open .nav-caption { display: block; margin: 18px 12px 8px; }
  body.vfx-nav-open .section-nav :is(button,a) { min-height: 40px; }
  body.vfx-nav-open .sidebar-bottom { display: none; }
}

/* Keep the production workspace on the same navigation contract as the
   project library and channel monitor. The UGC page keeps its existing
   markup and handlers; only the shared navigation presentation is aligned. */
body[data-studio-page="ugc"] .ugc-sidebar {
  box-sizing: border-box;
  width: 220px;
  padding: 24px 16px;
  border-right: 1px solid #e4e7e9;
  background: #f8f9fa;
  color: #20242b;
  scrollbar-width: thin;
  scrollbar-color: #cbd2de transparent;
}

body[data-studio-page="ugc"] .ugc-brand {
  display: flex;
  align-items: center;
  flex: 0 0 30px;
  min-height: 30px;
  height: 30px;
  margin: 0 0 30px;
  padding: 0 10px;
  gap: 12px;
  border: 0;
}

body[data-studio-page="ugc"] .ugc-brand img {
  width: 52px;
  height: auto;
  flex: 0 0 52px;
}

body[data-studio-page="ugc"] .ugc-brand .vfx-brand-name {
  display: inline;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #20242b;
  font: 650 14px/20px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  white-space: nowrap;
}

body[data-studio-page="ugc"] .ugc-back-library {
  display: none !important;
}

body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav, .vfx-resource-nav, .vfx-local-nav, .ugc-side-nav) {
  display: grid;
  flex-shrink: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

body[data-studio-page="ugc"] .ugc-sidebar .vfx-resource-nav {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #e4e7ec;
}

body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .ugc-side-nav button) {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: #596270;
  background: transparent;
  box-shadow: none;
  font: 500 13px/22px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
}

body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .ugc-side-nav button):hover {
  color: #24272e;
  background: #eef0f4;
}

body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .ugc-side-nav button).active {
  color: #2459c4;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e3e7ef, 0 1px 2px #20242b04;
  font-weight: 600;
}

body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav, .vfx-resource-nav, .vfx-local-nav, .ugc-side-nav) :is(svg, .vfx-icon) {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 1.65;
}

body[data-studio-page="ugc"] .ugc-side-nav button > div {
  min-width: 0;
}

body[data-studio-page="ugc"] .ugc-side-nav button strong {
  display: block;
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-studio-page="ugc"] .ugc-side-nav button small {
  display: none;
}

body[data-studio-page="ugc"] .ugc-sidebar .vfx-nav-caption,
body[data-studio-page="ugc"] .ugc-sidebar .vfx-local-nav-caption {
  display: block;
  margin: 22px 12px 8px;
  padding: 0;
  color: #7b8491;
  font: 500 11px/16px Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

body[data-studio-page="ugc"] .ugc-sidebar .sidebar-bottom,
body[data-studio-page="ugc"] .ugc-sidebar .ugc-header-health {
  margin-top: auto;
  padding: 28px 8px 0;
}

@media(max-width:850px) {
  body[data-studio-page="ugc"] .ugc-sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid #e4e7e9;
  }

  body[data-studio-page="ugc"] .ugc-brand {
    flex: 0 0 auto;
    height: auto;
    min-height: 30px;
    margin-bottom: 12px;
    padding: 0;
  }

  body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav, .vfx-resource-nav, .vfx-local-nav, .ugc-side-nav) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }

  body[data-studio-page="ugc"] .ugc-sidebar .vfx-resource-nav {
    margin-top: 12px;
    padding-top: 12px;
  }

  body[data-studio-page="ugc"] .ugc-sidebar :is(.primary-nav a, .vfx-resource-nav a, .vfx-local-nav a, .ugc-side-nav button) {
    min-height: 44px;
    white-space: normal;
  }

  body[data-studio-page="ugc"] .ugc-sidebar .vfx-local-nav-caption {
    grid-column: 1 / -1;
    margin-top: 18px;
  }

  body[data-studio-page="ugc"] .ugc-sidebar .ugc-header-health {
    display: none;
  }
}
