/*
 * 五大模块门户最终样式层（v31）
 * 目的：收敛 v24 及更早版本的门户覆盖规则。经典 UI 使用浅色工程主题，
 * 新版 UI 使用深色封面主题；两套主题共用同一布局与卡片交互结构。
 */

/* 避免门户的 display:grid!important 覆盖页面切换时的 hidden 状态。 */
#platformView.platform-portal.hidden,
body:not([data-view="platform"]) #platformView.platform-portal {
  display: none !important;
  pointer-events: none !important;
}

body[data-view="platform"] #platformView.platform-portal {
  --portal-ink: #123f71;
  --portal-muted: #49779e;
  --portal-accent: #08a8c8;
  --portal-accent-strong: #126bd0;
  --portal-card: rgba(255, 255, 255, 0.91);
  --portal-line: rgba(37, 143, 202, 0.32);
  --portal-quick-a: rgba(215, 239, 248, 0.86);
  --portal-quick-b: rgba(236, 244, 248, 0.94);
  --portal-photo-overlay: rgba(240, 249, 253, 0.76);
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding: clamp(18px, 2.15vw, 42px) clamp(22px, 3.9vw, 76px) clamp(14px, 1.4vw, 30px);
  overflow: clip;
  color: var(--portal-ink);
  background:
    linear-gradient(105deg, var(--portal-photo-overlay) 0%, rgba(239, 250, 254, 0.68) 47%, rgba(218, 244, 253, 0.78) 100%),
    url("/figure/首页背景图.jpg") center / cover no-repeat !important;
}

body.ui-modern[data-view="platform"] #platformView.platform-portal {
  --portal-ink: #f4fbff;
  --portal-muted: #b9dbef;
  --portal-accent: #45d8f6;
  --portal-accent-strong: #1685ea;
  --portal-card: rgba(6, 39, 80, 0.84);
  --portal-line: rgba(101, 213, 255, 0.38);
  --portal-quick-a: rgba(60, 142, 186, 0.2);
  --portal-quick-b: rgba(10, 68, 120, 0.28);
  --portal-photo-overlay: rgba(1, 25, 57, 0.78);
  background:
    linear-gradient(110deg, var(--portal-photo-overlay) 0%, rgba(4, 44, 81, 0.73) 53%, rgba(1, 20, 49, 0.82) 100%),
    url("/figure/首页背景图.jpg") center / cover no-repeat !important;
}

/* 顶部：透明导航、无 Logo 白底、所有操作项统一基线。 */
#platformView .portal-header {
  position: relative !important;
  z-index: 5;
  width: min(100%, 1830px);
  margin: 0 auto;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#platformView .portal-header > :not(.portal-modern-topbar),
#platformView .portal-brand,
#platformView .portal-header-actions {
  display: none !important;
}

#platformView .portal-modern-topbar {
  display: grid !important;
  grid-template-columns: clamp(292px, 24vw, 438px) minmax(520px, 1fr) max-content;
  align-items: center !important;
  gap: clamp(18px, 2vw, 42px);
  min-height: clamp(78px, 7.6vh, 108px) !important;
  padding: clamp(5px, 0.5vw, 10px) 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#platformView .portal-modern-brand {
  display: flex !important;
  align-items: center;
  min-width: 0;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

#platformView .portal-modern-brand img {
  display: block;
  width: clamp(286px, 21vw, 414px) !important;
  height: clamp(42px, 5.3vh, 72px) !important;
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}

/* 原 Logo 的深色文字在深色封面下改为浅色，不添加白色底板。 */
body.ui-modern #platformView .portal-modern-brand img {
  filter: grayscale(1) brightness(0) invert(1) contrast(1.24) !important;
  opacity: 0.97;
}

#platformView .portal-modern-module-nav {
  display: flex !important;
  justify-content: center;
  align-items: center;
  min-width: 0;
  gap: clamp(14px, 1.55vw, 34px);
  padding: 0 !important;
  background: transparent !important;
}

#platformView .portal-modern-module-nav button,
#platformView .portal-modern-actions > * {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: clamp(42px, 4.7vh, 58px) !important;
  margin: 0 !important;
  padding: 0 clamp(4px, 0.48vw, 10px) !important;
  font-size: clamp(16px, 1.1vw, 21px) !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  white-space: nowrap;
  color: var(--portal-ink) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}

#platformView .portal-modern-module-nav button {
  position: relative;
  letter-spacing: 0.02em;
}

#platformView .portal-modern-module-nav button::after {
  position: absolute;
  right: 18%;
  bottom: 3px;
  left: 18%;
  height: 3px;
  content: "";
  opacity: 0;
  border-radius: 999px;
  background: var(--portal-accent);
  transform: scaleX(0.45);
  transition: transform 180ms ease, opacity 180ms ease;
}

#platformView .portal-modern-module-nav button:hover::after,
#platformView .portal-modern-module-nav button.is-active::after,
#platformView .portal-modern-module-nav button[aria-pressed="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

#platformView .portal-modern-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end;
  gap: clamp(9px, 0.8vw, 18px);
  white-space: nowrap;
}

