/* 仅在进入研究工作区后启用；登录页与国家选择页继续使用原有布局。 */
body.research-shell-active {
  --research-rail-width: 88px;
  --research-topbar-height: 68px;
  --research-scope-height: 48px;
  --research-nav-background: #112a43;
  --research-nav-selected: #22476a;
  --research-shell-blue: #0054a6;
  --research-shell-ink: #20344a;
  --research-shell-muted: #728195;
  --research-shell-line: #dce4ec;
  --research-shell-ground: #f2f5f8;
  min-width: 0;
  background: var(--research-shell-ground);
  color: var(--research-shell-ink);
}
.research-sidebar[hidden], #researchScopeBar[hidden] { display: none !important; }
body:not(.research-shell-active) .research-sidebar,
body:not(.research-shell-active) #researchScopeBar { display: none !important; }
body.research-shell-active .research-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--research-rail-width);
  padding: 22px 9px 16px;
  background: var(--research-nav-background);
  color: #c7d4e2;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.research-sidebar-brand { display: grid; place-items: center; gap: 8px; color: #fff; margin-bottom: 26px; font-size: 10px; letter-spacing: .08em; }
.research-sidebar-brand img, .research-sidebar-brand > svg { width: 36px; height: 36px; }
body.research-shell-active #productWorkspaceNav {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  width: 100%;
  align-self: stretch;
  gap: 10px;
  margin: 0;
}
.research-nav-group { display: grid; gap: 8px; width: 100%; }
.research-nav-support { margin-top: auto; padding-top: 24px; border-top: 1px solid #ffffff18; }
body.research-shell-active #productWorkspaceNav [data-product-workspace] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 66px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #b6c9dc;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
}
body.research-shell-active #productWorkspaceNav [data-product-workspace]:hover { background: #1c3b59; color: #fff; }
body.research-shell-active #productWorkspaceNav [data-product-workspace]:is(.is-active,[aria-current="page"]) {
  color: #fff;
  background: var(--research-nav-selected);
  box-shadow: inset 2px 0 #75b8fb;
}
body.research-shell-active #productWorkspaceNav [data-product-workspace]::after { content: none; }
.research-workspace-icon { display: block; flex-shrink: 0; }
body.research-shell-active #productWorkspaceNav button:focus-visible,
body.research-shell-active #researchScopeBar :is(button,a):focus-visible { outline: 3px solid #71b6f8; outline-offset: 2px; }
body.research-shell-active #appHeader {
  width: calc(100% - var(--research-rail-width));
  height: var(--research-topbar-height);
  min-height: var(--research-topbar-height);
  margin-left: var(--research-rail-width);
  padding: 14px 26px;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--research-shell-line);
}
body.research-shell-active #appHeader .brand-block { min-width: 0; gap: 10px; }
body.research-shell-active #appHeader .app-name { color: var(--research-shell-ink); font-size: 15px; }
body.research-shell-active #appHeader .app-context { color: var(--research-shell-muted); font-size: 11px; }
body.research-shell-active #appHeader .country-picker { display: block; }
body.research-shell-active #appHeader .country-picker select { border-radius: 7px; background: #f7f9fc; }
body.research-shell-active #appHeader:not([data-active-workspace="map"]) .header-actions,
body.research-shell-active #appHeader:not([data-active-workspace="map"]) .country-import-button { display: none; }
body.research-shell-active #appHeader .cloud-account-actions-header { margin-left: auto; min-width: 0; flex-shrink: 0; }
body.research-shell-active #appHeader .account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.research-shell-active #researchScopeBar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: calc(100% - var(--research-rail-width));
  height: var(--research-scope-height);
  margin-left: var(--research-rail-width);
  padding: 12px 28px;
  border-bottom: 1px solid var(--research-shell-line);
  background: #fff;
  font-size: 12px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.research-scope-label { color: #728195; font-size: 11px; white-space: nowrap; }
.research-scope-country { color: #20344a; font-weight: 650; white-space: nowrap; }
.research-scope-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 420px; border: 1px solid #c9ddf3; border-radius: 6px; background: #eaf2fc; color: #0054a6; padding: 5px 10px; white-space: nowrap; }
.research-scope-chip > span { overflow: hidden; text-overflow: ellipsis; }
.research-scope-period { color: #728195; white-space: nowrap; font-variant-numeric: tabular-nums; }
.research-scope-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
body.research-shell-active #researchScopeBar button { flex-shrink: 0; font-size: 12px; }
body.research-shell-active :is(#mapWorkspace,#researchDataDialog) {
  width: calc(100% - var(--research-rail-width));
  margin-left: var(--research-rail-width);
  height: calc(100vh - var(--research-topbar-height) - var(--research-scope-height));
  height: calc(100dvh - var(--research-topbar-height) - var(--research-scope-height));
  min-width: 0;
  min-height: 0;
}
/* 保留地图自身左右栏的折叠变量及制图尺寸，侧栏只占应用外围宽度。 */
body.research-shell-active #mapWorkspace { grid-template-columns: var(--left-panel-width) minmax(0,1fr) var(--right-panel-width); }
body.research-shell-active #researchDataDialog { background: var(--research-shell-ground); }
body.research-shell-active #researchDataDialog .research-data-header { padding: 12px 28px 8px; background: transparent; border-bottom: 0; }
body.research-shell-active #appHeader .app-name { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
body.research-shell-active #researchDataDialog:is([data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-data-header { display: none; }
body.research-shell-active #researchDataTitle { color: #20344a; font-size: 25px; font-weight: 650; letter-spacing: -.02em; }
body.research-shell-active #researchWorkspaceKicker { color: #647c94; font-size: 11px; letter-spacing: .02em; }
body.research-shell-active #researchDataDialog .research-toolbar { background: #fff; border-color: var(--research-shell-line); }
body.research-shell-active #researchDataDialog .research-detail-panel { background: var(--research-shell-ground); }
body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-body { grid-template-columns: minmax(0,1fr); }
body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-data-shell { grid-template-rows: auto minmax(0,1fr); }
body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) :is(.research-toolbar,.research-dataset-list) { display: none; }
body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-detail-panel { grid-column: 1 / -1; padding: 0 28px 26px; }
/* 企业模块仍保留自身详情标题；仅收起外层重复的工作区标题和页签。 */
body.research-shell-active #researchDataDialog:is([data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .ir-panel > :is(.ir-header,.ir-tabs) { display: none; }
body.research-shell-active #researchDataDialog .ir-panel { border-color: #dce4ec; border-radius: 11px; box-shadow: 0 8px 28px #15314e08; }
body.research-shell-active #researchDataDialog .research-report { max-width: 1220px; margin-inline: auto; }

@media (max-width: 1200px) and (min-width: 981px) {
  body.research-shell-active #appHeader { padding-inline: 16px; gap: 10px; }
  body.research-shell-active #appHeader .country-import-button { padding-inline: 6px; }
  body.research-shell-active #appHeader .country-picker { margin-left: 0; padding-left: 9px; }
  body.research-shell-active #appHeader .account-name { max-width: 85px; }
  body.research-shell-active #researchDataDialog .research-toolbar { grid-template-columns: minmax(0,1fr) minmax(140px,1fr) 130px auto; height: auto; }
}
/* 办公屏新增主导航后，略收紧两侧编辑栏，为原制图画布保留可读宽度。 */
@media (min-width: 981px) and (max-width: 1350px) {
  body.research-shell-active:not(.is-left-collapsed) { --left-panel-width: 228px; }
  body.research-shell-active:not(.is-right-collapsed) { --right-panel-width: 270px; }
}
@media (max-width: 980px) {
  body.research-shell-active { --research-rail-width: 0px; --research-mobile-nav-height: 62px; min-width: 0; height: auto; overflow: auto; padding-top: var(--research-mobile-nav-height); }
  body.research-shell-active .research-sidebar { inset: 0 0 auto; width: 100%; height: var(--research-mobile-nav-height); padding: 4px 8px; overflow-x: auto; overflow-y: hidden; }
  body.research-shell-active .research-sidebar-brand { display: none; }
  body.research-shell-active #productWorkspaceNav { flex-direction: row; flex: 0 0 auto; width: max-content; min-width: 100%; gap: 12px; align-items: center; }
  body.research-shell-active .research-nav-group { display: flex; gap: 3px; width: auto; }
  body.research-shell-active .research-nav-support { margin: 0; padding: 0 0 0 10px; border-top: 0; border-left: 1px solid #ffffff24; }
  body.research-shell-active #productWorkspaceNav [data-product-workspace] { min-height: 52px; width: 67px; padding: 5px 3px; gap: 3px; font-size: 10px; }
  body.research-shell-active #productWorkspaceNav [data-product-workspace] > svg { width: 19px; height: 19px; }
  body.research-shell-active #appHeader { position: relative; top: auto; height: auto; min-height: 72px; margin-left: 0; width: 100%; padding: 12px 16px; gap: 10px; }
  body.research-shell-active #appHeader .header-actions { flex: 1 1 100%; }
  body.research-shell-active #researchScopeBar { width: 100%; margin-left: 0; padding-inline: 16px; gap: 11px; }
  body.research-shell-active :is(#mapWorkspace,#researchDataDialog) { width: 100%; margin-left: 0; }
  body.research-shell-active #mapWorkspace { display: flex; height: auto; }
  body.research-shell-active #mapWorkspace .workspace { min-height: max(420px,calc(100dvh - 220px)); }
  body.research-shell-active #researchDataDialog { height: calc(100dvh - var(--research-mobile-nav-height) - var(--research-topbar-height) - var(--research-scope-height)); min-height: 400px; }
  body.research-shell-active #researchDataDialog .research-data-header { padding: 18px 18px 14px; }
  body.research-shell-active #researchDataTitle { font-size: 22px; }
  body.research-shell-active #researchDataDialog:is([data-workspace="report"],[data-workspace="research"]) .research-toolbar { display: flex; flex-wrap: wrap; height: auto; }
  body.research-shell-active #researchDataDialog:is([data-workspace="report"],[data-workspace="research"]) .research-data-shell { grid-template-rows: auto auto minmax(0,1fr); }
  body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-detail-panel { padding: 0 16px 20px; }
}
@media (max-width: 540px) {
  body.research-shell-active #appHeader .brand-block { flex-wrap: wrap; flex: 1 1 auto; }
  body.research-shell-active #appHeader .brand-home-button { width: 30px; height: 30px; flex-basis: 30px; }
  body.research-shell-active #appHeader .app-name { font-size: 13px; }
  body.research-shell-active #appHeader .country-picker { margin-left: 0; padding-left: 8px; }
  body.research-shell-active #appHeader .country-picker select { width: 111px; }
  body.research-shell-active #appHeader .account-name { max-width: 95px; }
  body.research-shell-active #researchDataDialog .research-body { grid-template-columns: minmax(0,1fr); }
  body.research-shell-active #researchDataDialog[data-workspace="research"] .research-dataset-list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--research-shell-line); }
  body.research-shell-active #researchDataDialog[data-workspace="research"] .research-body { grid-template-rows: auto minmax(0,1fr); }
  body.research-shell-active #researchDataDialog .research-toolbar { display: flex; flex-wrap: wrap; height: auto; padding: 8px 12px; }
  body.research-shell-active #researchDataDialog .research-data-shell { grid-template-rows: auto auto minmax(0,1fr); }
  body.research-shell-active #researchDataDialog:is([data-workspace="home"],[data-workspace="market"],[data-workspace="enterprises"],[data-workspace="brief"]) .research-data-shell { grid-template-rows: auto minmax(0,1fr); }
  body.research-shell-active #researchScopeBar .research-scope-chip { max-width: 220px; flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.research-shell-active #mapWorkspace { transition: none; }
}