/* 每个主题只显示“切换到另一套 UI”的入口。 */
body:not(.ui-modern) #platformView [data-portal-ui="classic"],
body.ui-modern #platformView [data-portal-ui="modern"] {
  display: none !important;
}

#platformView .portal-modern-actions > *:hover,
#platformView .portal-modern-actions > *:focus-visible {
  color: var(--portal-accent-strong) !important;
  outline: none;
}

/* 三段式首屏：主视觉和介绍卡同一基线，卡片轨道固定在首屏底部。 */
#platformView .portal-module-showcase {
  display: grid !important;
  grid-template-columns: minmax(0, 0.98fr) minmax(500px, 0.9fr);
  grid-template-rows: minmax(352px, 1fr) clamp(372px, 41svh, 460px);
  grid-template-areas:
    "hero intro"
    "rail rail";
  align-items: stretch;
  width: min(100%, 1830px) !important;
  min-height: calc(100svh - clamp(96px, 10vh, 142px));
  margin: 0 auto !important;
  padding: clamp(4px, 0.7vw, 14px) 0 0 !important;
  gap: clamp(16px, 2vw, 42px) clamp(46px, 6.1vw, 132px) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#platformView .portal-showcase-copy {
  display: flex !important;
  grid-area: hero;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0;
  padding: clamp(18px, 3.6vw, 72px) 0 clamp(10px, 2vw, 38px) clamp(10px, 3.6vw, 88px) !important;
  background: transparent !important;
}

#platformView .portal-showcase-copy > :not(.portal-modern-hero-copy) {
  display: none !important;
}

#platformView .portal-modern-hero-copy {
  width: min(100%, 760px);
  color: var(--portal-ink);
  text-align: left;
}

#platformView .portal-modern-hero-copy > span {
  display: block;
  margin: 0 0 clamp(12px, 1.6vh, 22px);
  font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
  font-size: clamp(31px, 2.05vw, 46px) !important;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: var(--portal-accent) !important;
}

#platformView .portal-modern-hero-copy h3 {
  max-width: 100%;
  margin: 0 !important;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: clamp(56px, 5.15vw, 108px) !important;
  font-weight: 900 !important;
  line-height: 0.98 !important;
  letter-spacing: clamp(0.015em, 0.06vw, 0.07em);
  white-space: nowrap;
  color: var(--portal-ink) !important;
  text-shadow: 0 7px 24px rgba(0, 71, 122, 0.12);
}

#platformView .portal-modern-hero-copy p {
  max-width: 760px;
  margin: clamp(24px, 3.1vh, 44px) 0 0 !important;
  font-size: clamp(14px, 1.05vw, 20px) !important;
  font-weight: 800;
  line-height: 1.5 !important;
  letter-spacing: 0.13em;
  color: var(--portal-muted) !important;
}

#platformView .portal-intro-stage {
  display: flex !important;
  grid-area: intro;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: clamp(12px, 1.4vw, 24px) 0;
}

#platformView .portal-module-intro {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  column-gap: clamp(22px, 2.1vw, 43px);
  row-gap: clamp(8px, 1vh, 15px);
  width: min(100%, 710px);
  min-height: clamp(270px, 31vh, 360px);
  padding: clamp(30px, 3vw, 54px) clamp(32px, 3.4vw, 62px);
  color: var(--portal-ink);
  background: var(--portal-card) !important;
  border: 1px solid var(--portal-line) !important;
  border-radius: clamp(25px, 2vw, 34px) !important;
  box-shadow: 0 20px 42px rgba(12, 72, 115, 0.15) !important;
  backdrop-filter: blur(12px);
}

#platformView .portal-module-intro .portal-intro-index {
  grid-row: span 4;
  align-self: center;
  font-size: clamp(76px, 6.1vw, 126px) !important;
  font-weight: 850;
  line-height: 0.82;
  letter-spacing: -0.08em;
  color: var(--portal-accent) !important;
}

#platformView .portal-module-intro h3,
#platformView .portal-module-intro .portal-intro-title {
  min-width: 0;
  margin: 0 !important;
  font-size: clamp(31px, 2.35vw, 48px) !important;
  font-weight: 860 !important;
  line-height: 1.14 !important;
  color: var(--portal-ink) !important;
}

#platformView .portal-module-intro .portal-intro-subtitle {
  margin: 0 !important;
  font-size: clamp(17px, 1.22vw, 23px) !important;
  font-weight: 780;
  line-height: 1.35;
  color: var(--portal-accent-strong) !important;
}

#platformView .portal-module-intro .portal-intro-description {
  margin: 0 !important;
  font-size: clamp(16px, 1.1vw, 21px) !important;
  line-height: 1.7 !important;
  color: var(--portal-muted) !important;
}

#platformView .portal-intro-enter {
  justify-self: start;
  min-height: clamp(48px, 5vh, 62px) !important;
  margin-top: clamp(7px, 1vh, 13px) !important;
  padding: 0 clamp(23px, 1.8vw, 34px) !important;
  font-size: clamp(17px, 1.2vw, 22px) !important;
  font-weight: 820 !important;
  color: #fff !important;
  background: linear-gradient(118deg, var(--portal-accent-strong), var(--portal-accent)) !important;
  border: 1px solid rgba(255, 255, 255, 0.46) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 24px rgba(21, 136, 194, 0.24) !important;
}

/* 介绍卡两侧的切换入口默认隐藏，只在靠近或聚焦时出现。 */
#platformView .portal-rail-edge {
  position: absolute !important;
  z-index: 3;
  top: 50% !important;
  bottom: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: clamp(34px, 3vw, 52px) !important;
  height: clamp(62px, 7vw, 98px) !important;
  padding: 0 !important;
  opacity: 0;
  color: var(--portal-accent-strong) !important;
  background: color-mix(in srgb, var(--portal-card) 78%, transparent) !important;
  border: 1px solid var(--portal-line) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 18px rgba(12, 72, 115, 0.12) !important;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

#platformView .portal-rail-edge span {
  font-size: clamp(18px, 1.5vw, 28px) !important;
}

#platformView .portal-rail-edge-prev {
  left: clamp(-28px, -2.3vw, -10px) !important;
  transform: translateY(-50%) translateX(-8px) !important;
}

#platformView .portal-rail-edge-next {
  right: clamp(-28px, -2.3vw, -10px) !important;
  transform: translateY(-50%) translateX(8px) !important;
}

#platformView .portal-intro-stage:hover .portal-rail-edge,
#platformView .portal-rail-edge:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

#platformView .portal-intro-stage:hover .portal-rail-edge-prev,
#platformView .portal-rail-edge-prev:focus-visible {
  transform: translateY(-50%) translateX(0) !important;
}

#platformView .portal-intro-stage:hover .portal-rail-edge-next,
#platformView .portal-rail-edge-next:focus-visible {
  transform: translateY(-50%) translateX(0) !important;
}

/* 五卡弧形轨道：以未缩放的布局坐标居中，再仅用 transform 制造层级。 */
#platformView .portal-module-rail {
  display: flex !important;
  grid-area: rail;
  align-items: flex-end !important;
  gap: clamp(22px, 2vw, 42px) !important;
  width: 100% !important;
  min-width: 0;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding-top: clamp(42px, 5.2vh, 64px) !important;
  padding-bottom: clamp(13px, 1.8vh, 24px) !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none !important;
  -ms-overflow-style: none;
  cursor: grab;
}

#platformView .portal-module-rail::-webkit-scrollbar,
#platformView .portal-module-rail::after {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

#platformView .portal-module-rail.is-dragging {
  cursor: grabbing;
  user-select: none;
  scroll-snap-type: none;
}

#platformView .platform-module-card {
  box-sizing: border-box !important;
  position: relative !important;
  flex: 0 0 clamp(355px, 23vw, 465px) !important;
  width: clamp(355px, 23vw, 465px) !important;
  height: clamp(314px, 35vh, 372px) !important;
  min-height: clamp(314px, 35vh, 372px) !important;
  margin: 0 !important;
  padding: clamp(18px, 1.5vw, 27px) !important;
  overflow: visible !important;
  color: var(--portal-ink) !important;
  background: var(--portal-card) !important;
  border: 1px solid var(--portal-line) !important;
  border-radius: clamp(22px, 1.8vw, 30px) !important;
  box-shadow: 0 13px 28px rgba(14, 70, 109, 0.13) !important;
  scroll-snap-align: center;
  transform: translate3d(0, 16px, 0) scale(0.85);
  transform-origin: center bottom;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 300ms ease, border-color 300ms ease, opacity 240ms ease !important;
  will-change: transform;
  cursor: pointer;
}

#platformView .platform-module-card.portal-rail-far-before,
#platformView .platform-module-card.portal-rail-far-after {
  opacity: 0.72;
  transform: translate3d(0, 35px, 0) scale(0.76);
}

#platformView .platform-module-card.portal-rail-near-before,
#platformView .platform-module-card.portal-rail-near-after {
  z-index: 2;
  opacity: 0.9;
  transform: translate3d(0, 8px, 0) scale(0.92);
}

#platformView .platform-module-card.portal-rail-active {
  z-index: 4;
  opacity: 1;
  border-color: var(--portal-accent) !important;
  box-shadow: 0 24px 42px rgba(10, 130, 191, 0.24) !important;
  transform: translate3d(0, -30px, 0) scale(1.045);
}

#platformView .platform-module-card .module-card-head {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: clamp(9px, 0.75vw, 14px);
  min-height: clamp(39px, 4.25vh, 48px);
  margin: 0 0 clamp(15px, 1.6vh, 20px) !important;
  padding: 0 !important;
  cursor: pointer;
}

#platformView .platform-module-card .module-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: clamp(30px, 2.4vw, 40px) !important;
  height: clamp(30px, 2.4vw, 40px) !important;
  padding: 0 !important;
  font-size: clamp(11px, 0.8vw, 13px) !important;
  font-weight: 800;
  line-height: 1;
  color: #fff !important;
  border: 0 !important;
  border-radius: 9px !important;
  box-shadow: none !important;
}

#platformView .platform-module-card .module-card-head h3 {
  display: flex !important;
  align-items: baseline;
  min-width: 0;
  margin: 0 !important;
  font-size: clamp(20px, 1.42vw, 28px) !important;
  font-weight: 850 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  color: var(--portal-ink) !important;
}

#platformView .platform-module-card .module-card-title,
#platformView .platform-module-card .module-card-head h3 em {
  display: inline !important;
  overflow: visible !important;
  min-width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  font: inherit !important;
  font-size: inherit !important;
  font-style: normal !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  color: inherit !important;
  white-space: nowrap !important;
}

#platformView .platform-module-card .module-card-head h3 em {
  margin-left: 0.24em !important;
}

#platformView .platform-module-card .module-open {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-end;
  min-height: 32px !important;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  font-size: clamp(15px, 1.02vw, 19px) !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  white-space: nowrap;
  color: var(--portal-accent-strong) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}

#platformView .platform-module-card ul {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-content: start;
  gap: clamp(7px, 0.9vh, 11px) !important;
  min-width: 0;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  list-style: none !important;
}

#platformView .platform-module-card li {
  position: relative;
  display: flex !important;
  align-items: center;
  min-height: clamp(29px, 3.2vh, 36px);
  margin: 0 !important;
  padding: clamp(5px, 0.55vh, 7px) clamp(9px, 0.8vw, 13px) clamp(5px, 0.55vh, 7px) clamp(21px, 1.65vw, 28px) !important;
  overflow: hidden;
  font-size: clamp(15px, 1.05vw, 19px) !important;
  font-weight: 680 !important;
  line-height: 1.3 !important;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--portal-ink) !important;
  background: var(--portal-quick-a) !important;
  border: 0 !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

#platformView .platform-module-card li:nth-child(even) {
  background: var(--portal-quick-b) !important;
}

#platformView .platform-module-card li::before {
  position: absolute;
  left: clamp(9px, 0.7vw, 12px);
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 999px;
  background: rgba(32, 48, 62, 0.58) !important;
}

body.ui-modern #platformView .platform-module-card li::before {
  background: rgba(219, 241, 255, 0.72) !important;
}

#platformView .platform-module-card li:hover,
#platformView .platform-module-card li:focus-visible {
  color: var(--portal-accent-strong) !important;
  background: color-mix(in srgb, var(--portal-accent) 15%, var(--portal-card)) !important;
  outline: none;
  transform: translateX(3px);
}

/* 门户的统计区完全隐藏；统计在综合数据看板模块中查看。 */
#platformView #platformSummaryGrid,
#platformView .platform-summary-grid,
#platformView .portal-module-rail-gutter,
#platformView .portal-rail-scroll-hint {
  display: none !important;
}

/* WeUI 组件在门户内保持工程平台色系，不干扰模块业务页已有按钮。 */
#platformView .weui-btn,
#platformView .weui-btn_primary {
  background: linear-gradient(118deg, var(--portal-accent-strong), var(--portal-accent)) !important;
}

@media (max-width: 1160px) {
  #platformView .portal-modern-topbar {
    grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.35fr) max-content;
    gap: 14px;
  }

  #platformView .portal-modern-brand img {
    width: min(100%, 300px) !important;
  }

  #platformView .portal-modern-module-nav {
    gap: 8px;
  }

  #platformView .portal-module-showcase {
    grid-template-columns: minmax(0, 0.92fr) minmax(430px, 0.88fr);
    gap: 18px 36px !important;
  }

  #platformView .portal-modern-hero-copy h3 {
    font-size: clamp(47px, 5vw, 72px) !important;
  }
}

@media (max-width: 980px) {
  body[data-view="platform"] #platformView.platform-portal {
    overflow: visible;
  }

  #platformView .portal-modern-topbar {
    grid-template-columns: 1fr max-content;
  }

  #platformView .portal-modern-module-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  #platformView .portal-module-showcase {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(270px, auto) minmax(280px, auto) 400px;
    grid-template-areas:
      "hero"
      "intro"
      "rail";
    min-height: auto;
  }

  #platformView .portal-showcase-copy {
    justify-content: flex-start !important;
    padding-left: clamp(14px, 6vw, 58px) !important;
  }

  #platformView .portal-intro-stage {
    justify-content: flex-start;
  }
}

@media (max-height: 820px) and (min-width: 981px) {
  body[data-view="platform"] #platformView.platform-portal {
    overflow: visible;
  }

  #platformView .portal-module-showcase {
    min-height: 790px;
    grid-template-rows: 350px 410px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #platformView .platform-module-card,
  #platformView .portal-rail-edge,
  #platformView .portal-modern-module-nav button::after,
  #platformView .platform-module-card li {
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
 * v32 portal refinement: one stable geometry layer for both themes.
 * This layer intentionally comes last, so old portal releases cannot move
 * cards below the fold or override the selected-card arc.
 * -------------------------------------------------------------------------- */

body[data-view="platform"] #platformView.platform-portal {
  --portal-photo-overlay: rgba(239, 249, 253, 0.69);
  padding: clamp(14px, 1.75vw, 34px) clamp(18px, 3.4vw, 68px) clamp(12px, 1.1vw, 24px);
  overflow-x: hidden;
  overflow-y: auto;
}

body.ui-modern[data-view="platform"] #platformView.platform-portal {
  --portal-photo-overlay: rgba(1, 25, 57, 0.72);
}

body[data-view="platform"] #platformView.platform-portal::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.11), transparent 42%, rgba(211, 244, 253, 0.14));
}

body.ui-modern[data-view="platform"] #platformView.platform-portal::before {
  background: linear-gradient(90deg, rgba(1, 13, 36, 0.24), transparent 45%, rgba(15, 104, 150, 0.16));
}

#platformView .portal-modern-topbar {
  grid-template-columns: clamp(336px, 26vw, 500px) minmax(540px, 1fr) max-content;
  min-height: clamp(84px, 8.2vh, 116px) !important;
  gap: clamp(20px, 2.15vw, 45px);
}

#platformView .portal-modern-brand img {
  width: clamp(340px, 25vw, 500px) !important;
  height: clamp(52px, 6.2vh, 84px) !important;
  max-height: 84px;
}

/* Preserve the transparent source image: the dark theme gets a light mark,
 * but never a white brand container behind it. */
body.ui-modern #platformView .portal-modern-brand img {
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28)) !important;
  opacity: 0.98;
}

#platformView .portal-modern-module-nav button,
#platformView .portal-modern-actions > * {
  min-height: clamp(46px, 5.1vh, 62px) !important;
  font-size: clamp(17px, 1.16vw, 23px) !important;
}

#platformView .portal-modern-module-nav {
  gap: clamp(16px, 1.7vw, 36px);
}

#platformView .portal-module-showcase {
  grid-template-columns: minmax(0, 0.93fr) minmax(520px, 0.9fr);
  grid-template-rows: minmax(304px, 1fr) clamp(348px, 40svh, 430px);
  min-height: calc(100svh - clamp(101px, 10.1vh, 140px));
  gap: clamp(12px, 1.4vw, 26px) clamp(64px, 7.4vw, 154px) !important;
}

#platformView .portal-showcase-copy,
#platformView .portal-intro-stage {
  align-self: center;
  padding-top: clamp(8px, 1vw, 18px);
  padding-bottom: clamp(8px, 1vw, 18px);
}

#platformView .portal-showcase-copy {
  justify-content: flex-end !important;
  padding-right: clamp(8px, 1vw, 26px) !important;
  padding-left: clamp(10px, 3.4vw, 76px) !important;
}

#platformView .portal-modern-hero-copy {
  width: min(100%, 790px);
}

#platformView .portal-modern-hero-copy > span {
  margin-bottom: clamp(13px, 1.8vh, 26px);
  font-size: clamp(34px, 2.28vw, 51px) !important;
}

#platformView .portal-modern-hero-copy h3 {
  font-size: clamp(64px, 5.7vw, 116px) !important;
  line-height: 1 !important;
  letter-spacing: clamp(0.005em, 0.035vw, 0.04em);
}

#platformView .portal-modern-hero-copy p {
  max-width: 790px;
  margin-top: clamp(26px, 3.25vh, 46px) !important;
  font-size: clamp(15px, 1.12vw, 21px) !important;
  line-height: 1.56 !important;
}

#platformView .portal-intro-stage {
  justify-content: flex-start;
}

#platformView .portal-module-intro {
  width: min(100%, 760px);
  min-height: clamp(278px, 31.5vh, 374px);
  padding: clamp(30px, 2.8vw, 52px) clamp(34px, 3.25vw, 60px);
}

#platformView .portal-module-intro .portal-intro-index {
  font-size: clamp(82px, 6.4vw, 130px) !important;
}

#platformView .portal-module-intro h3,
#platformView .portal-module-intro .portal-intro-title {
  font-size: clamp(33px, 2.45vw, 50px) !important;
}

/* The rail has enough top space for the selected card to rise, while its
 * lower padding keeps all shortcut rows above the viewport edge. */
#platformView .portal-module-rail {
  align-items: flex-end !important;
  gap: clamp(24px, 2.1vw, 44px) !important;
  padding-top: clamp(28px, 3.1vh, 42px) !important;
  padding-bottom: clamp(26px, 3vh, 38px) !important;
  overscroll-behavior-inline: contain;
}

#platformView .platform-module-card {
  flex-basis: clamp(405px, 25vw, 490px) !important;
  width: clamp(405px, 25vw, 490px) !important;
  height: clamp(278px, 31.5vh, 334px) !important;
  min-height: clamp(278px, 31.5vh, 334px) !important;
  padding: clamp(17px, 1.25vw, 24px) !important;
  transform: translate3d(0, 18px, 0) scale(0.82);
}

#platformView .platform-module-card.portal-rail-far {
  z-index: 1;
  opacity: 0.72;
  transform: translate3d(0, 38px, 0) scale(0.72);
}

#platformView .platform-module-card.portal-rail-near {
  z-index: 2;
  opacity: 0.91;
  transform: translate3d(0, 12px, 0) scale(0.9);
}

#platformView .platform-module-card.portal-rail-active {
  z-index: 4;
  opacity: 1;
  transform: translate3d(0, -24px, 0) scale(1.02);
}

#platformView .platform-module-card .module-card-head {
  grid-template-columns: clamp(33px, 2.4vw, 40px) minmax(0, 1fr) max-content;
  min-height: clamp(37px, 4vh, 44px);
  margin-bottom: clamp(9px, 1.15vh, 14px) !important;
  column-gap: clamp(8px, 0.65vw, 12px);
}

#platformView .platform-module-card .module-icon {
  width: clamp(31px, 2.35vw, 39px) !important;
  height: clamp(31px, 2.35vw, 39px) !important;
}

#platformView .platform-module-card .module-card-head h3 {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(19px, 1.28vw, 25px) !important;
  letter-spacing: -0.025em !important;
}

#platformView .platform-module-card .module-card-title {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
}

#platformView .platform-module-card .module-card-head h3 em {
  flex: 0 0 auto;
  font-size: inherit !important;
}

#platformView .platform-module-card .module-open {
  min-height: 30px !important;
  padding-left: clamp(4px, 0.45vw, 8px) !important;
  font-size: clamp(14px, 0.96vw, 18px) !important;
}

#platformView .platform-module-card ul.weui-cells {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: clamp(4px, 0.6vh, 7px) !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

#platformView .platform-module-card ul.weui-cells::before,
#platformView .platform-module-card ul.weui-cells::after {
  display: none !important;
}

#platformView .platform-module-card li.weui-cell {
  box-sizing: border-box;
  min-height: clamp(25px, 2.7vh, 31px);
  padding: clamp(3px, 0.42vh, 5px) clamp(8px, 0.66vw, 11px) clamp(3px, 0.42vh, 5px) clamp(19px, 1.45vw, 24px) !important;
  font-size: clamp(14px, 0.92vw, 17px) !important;
  font-weight: 720 !important;
  line-height: 1.25 !important;
  color: color-mix(in srgb, var(--portal-ink) 87%, #263746) !important;
}

#platformView .platform-module-card li.weui-cell::before {
  left: clamp(8px, 0.58vw, 10px);
  width: 4px;
  height: 4px;
  background: rgba(28, 38, 46, 0.7) !important;
}

body.ui-modern #platformView .platform-module-card li.weui-cell {
  color: rgba(235, 248, 255, 0.96) !important;
}

body.ui-modern #platformView .platform-module-card li.weui-cell::before {
  background: rgba(225, 244, 255, 0.72) !important;
}

/* The tiny invisible hit zones on either side of the description card only
 * surface their arrows when the user intentionally approaches them. */
#platformView .portal-rail-edge {
  width: clamp(38px, 3.1vw, 56px) !important;
  height: clamp(68px, 6.6vw, 92px) !important;
}

@media (max-width: 1280px) {
  #platformView .portal-modern-topbar {
    grid-template-columns: minmax(288px, 0.88fr) minmax(0, 1.45fr) max-content;
  }

  #platformView .portal-modern-brand img {
    width: clamp(286px, 22vw, 360px) !important;
  }

  #platformView .portal-module-showcase {
    grid-template-columns: minmax(0, 0.94fr) minmax(450px, 0.9fr);
    gap: 12px clamp(34px, 4vw, 72px) !important;
  }

  #platformView .portal-modern-hero-copy h3 {
    font-size: clamp(56px, 5vw, 84px) !important;
  }
}

@media (max-height: 850px) and (min-width: 981px) {
  body[data-view="platform"] #platformView.platform-portal {
    min-height: 900px;
  }

  #platformView .portal-module-showcase {
    grid-template-rows: 362px 408px;
    min-height: 770px;
  }
}

/* -------------------------------------------------------------------------
   Portal v33: final viewport-safe composition and interaction layer.
   Older portal prototypes used fixed heights and competing transforms, which
   pushed the rail below the fold.  This final layer deliberately wins.
   ------------------------------------------------------------------------- */

/* The portal must never remain visible behind an opened module workspace. */
body[data-view]:not([data-view="platform"]) #platformView {
  display: none !important;
}

body[data-view="platform"] #platformView.platform-portal {
  display: block;
  min-height: max(730px, calc(100svh - 108px)) !important;
  overflow: visible !important;
}

#platformView.platform-portal .portal-module-showcase {
  box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 0.92fr) !important;
  grid-template-rows: minmax(326px, 1fr) clamp(340px, 37svh, 390px) !important;
  grid-template-areas:
    "hero intro"
    "rail rail" !important;
  gap: clamp(18px, 2.4vw, 52px) clamp(36px, 5.2vw, 112px) !important;
  min-height: max(730px, calc(100svh - 108px)) !important;
  height: auto !important;
  padding: clamp(18px, 2.4vh, 34px) clamp(24px, 5vw, 92px) clamp(8px, 1.2vh, 16px) !important;
}

#platformView .portal-hero-stage,
#platformView .portal-intro-stage {
  box-sizing: border-box;
  min-height: 0 !important;
  height: 100%;
  align-self: stretch !important;
}

#platformView .portal-hero-stage {
  justify-content: center !important;
  padding-left: clamp(12px, 2.6vw, 54px) !important;
  padding-right: 0 !important;
}

#platformView .portal-hero-copy {
  max-width: min(100%, 780px) !important;
  transform: translateY(0) !important;
}

#platformView .portal-hero-kicker {
  font-size: clamp(25px, 2.35vw, 42px) !important;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

#platformView .portal-hero-copy h1 {
  font-size: clamp(50px, 5.45vw, 102px) !important;
  line-height: 1.05 !important;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

#platformView .portal-hero-copy p {
  font-size: clamp(12px, 1.05vw, 18px) !important;
  line-height: 1.55;
  max-width: 720px;
}

#platformView .portal-intro-stage {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

#platformView .portal-module-intro {
  box-sizing: border-box;
  width: min(100%, 650px) !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: 100%;
  margin: 0 !important;
  padding: clamp(28px, 3.8vw, 58px) !important;
}

/* Keep the logo transparent while preserving contrast in both themes. */
#platformView .portal-modern-brand,
#platformView .portal-brand,
#platformView .platform-brand {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-width: 0 !important;
}

#platformView .portal-modern-brand img,
#platformView .portal-brand img,
#platformView .platform-brand img {
  display: block;
  width: clamp(230px, 16.5vw, 365px) !important;
  max-width: min(26vw, 365px);
  max-height: clamp(44px, 5.2vh, 76px);
  height: auto !important;
  object-fit: contain;
  background: transparent !important;
  filter: drop-shadow(0 2px 4px rgba(13, 71, 119, 0.16));
}

body.ui-modern #platformView .portal-modern-brand img,
body.ui-modern #platformView .portal-brand img,
body.ui-modern #platformView .platform-brand img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.42));
}

/* A compact, bottom anchored rail with enough room for all seven shortcuts. */
#platformView .portal-module-rail {
  box-sizing: border-box;
  min-height: 0 !important;
  height: 100% !important;
  align-self: stretch !important;
  align-items: flex-end !important;
  gap: clamp(14px, 1.6vw, 28px) !important;
  padding: clamp(18px, 2.5vh, 30px) max(18px, calc((100% - 1380px) / 2)) 6px !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

#platformView .portal-module-rail::-webkit-scrollbar { display: none; }

#platformView .platform-module-card {
  box-sizing: border-box;
  flex: 0 0 clamp(405px, 25vw, 470px) !important;
  width: clamp(405px, 25vw, 470px) !important;
  min-width: clamp(405px, 25vw, 470px) !important;
  height: min(316px, calc(100% - 22px)) !important;
  min-height: 0 !important;
  max-height: 316px !important;
  margin: 0 !important;
  padding: clamp(18px, 1.55vw, 24px) !important;
  overflow: hidden !important;
  scroll-snap-align: center;
  cursor: pointer;
  transform-origin: 50% 100%;
}

#platformView .platform-module-card.portal-rail-active {
  z-index: 4;
  transform: translateY(-22px) scale(1.035) !important;
}

#platformView .platform-module-card.portal-rail-near {
  z-index: 2;
  transform: translateY(-7px) scale(0.94) !important;
}

#platformView .platform-module-card.portal-rail-far {
  z-index: 1;
  transform: translateY(15px) scale(0.85) !important;
}

#platformView .platform-module-card .module-card-head {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 38px;
  margin-bottom: 14px !important;
  cursor: pointer;
}

#platformView .platform-module-card .module-card-head h3 {
  display: block !important;
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  color: inherit;
  font-size: clamp(18px, 1.34vw, 24px) !important;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  white-space: nowrap !important;
  text-overflow: ellipsis;
}

#platformView .platform-module-card .module-card-title,
#platformView .platform-module-card .module-card-head h3 em {
  display: inline !important;
  font-size: inherit !important;
  font-style: normal;
  font-weight: inherit;
  vertical-align: baseline;
  white-space: nowrap !important;
}

#platformView .platform-module-card .module-card-head h3 em { margin-left: 0.24em !important; }

#platformView .platform-module-card .module-open {
  justify-self: end;
  display: inline-flex !important;
  align-items: center;
  min-height: 32px;
  padding: 0 0 0 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #0876c7 !important;
  font-size: clamp(14px, 0.95vw, 17px) !important;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

#platformView .platform-module-card .weui-cells,
#platformView .platform-module-card .module-quick-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 7px !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

#platformView .platform-module-card .weui-cell,
#platformView .platform-module-card li {
  position: relative;
  display: flex !important;
  align-items: center;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 4px 10px 4px 22px !important;
  border: 0 !important;
  border-radius: 7px;
  background: rgba(117, 154, 184, 0.10) !important;
  color: #315d83 !important;
  font-size: clamp(14px, 1.02vw, 17px) !important;
  font-weight: 650;
  line-height: 1.4 !important;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

#platformView .platform-module-card .weui-cell:nth-child(even),
#platformView .platform-module-card li:nth-child(even) {
  background: rgba(106, 124, 143, 0.07) !important;
}

#platformView .platform-module-card .weui-cell::before,
#platformView .platform-module-card li::before {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  left: 10px !important;
  width: 5px !important;
  height: 5px !important;
  margin: -2.5px 0 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(35, 50, 63, 0.74) !important;
}

#platformView .platform-module-card .weui-cell:hover,
#platformView .platform-module-card li:hover {
  background: rgba(10, 148, 201, 0.16) !important;
  color: #075f9e !important;
  transform: translateX(3px);
}

/* Do not reintroduce a portal masthead inside individual workspaces. */
.module-local-nav .module-nav-brand,
.module-local-nav .module-nav-title,
.module-local-nav .module-nav-subtitle {
  display: none !important;
}

@media (max-width: 1180px) {
  #platformView.platform-portal .portal-module-showcase {
    grid-template-columns: minmax(0, 1fr) minmax(380px, .9fr) !important;
    gap: 22px 34px !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
  }
  #platformView .portal-hero-copy h1 { font-size: clamp(45px, 5.1vw, 74px) !important; }
}

@media (max-height: 790px) and (min-width: 981px) {
  body[data-view="platform"] #platformView.platform-portal,
  #platformView.platform-portal .portal-module-showcase { min-height: 700px !important; }
  #platformView.platform-portal .portal-module-showcase { grid-template-rows: 312px 354px !important; }
  #platformView .portal-module-rail { padding-top: 22px !important; }
}

/* -------------------------------------------------------------------------
   Portal v34: final specificity bridge for the legacy portal layers.
   The older v24 portal used a grid-template shorthand with a more specific
   selector.  Repeating that shorthand here is intentional: it prevents the
   cards from being pushed below the first screen on 720px-high displays.
   ------------------------------------------------------------------------- */
html body[data-view="platform"] #platformView.platform-portal .portal-module-showcase {
  display: grid !important;
  grid-template:
    "hero intro" minmax(300px, 1fr)
    "rail rail" clamp(330px, 35svh, 370px)
    / minmax(0, 1fr) minmax(440px, 0.92fr) !important;
  /* Keep the module-card rail twice as far from the introduction card. */
  row-gap: clamp(36px, 4.8vw, 104px) !important;
  min-height: max(690px, calc(100svh - 92px)) !important;
  height: auto !important;
  align-content: stretch !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail {
  box-sizing: border-box !important;
  align-self: stretch !important;
  align-items: flex-end !important;
  height: 100% !important;
  min-height: 0 !important;
  padding-top: clamp(10px, 1.7vh, 18px) !important;
  padding-bottom: 5px !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-width: none !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail::-webkit-scrollbar {
  display: none !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card {
  flex: 0 0 clamp(390px, 25vw, 458px) !important;
  width: clamp(390px, 25vw, 458px) !important;
  min-width: clamp(390px, 25vw, 458px) !important;
  height: min(306px, calc(100% - 12px)) !important;
  max-height: 306px !important;
  min-height: 0 !important;
  padding: clamp(15px, 1.35vw, 21px) !important;
  overflow: hidden !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card.portal-rail-active {
  transform: translateY(-18px) scale(1.028) !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card.portal-rail-near {
  transform: translateY(-4px) scale(0.94) !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card.portal-rail-far {
  transform: translateY(12px) scale(0.86) !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card .module-card-head {
  min-height: 35px !important;
  margin-bottom: 9px !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card .weui-cells,
html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card .module-quick-list {
  gap: 5px !important;
}

html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card .weui-cell,
html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card li {
  min-height: 22px !important;
  padding-top: 3px !important;
  padding-bottom: 3px !important;
  padding-left: 20px !important;
  line-height: 1.3 !important;
}

/* The original logo stays transparent.  On the dark edition it is recoloured
   cyan rather than inverted to a white rectangle, so the mark remains legible
   without adding a white logo backdrop. */
html body.ui-modern #platformView.platform-portal .portal-modern-brand img,
html body.ui-modern #platformView.platform-portal .portal-brand img,
html body.ui-modern #platformView.platform-portal .platform-brand img {
  background: transparent !important;
  filter: brightness(0) saturate(100%) invert(83%) sepia(27%) saturate(1696%) hue-rotate(148deg) brightness(104%) contrast(102%) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.38)) !important;
}

/* Quiet but visible shortcut markers: engineering grey in the light portal,
   soft blue-grey in the dark portal.  These also override the old cyan dash. */
html body:not(.ui-modern) #platformView.platform-portal .portal-module-rail .platform-module-card .weui-cell::before,
html body:not(.ui-modern) #platformView.platform-portal .portal-module-rail .platform-module-card li::before {
  background: rgba(41, 57, 69, 0.70) !important;
}

html body.ui-modern #platformView.platform-portal .portal-module-rail .platform-module-card .weui-cell::before,
html body.ui-modern #platformView.platform-portal .portal-module-rail .platform-module-card li::before {
  background: rgba(180, 202, 220, 0.84) !important;
}

@media (max-height: 790px) and (min-width: 981px) {
  html body[data-view="platform"] #platformView.platform-portal .portal-module-showcase {
    grid-template:
      "hero intro" 260px
      "rail rail" 320px
      / minmax(0, 1fr) minmax(390px, 0.92fr) !important;
    min-height: 600px !important;
    padding-top: 14px !important;
    padding-bottom: 4px !important;
  }

  html body[data-view="platform"] #platformView.platform-portal .portal-module-rail {
    padding-top: 10px !important;
  }

  html body[data-view="platform"] #platformView.platform-portal .portal-module-rail .platform-module-card {
    height: 300px !important;
    max-height: 300px !important;
  }

  html body[data-view="platform"] #platformView.platform-portal .portal-module-intro {
    padding: 22px clamp(24px, 3vw, 40px) !important;
  }
}
