/* ==========================================================================
   文山烟草 · 样本户全生命周期管理系统
   统一门户主题层（portal-theme.css）

   设计目标：贴合中国烟草地市级营销子系统门户形态（顶部品牌横幅 + 面包屑 +
   左侧分组导航 + 内容驾驶舱 + 右侧悬浮工具条），并统一两套前端入口
   （lifecycle.html / index.html）的观感。

   实现约束：
   - 本文件在所有既有样式之后加载，只做“外观覆盖”，不改任何 JS 钩子；
   - 结构类名（card / metric / data-table / badge / panel / view …）沿用旧名，
     业务脚本 lifecycle-app.js、app.js 无需改动；
   - 令牌同时覆盖旧变量（--nav / --green / --mint …），旧组件自动跟随新配色。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 设计令牌
   -------------------------------------------------------------------------- */
:root {
  /* 品牌主色：烟草行业蓝 */
  --p-blue-900: #0a2a5e;
  --p-blue-800: #0d3a7a;
  --p-blue-700: #114c9e;
  --p-blue-600: #1663c2;
  --p-blue-500: #2a80d6;
  --p-blue-400: #4f9ee6;
  --p-blue-300: #8dc0ef;
  --p-blue-200: #c3ddf6;
  --p-blue-100: #e6f1fc;
  --p-blue-50:  #f4f9ff;

  /* 数据高亮：青蓝 */
  --p-cyan-600: #0a9cb8;
  --p-cyan-500: #12b3d0;
  --p-cyan-100: #ddf6fb;

  /* 顶部横幅渐变 */
  --p-banner-from: #0b72d1;
  --p-banner-via:  #168fe4;
  --p-banner-to:   #19c4e8;

  /* 侧栏 */
  --p-nav-bg:       #0c3668;
  --p-nav-bg-deep:  #092a52;
  --p-nav-hover:    #15498c;
  --p-nav-active:   #1a5cb0;
  --p-nav-text:     #d3e3f6;
  --p-nav-muted:    #9fbfe2;

  /* 语义色 */
  --p-green:  #12a150;
  --p-orange: #d98218;
  --p-red:    #d1443a;
  --p-gold:   #e6b422;

  /* 中性色 */
  --p-ink:    #152534;
  --p-muted:  #6a7d8f;
  --p-line:   #e0e8f1;
  --p-line-2: #eef3f9;
  --p-canvas: #eef3f9;
  --p-paper:  #ffffff;

  --p-radius:    6px;
  --p-radius-lg: 10px;
  --p-shadow:    0 1px 2px rgba(13, 47, 87, .06), 0 1px 3px rgba(13, 47, 87, .07);
  --p-shadow-md: 0 6px 18px rgba(13, 47, 87, .10);
  --p-shadow-lg: 0 16px 40px rgba(13, 47, 87, .18);

  --p-banner-h: 48px;
  --p-crumb-h:  30px;
  --p-side-w:   223px;

  /* 覆盖旧变量，让既有组件自动跟随新配色 */
  --nav: var(--p-nav-bg);
  --nav2: var(--p-nav-bg-deep);
  --green: var(--p-blue-700);
  --green-dark: var(--p-blue-800);
  --mint: var(--p-blue-100);
  --canvas: var(--p-canvas);
  --paper: var(--p-paper);
  --line: var(--p-line);
  --ink: var(--p-ink);
  --muted: var(--p-muted);
  --shadow: var(--p-shadow-md);
  --orange: var(--p-orange);
  --red: var(--p-red);
  --blue: var(--p-blue-600);

  /* 覆盖 index.html（styles.css）自带的青绿令牌，统一到烟草蓝 */
  --bg: var(--p-canvas);
  --surface: var(--p-paper);
  --surface-soft: var(--p-blue-50);
  --nav-soft: var(--p-nav-hover);
  --line-strong: #c3d2e2;
  --text: var(--p-ink);
  --primary: var(--p-blue-700);
  --primary-dark: var(--p-blue-800);
  --primary-soft: var(--p-blue-100);
  --good: var(--p-green);
  --danger: var(--p-red);
  --warning: var(--p-orange);
}

/* --------------------------------------------------------------------------
   2. 全局基线
   -------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--p-canvas);
  color: var(--p-ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

/* 通用过渡：卡片、按钮、行、导航项在状态变化时更顺滑 */
.card, .panel, .metric, .quick-action,
.primary, .secondary, .quiet, .icon, .p-rail-btn, .p-banner-btn, .p-banner-user,
.data-table tbody tr, .stage-row, .profile-item, .approvals-hint, .empty-state {
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .16s ease, transform .16s ease;
}

h1, h2, h3, h4, h5 { margin-top: 0; font-weight: 700; color: var(--p-ink); letter-spacing: .2px; }
p { margin-top: 0; }
a { color: var(--p-blue-700); }

/* 细滚动条，贴近参考图观感 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #eef3f9; }
::-webkit-scrollbar-thumb { background: #c3d2e2; border: 2px solid #eef3f9; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a6bcd4; }

::selection { background: var(--p-blue-100); }

/* --------------------------------------------------------------------------
   3. 顶部横幅（品牌条）
   -------------------------------------------------------------------------- */
.p-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--p-banner-h);
  padding: 0 16px 0 0;
  color: #fff;
  background: linear-gradient(100deg, var(--p-banner-from) 0%, var(--p-banner-via) 54%, var(--p-banner-to) 100%);
  box-shadow: 0 2px 10px rgba(6, 45, 90, .30);
}

.p-banner-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 100%;
  padding: 0 20px 0 16px;
  background: rgba(255, 255, 255, .10);
  border-right: 1px solid rgba(255, 255, 255, .16);
  text-decoration: none;
  color: #fff;
  transition: background .16s;
}
.p-banner-brand:hover { background: rgba(255, 255, 255, .16); }

.p-banner-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(150deg, #ffffff, #dbe9fb);
  color: var(--p-blue-800);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .20);
}

.p-banner-wordmark { line-height: 1.15; }
.p-banner-wordmark b { display: block; font-size: 14px; letter-spacing: 1.5px; }
.p-banner-wordmark span { display: block; font-size: 9px; letter-spacing: 1.8px; opacity: .78; text-transform: uppercase; }

.p-banner-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .16);
}

.p-banner-spacer { flex: 1 1 auto; }

.p-banner-tools { display: flex; align-items: center; gap: 6px; }

.p-banner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--p-radius);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.p-banner-btn:hover { background: rgba(255, 255, 255, .22); }
.p-banner-btn svg { width: 17px; height: 17px; }

.p-banner-user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--p-radius);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.p-banner-user:hover { background: rgba(255, 255, 255, .26); }
.p-banner-user .p-avatar {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  color: var(--p-blue-800);
  font-size: 11px;
  font-weight: 800;
}
.p-banner-user svg { width: 13px; height: 13px; opacity: .85; }
/* The inventory page reuses its existing user-chip inside the portal button. */
.p-banner-user .user-chip { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: inherit; font-weight: 600; }

.p-banner-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  width: 210px;
  padding: 0 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .18);
  transition: background .15s, box-shadow .15s;
}
.p-banner-search:focus-within { background: rgba(255, 255, 255, .28); box-shadow: 0 0 0 2px rgba(255, 255, 255, .22); }
.p-banner-search svg { width: 15px; height: 15px; opacity: .9; flex: 0 0 auto; }
.p-banner-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 12.5px;
  outline: none;
}
.p-banner-search input::placeholder { color: rgba(255, 255, 255, .74); }

/* --------------------------------------------------------------------------
   4. 面包屑 / 页签条
   -------------------------------------------------------------------------- */
.p-crumbbar {
  position: sticky;
  top: var(--p-banner-h);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--p-crumb-h);
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--p-line);
  box-shadow: 0 1px 0 rgba(13, 47, 87, .03);
}

.p-crumb-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 12px;
  border: 1px solid var(--p-blue-200);
  border-radius: var(--p-radius);
  background: var(--p-blue-50);
  color: var(--p-blue-800);
  font-size: 12px;
  font-weight: 700;
}
.p-crumb-tab svg { width: 13px; height: 13px; }

.p-crumb-trail { display: flex; align-items: center; gap: 6px; color: var(--p-muted); font-size: 12px; }
.p-crumb-trail b { color: var(--p-ink); font-weight: 700; }
.p-crumb-trail svg { width: 12px; height: 12px; opacity: .55; }

.p-crumb-spacer { flex: 1 1 auto; }

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-muted);
  font-size: 12px;
}
.sync-state svg { width: 14px; height: 14px; color: var(--p-green); }
.sync-time { color: var(--p-muted); font-size: 11.5px; }

/* 锚点/滚动定位时避开吸顶的横幅与面包屑 */
#scanDetail, .profile-detail-card, .ledger-block, .view-header {
  scroll-margin-top: calc(var(--p-banner-h) + var(--p-crumb-h) + 12px);
}

/* --------------------------------------------------------------------------
   5. 左侧分组导航
   -------------------------------------------------------------------------- */

/* index.html 的旧外壳是两列网格；新结构把横幅、面包屑、p-shell 一并放进
   .app-shell，因此这里让它退回普通纵向容器，由 .p-shell 负责分栏。 */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  grid-template-columns: none;
}
.app-shell > .main { min-width: 0; }

.p-shell {
  display: grid;
  grid-template-columns: var(--p-side-w) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--p-banner-h) - var(--p-crumb-h));
}

.p-side {
  position: sticky;
  top: calc(var(--p-banner-h) + var(--p-crumb-h));
  height: calc(100vh - var(--p-banner-h) - var(--p-crumb-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 16px;
  background: linear-gradient(180deg, var(--p-nav-bg) 0%, var(--p-nav-bg-deep) 100%);
  border-right: 1px solid var(--p-nav-bg-deep);
}
.p-side::-webkit-scrollbar { width: 6px; }
.p-side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border: 0; }

.p-nav-group { border-bottom: 1px solid rgba(255, 255, 255, .07); }
.p-nav-group:last-child { border-bottom: 0; }

.p-nav-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .4px;
  text-align: left;
  cursor: pointer;
}
.p-nav-head:hover { background: rgba(255, 255, 255, .08); }
.p-nav-head > svg:first-child { width: 16px; height: 16px; flex: 0 0 auto; color: var(--p-blue-300); }
.p-nav-head .p-nav-caret { width: 13px; height: 13px; margin-left: auto; opacity: .7; transition: transform .18s; }
.p-nav-group.collapsed .p-nav-caret { transform: rotate(-90deg); }

.p-nav-list {
  display: grid;
  gap: 2px;
  padding: 2px 8px 9px;
}
.p-nav-group.collapsed .p-nav-list { display: none; }

/* 一、二级菜单项与旧 .nav-item 共用，保证 JS 点击绑定不变 */
.p-nav-list .nav-item,
.p-side .nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--p-radius);
  background: transparent;
  color: var(--p-nav-text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.p-side .nav-item:hover { background: var(--p-nav-hover); color: #fff; }
.p-side .nav-item.active {
  position: relative;
  background: linear-gradient(90deg, var(--p-nav-active), rgba(26, 92, 176, .72));
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10);
}
.p-side .nav-item.active::before {
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--p-gold);
  transform: translateY(-50%);
  content: "";
}
.p-side .nav-item svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .92; }
.p-side .nav-item span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-side .main-workbench-link,
.p-app-panel .main-workbench-link { text-decoration: none; }
.p-side .main-workbench-link { color: var(--p-nav-text); }
.p-side .main-workbench-link:hover { color: #fff; }
.p-app-panel .main-workbench-link { display: block; color: var(--p-ink); }
.p-side .nav-item b {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--p-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex: 0 0 auto;
}
.p-side .nav-item b:empty { display: none; }

/* 侧栏底部说明 */
.p-side-note {
  margin: 12px 12px 0;
  padding: 12px 13px;
  border-radius: var(--p-radius);
  background: rgba(255, 255, 255, .06);
  color: var(--p-nav-muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.p-side-note strong { display: block; margin-bottom: 3px; color: #fff; font-size: 12px; }

/* 兼容旧侧栏类名：index.html 使用 .side-nav */
.side-nav {
  position: sticky;
  top: calc(var(--p-banner-h) + var(--p-crumb-h));
  height: calc(100vh - var(--p-banner-h) - var(--p-crumb-h));
  overflow-y: auto;
  background: linear-gradient(180deg, var(--p-nav-bg) 0%, var(--p-nav-bg-deep) 100%);
}
.side-nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.side-nav .brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--p-radius);
  background: #fff;
  color: var(--p-blue-800);
  font-size: 16px;
  font-weight: 800;
}
.side-nav .brand h1 { margin: 0; color: #fff; font-size: 14px; }
.side-nav .brand p { margin: 1px 0 0; color: var(--p-nav-muted); font-size: 11px; }
.side-nav nav { display: grid; gap: 1px; padding: 6px 0; }

/* --------------------------------------------------------------------------
   6. 主内容区
   -------------------------------------------------------------------------- */
.p-main { min-width: 0; }

/* index.html 的 .main 自带内边距（styles.css: 18px），其视图区无额外留白，
   这里统一到门户留白，保证两个入口内容区观感一致。 */
.p-shell > .main { padding: 16px 18px 44px; }

.p-content,
.content {
  max-width: none;
  padding: 16px 18px 44px;
}

/* 页面标题区 */
.view-header { margin-bottom: 16px; }
.view-header h3 { font-size: 18px; }
.view-header p { color: var(--p-muted); font-size: 12.5px; }

/* 页面标题行（index.html 的 .topbar 与 lifecycle 的 .view-header 统一观感） */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.topbar h2 { font-size: 20px; }
.eyebrow { color: var(--p-muted); font-size: 11.5px; letter-spacing: .5px; }
.top-actions { flex-wrap: wrap; gap: 8px; }

/* --------------------------------------------------------------------------
   7. 卡片 / 面板
   -------------------------------------------------------------------------- */
.card,
.panel {
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--p-line);
  background: linear-gradient(180deg, #fbfdff, var(--p-blue-50));
  border-radius: var(--p-radius-lg) var(--p-radius-lg) 0 0;
}
.card-head h4 { margin: 0; font-size: 13.5px; }
.card-head h4::before {
  display: inline-block;
  width: 3px;
  height: 14px;
  margin-right: 8px;
  border-radius: 2px;
  background: linear-gradient(var(--p-blue-500), var(--p-cyan-500));
  vertical-align: -2px;
  content: "";
}
.card-body { padding: 16px; }

.grid-2 { gap: 16px; }
.section-grid { gap: 14px; }

/* --------------------------------------------------------------------------
   8. 指标卡
   -------------------------------------------------------------------------- */
.metric {
  position: relative;
  padding: 15px 16px;
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow);
  overflow: hidden;
  transition: box-shadow .16s, transform .16s;
}
.metric:hover { box-shadow: var(--p-shadow-md); transform: translateY(-1px); }
.metric::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(var(--p-blue-500), var(--p-cyan-500));
  content: "";
}
.metric span { color: var(--p-muted); font-size: 12px; }
.metric strong { margin: 7px 0 2px; font-size: 25px; line-height: 1.12; font-weight: 700; color: var(--p-blue-900); }
.metric small { color: var(--p-muted); font-size: 11.5px; }
.metric.is-good::after { background: linear-gradient(var(--p-green), #34c476); }
.metric.is-warn::after { background: linear-gradient(var(--p-orange), #f0a94a); }
.metric.is-bad::after  { background: linear-gradient(var(--p-red), #e76f65); }
.metric .metric-empty { color: var(--p-muted); font-size: 12px; font-weight: 400; }

.metric-grid { gap: 14px; margin-bottom: 16px; }

/* 参考图式的“数字翻牌”强调指标 */
.p-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.p-figure-label { color: var(--p-ink); font-size: 13.5px; font-weight: 700; }
.p-figure-value { display: flex; gap: 3px; }
.p-figure-value i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 34px;
  border: 1px solid var(--p-blue-200);
  border-radius: 3px;
  background: linear-gradient(#fff, var(--p-blue-50));
  color: var(--p-blue-800);
  font-family: Consolas, "Courier New", monospace;
  font-size: 21px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}
.p-figure-delta { font-size: 12px; color: var(--p-muted); }
.p-figure-delta b { font-weight: 700; }
.p-figure-delta .up   { color: var(--p-green); }
.p-figure-delta .down { color: var(--p-red); }

/* --------------------------------------------------------------------------
   8b. 驾驶舱图表（柱状 / 环形）
   -------------------------------------------------------------------------- */
.dashboard-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card .card-head { justify-content: space-between; }
.chart-hint { color: var(--p-muted); font-size: 11.5px; font-weight: 400; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 196px;
  padding: 6px 6px 0;
}
.bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 100%;
  min-width: 0;
}
.bar-value { font-size: 13px; font-weight: 700; color: var(--p-blue-800); font-variant-numeric: tabular-nums; }
.bar-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 56px;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--p-blue-50);
  border: 1px solid var(--p-line-2);
  border-radius: 8px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  width: 100%;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, var(--p-blue-400), var(--p-cyan-500));
  transition: height .45s ease;
}
.bar-label { font-size: 12px; color: var(--p-muted); white-space: nowrap; }

/* 五阶段推进：文字 + 进度条 */
.stage-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-row > div > strong { font-size: 13.5px; }
.stage-row > div > span { color: var(--p-muted); font-size: 11.5px; }
.stage-bar {
  display: block;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--p-blue-500), var(--p-cyan-500));
}

.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 196px;
}
.donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--p-blue-600) calc(var(--pct, 0) * 1%), #e3ecf7 0);
}
.donut::before {
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--p-line);
  content: "";
}
.donut-center { position: relative; text-align: center; line-height: 1.2; }
.donut-center strong { display: block; font-size: 27px; color: var(--p-blue-900); }
.donut-center span { font-size: 12px; color: var(--p-muted); }
.donut-legend { text-align: center; }
.donut-legend p { margin: 0; color: var(--p-muted); font-size: 12px; }
.donut-legend p:first-child { margin-bottom: 3px; font-size: 13px; color: var(--p-ink); }
.donut-legend b { font-size: 19px; color: var(--p-blue-700); }

@media (max-width: 720px) {
  .dashboard-charts { grid-template-columns: minmax(0, 1fr); }
}

/* 保留参考门户顶栏中的搜索入口；当前页没有联动筛选时只显示图标。 */
.p-banner-search {
  display: flex !important;
  flex: 0 0 30px;
  width: 30px !important;
  height: 30px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border-radius: 2px;
}
.p-banner-search input { display: none !important; }
.p-banner-search:hover { background: rgba(255,255,255,.22); }

/* 原有连接状态与退出入口继续保留，紧凑放在页签栏右侧。 */
#logoutBtn { display: inline-flex !important; flex: 0 0 auto; }
.quality-reasons ul { margin: 6px 0 0; padding-left: 16px; color: #617084; font-size: 11px; line-height: 1.45; max-width: 270px; }
.quality-reasons li { margin: 2px 0; }
.scan-quality-panel td small { display: block; color: #8290a2; font-size: 10px; line-height: 1.35; white-space: nowrap; }
.scan-quality-panel td.number small { font-weight: 400; }
.quality-missing { color: #9aa7b7; }
@media (min-width: 721px) {
  #syncState { display: flex !important; align-items: center; gap: 5px; flex: 0 0 auto; color: #2ca56a; font-size: 11px; white-space: nowrap; }
}

/* 搜索入口点击后展开输入框，视图切换后仍可继续筛选。 */
.p-banner-search.is-expanded {
  flex-basis: 210px;
  width: 210px !important;
  padding: 0 10px;
  justify-content: flex-start;
  background: rgba(255,255,255,.18);
}
.p-banner-search.is-expanded input { display: block !important; min-width: 0; }
@media (max-width: 720px) {
  .p-banner-search.is-expanded { flex-basis: 155px; width: 155px !important; }
}

/* 平板宽度也使用抽屉导航，页面本身不再被 1080px 最小宽度撑出视口。 */
@media (max-width: 1180px) {
  body { min-width: 0; overflow-x: auto; }
  .p-shell, .p-main, .main, .p-content, .content { min-width: 0; max-width: 100%; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
}

/* 宽屏驾驶舱收口：保证 1280px 以上首屏同时展示图表和推进列表。 */
@media (min-width: 1280px) {
  .lifecycle-portal .p-content { padding: 12px 38px 28px 16px; }
  .lifecycle-portal .overview-banner { min-height: 96px; margin-bottom: 8px; padding: 14px 24px 12px; }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { top: 43px; }
  .lifecycle-portal .overview-banner h3 { margin-bottom: 2px; font-size: 20px; }
  .lifecycle-portal .overview-banner p:last-child { font-size: 12px; }
  .lifecycle-portal .banner-target { top: 15px; right: 20px; }
  .lifecycle-portal .banner-target strong { font-size: 24px; }
  .lifecycle-portal .metric-grid { margin-bottom: 10px; }
  .lifecycle-portal .metric { min-height: 86px; padding: 10px 9px 8px; }
  .lifecycle-portal .metric strong { min-height: 36px; margin: 5px auto 1px; font-size: 22px; }
  .lifecycle-portal .metric-slot { flex-basis: 32px; width: 32px; height: 36px; font-size: 22px; }
  .lifecycle-portal .metric-slot-symbol { min-width: 22px; padding: 0 2px; font-size: 18px; }
  .lifecycle-portal .metric span { font-size: 11.5px; }
  .lifecycle-portal .metric small { font-size: 10.5px; }
  .lifecycle-portal .dashboard-charts { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .95fr); gap: 10px; margin-bottom: 10px; }
  .lifecycle-portal .chart-card .card-head { min-height: 34px; padding: 7px 11px; }
  .lifecycle-portal .chart-card .card-head h4 { font-size: 13px; }
  .lifecycle-portal .chart-card .card-body { padding: 10px 12px; }
  .lifecycle-portal .bar-chart { height: 160px; gap: 12px; padding: 4px 4px 0; }
  .lifecycle-portal .bar-track { max-width: 48px; border-radius: 6px; }
  .lifecycle-portal .bar-label { font-size: 11px; }
  .lifecycle-portal .donut-wrap { height: 160px; gap: 8px; }
  .lifecycle-portal .donut { width: 118px; height: 118px; }
  .lifecycle-portal .donut::before { inset: 14px; }
  .lifecycle-portal .donut-center strong { font-size: 24px; }
  .lifecycle-portal .donut-legend p { font-size: 11px; }
  .lifecycle-portal .donut-legend b { font-size: 17px; }
  .lifecycle-portal .grid-2 { gap: 10px; }
  .lifecycle-portal .grid-2 .card-head { padding: 8px 12px; }
  .lifecycle-portal .grid-2 .card-body { padding: 10px 12px; }
  .lifecycle-portal .grid-2 > .card:last-child { display: flex; flex-direction: column; }
  .lifecycle-portal .grid-2 > .card:last-child .card-body { display: flex; flex: 1 1 auto; }
  .lifecycle-portal .stage-row { padding: 8px 0; }
  .lifecycle-portal .stage-index { width: 24px; height: 24px; font-size: 11px; }
  .lifecycle-portal .stage-row > div > strong { font-size: 13px; }
  .lifecycle-portal .stage-row > div > span { font-size: 11px; }
  .lifecycle-portal .stage-bar { height: 4px; margin-top: 3px; }
  .lifecycle-portal .quick-list { flex: 1 1 auto; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lifecycle-portal .quick-action { min-height: 0; padding: 0 10px; }
  .lifecycle-portal .quick-action span { font-size: 12.5px; }
}

.scan-quality-panel { margin-top: 16px; }
.scan-quality-panel:first-child { margin-top: 0; margin-bottom: 18px; }
.quality-process { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 9px; padding: 12px 0; border-top: 1px solid #edf1f5; color: #49647b; font-size: 12px; }
.quality-process span { padding: 5px 9px; border-radius: 4px; background: #f1f6fc; }
.quality-process b { font-weight: 400; color: #96a7b7; }
.quality-quota { padding: 10px 12px; margin: 0 0 12px; color: #766335; background: #fff9e9; border-left: 3px solid #d8b465; line-height: 1.65; font-size: 12px; }
.quality-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; }
.quality-controls label { display: grid; gap: 5px; min-width: 116px; color: #677b8e; font-size: 12px; }
.quality-controls select { min-height: 34px; padding: 5px 26px 5px 9px; border: 1px solid #dce4ed; border-radius: 5px; background: #fff; color: #334b61; }
.quality-scope-note { margin: 10px 0; font-size: 12px; color: #7b8997; }
.quality-load-status { margin: 0; padding: 0; color: #98712d; font-size: 12px; }
.quality-load-status:not(:empty) { margin: 10px 0; }
.scan-quality-table { width: 100%; }
.scan-quality-table .quality-reasons { min-width: 240px; max-width: 380px; white-space: normal; }
.quality-reasons ul { padding-left: 16px; margin: 6px 0 0; color: #738191; font-size: 11px; line-height: 1.55; }
.quality-missing { color: #8997a5; font-size: 12px; }
.risk-badge.missing { color: #6d7c8d; background: #edf1f5; }
.quality-policy { margin-top: 12px; padding: 11px 0 0; border-top: 1px solid #edf1f5; color: #6b7b8b; font-size: 12px; line-height: 1.7; }
.quality-policy summary { color: #35658a; cursor: pointer; }
.quality-policy div { margin-top: 10px; }
.scan-quality-panel .icon-button:disabled { cursor: not-allowed; opacity: .55; }
@media (max-width: 760px) { .quality-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .quality-controls label { min-width: 0; } .quality-controls select { max-width: 100%; } .quality-process { gap: 5px; } }

/* 运行质量驾驶舱：把质量预审放在每日工作的第一屏。 */
.quality-hero {
  display: flex; justify-content: space-between; gap: 26px; align-items: stretch; margin: 0 0 14px; padding: 26px 30px;
  border: 1px solid #dbe8f3; border-radius: 14px; background: linear-gradient(120deg, #103f74 0%, #17659b 57%, #1b7894 100%); color: #fff; overflow: hidden; position: relative;
}
.quality-hero::after { content: ""; position: absolute; width: 260px; height: 260px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; right: 11%; top: -150px; box-shadow: 0 0 0 24px rgba(255,255,255,.04), 0 0 0 48px rgba(255,255,255,.035); pointer-events: none; }
.quality-hero-copy, .quality-hero-actions { position: relative; z-index: 1; }
.quality-kicker { display: inline-flex; align-items: center; gap: 7px; color: #bfe7f2; font-size: 10px; letter-spacing: .16em; font-weight: 700; }
.quality-kicker svg { width: 14px; height: 14px; }
.quality-hero h1 { margin: 9px 0 5px; font-size: 30px; letter-spacing: -.02em; }
.quality-hero p { max-width: 680px; margin: 0; color: #d9edf5; line-height: 1.7; font-size: 13px; }
.quality-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: #afd2e3; font-size: 11px; }
.quality-hero-actions { display: flex; flex-direction: column; justify-content: center; gap: 9px; min-width: 220px; }
.quality-import-button, .quality-outline-button { display: flex; align-items: center; gap: 8px; border-radius: 7px; padding: 10px 13px; cursor: pointer; text-align: left; }
.quality-import-button { border: 1px solid #8fe0d0; background: #e1fbf4; color: #0c5e65; }
.quality-import-button:disabled, .quality-outline-button:disabled { opacity: .55; cursor: not-allowed; filter: saturate(.65); }
.quality-import-button svg, .quality-outline-button svg { width: 17px; height: 17px; flex: 0 0 17px; }
.quality-import-button span { font-size: 13px; font-weight: 700; }
.quality-import-button small { display: block; margin-left: auto; color: #4f8184; font-size: 10px; }
.quality-outline-button { justify-content: center; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; }
.quality-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.quality-kpi { min-height: 105px; padding: 16px 18px 13px; border: 1px solid #e2eaf1; border-radius: 10px; background: #fff; box-shadow: 0 3px 12px rgba(21,57,91,.04); position: relative; overflow: hidden; }
.quality-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #4d7fa8; }
.quality-kpi-green::before { background: #2ba879; } .quality-kpi-red::before { background: #d95b5b; } .quality-kpi-blue::before { background: #3f8ed0; }
.quality-kpi span { display: block; color: #718397; font-size: 12px; }
.quality-kpi strong { display: block; margin: 10px 0 4px; color: #173b5c; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.quality-kpi small { color: #96a5b2; font-size: 10px; }
.quality-visual-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); gap: 12px; margin-bottom: 14px; }
.quality-stage-card, .quality-insight-card { border: 1px solid #e2eaf1; border-radius: 10px; background: #fff; padding: 16px 18px; box-shadow: 0 3px 12px rgba(21,57,91,.035); }
.quality-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quality-card-heading h3 { margin: 3px 0 0; color: #24445f; font-size: 15px; }
.quality-card-heading > span, .quality-card-heading > i { color: #8193a5; font-size: 11px; }
.quality-card-heading > i { width: 18px; height: 18px; color: #2d8e9d; }
.quality-card-eyebrow { color: #8297aa; font-size: 10px; letter-spacing: .08em; }
.quality-stage-flow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 19px 0 11px; }
.quality-stage-flow > div { min-width: 80px; text-align: center; }
.quality-stage-flow b { display: block; color: #1b5c88; font-size: 22px; line-height: 1.1; }
.quality-stage-flow span { display: block; margin-top: 4px; color: #718397; font-size: 11px; }
.quality-stage-flow i { color: #b3c5d2; font-size: 18px; font-style: normal; }
.quality-stage-help { margin: 0; padding-top: 10px; border-top: 1px solid #edf2f5; color: #81909e; font-size: 11px; line-height: 1.6; }
.quality-insight-card ul { margin: 15px 0 0; padding: 0; list-style: none; }
.quality-insight-card li { position: relative; margin: 8px 0; padding-left: 15px; color: #5e7183; font-size: 11px; line-height: 1.55; }
.quality-insight-card li::before { content: ""; position: absolute; top: .55em; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #e0a23b; }
.quality-insight-card li:first-child::before { background: #d85b5b; }
@media (max-width: 980px) { .quality-hero { padding: 22px; } .quality-hero-actions { min-width: 190px; } .quality-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .quality-hero { display: block; } .quality-hero-actions { margin-top: 18px; } .quality-hero h1 { font-size: 25px; } .quality-visual-grid { grid-template-columns: 1fr; } .quality-stage-flow { gap: 2px; } .quality-stage-flow > div { min-width: 0; flex: 1; } .quality-stage-flow i { font-size: 14px; } }
.quality-rule-note { margin: -4px 0 12px; color: #6b7280; font-size: 12px; }
.scan-quality-table-wrap { max-height: 360px; overflow: auto; }
.scan-quality-table th, .scan-quality-table td { white-space: nowrap; }
.scan-quality-table td small { display: block; margin-top: 3px; color: #7b8794; font-size: 11px; }
.scan-quality-subheading { margin-top: 14px; border-top: 1px solid #edf1f5; padding-top: 12px; }
.scan-quality-subheading h4 { margin: 0; font-size: 14px; }
.quality-status { display: inline-flex; align-items: center; max-width: 260px; white-space: normal; line-height: 1.45; border-radius: 999px; padding: 3px 8px; font-size: 11px; }
.quality-status.quality-ok { color: #176b45; background: #e7f7ee; }
.quality-status.quality-warn { color: #8b5a00; background: #fff4d6; }
@media (max-width: 720px) {
  .scan-quality-panel { margin-top: 10px; }
  .scan-quality-table-wrap { max-height: 300px; }
  .quality-rule-note { line-height: 1.6; }
}

.p-shell > .main,
.p-shell > .p-main { min-width: 0; max-width: 100%; overflow: hidden; }
.p-shell > .main { width: 100%; padding: 14px 18px 36px; }
.p-main > .p-content,
.p-shell > .main > .content { width: 100%; max-width: none; padding: 14px 18px 36px; }
.main > .filters,
.p-main .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: 9px; }
.main > .filters > label,
.p-main .filters > label { display: grid; min-width: 0; gap: 4px; }
.main > .filters .search-field,
.p-main .filters .search-field { grid-column: span 2; }
.main > .filters input,
.main > .filters select,
.p-main .filters input,
.p-main .filters select { width: 100%; min-width: 0; }
.table-wrap,
.server-results,
.server-table,
.ledger-block,
.profile-detail-card { min-width: 0; max-width: 100%; }
.table-wrap { overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table,
.table-wrap .data-table { width: max-content; min-width: 100%; }

@media (max-width: 1280px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding-left: 14px; padding-right: 14px; }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: span 1; }
}

@media (max-width: 760px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding: 10px; }
  .topbar,
  .view-header,
  .toolbar,
  .panel-heading { align-items: stretch; flex-direction: column; }
  .main > .filters,
  .p-main .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   21. 页面布局统一收口

   各业务视图共用同一套内容容器。旧版业务样式仍会定义 .main/.content、
   .filters 和 .table-wrap，因此这些规则必须放在文件末尾，避免不同导航页
   因加载顺序产生不同的宽度和换行结果。
   -------------------------------------------------------------------------- */
.p-shell > .main,
.p-shell > .p-main {
  min-width: 0;
  overflow: hidden;
}

.p-shell > .main,
.p-main > .p-content,
.p-shell > .main > .content {
  width: 100%;
  max-width: none;
  padding: 14px 18px 36px;
}

.topbar,
.view-header,
.toolbar,
.panel-heading,
.card-head {
  min-width: 0;
}

.topbar > *,
.view-header > *,
.toolbar > *,
.panel-heading > * {
  min-width: 0;
}

.top-actions,
.panel-actions,
.server-table-actions,
.ledger-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

/* index.html 的多条件筛选在宽屏按列排列，窄屏自动降为多行。 */
.main > .filters,
.p-main .filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 9px;
}
.main > .filters > label,
.p-main .filters > label {
  display: grid;
  min-width: 0;
  gap: 4px;
}
.main > .filters .search-field,
.p-main .filters .search-field {
  grid-column: span 2;
}
.main > .filters input,
.main > .filters select,
.p-main .filters input,
.p-main .filters select {
  width: 100%;
  min-width: 0;
}

/* 生命周期台账中的筛选控件也不能把页面整体撑宽。 */
.lifecycle-filter-row,
.lifecycle-filters {
  min-width: 0;
  max-width: 100%;
}
.lifecycle-filter-row label,
.lifecycle-filters label {
  min-width: 0;
}
.lifecycle-filter-row input,
.lifecycle-filter-row select,
.lifecycle-filters input,
.lifecycle-filters select {
  max-width: 100%;
}

.table-wrap,
.server-results,
.server-table,
.ledger-block,
.profile-detail-card {
  min-width: 0;
  max-width: 100%;
}
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap > table,
.table-wrap .data-table {
  width: max-content;
  min-width: 100%;
}

.server-table-actions,
.ledger-controls,
.lifecycle-filter-chips {
  padding: 8px 10px;
}

@media (max-width: 1280px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding-left: 14px; padding-right: 14px; }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: span 1; }
}

@media (max-width: 760px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding: 10px; }
  .topbar,
  .view-header,
  .toolbar,
  .panel-heading { align-items: stretch; flex-direction: column; }
  .top-actions,
  .panel-actions,
  .server-table-actions,
  .ledger-controls { width: 100%; }
  .main > .filters,
  .p-main .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: 1 / -1; }
}

/* Final override: keep the common content rules after every desktop density block. */
.p-shell > .main,
.p-shell > .p-main { min-width: 0; overflow: hidden; }
.p-shell > .main,
.p-main > .p-content,
.p-shell > .main > .content { width: 100%; max-width: none; padding: 14px 18px 36px; }
.main > .filters,
.p-main .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: 9px; }
.main > .filters > label,
.p-main .filters > label { display: grid; min-width: 0; gap: 4px; }
.main > .filters .search-field,
.p-main .filters .search-field { grid-column: span 2; }
.main > .filters input,
.main > .filters select,
.p-main .filters input,
.p-main .filters select { width: 100%; min-width: 0; }
.top-actions,
.panel-actions,
.server-table-actions,
.ledger-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; }
.table-wrap,
.server-results,
.server-table,
.ledger-block,
.profile-detail-card { min-width: 0; max-width: 100%; }
.table-wrap { overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table,
.table-wrap .data-table { width: max-content; min-width: 100%; }

@media (max-width: 1280px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding-left: 14px; padding-right: 14px; }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: span 1; }
}

@media (max-width: 760px) {
  .p-shell > .main,
  .p-main > .p-content,
  .p-shell > .main > .content { padding: 10px; }
  .topbar,
  .view-header,
  .toolbar,
  .panel-heading { align-items: stretch; flex-direction: column; }
  .main > .filters,
  .p-main .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main > .filters .search-field,
  .p-main .filters .search-field { grid-column: 1 / -1; }
}

/* 桌面驾驶舱收口：大屏优先保证首屏能同时看到指标、图表和推进列表。 */
@media (min-width: 1280px) {
  .lifecycle-portal .p-content { padding: 12px 14px 28px 16px; }

  .lifecycle-portal .overview-banner {
    min-height: 96px;
    margin-bottom: 8px;
    padding: 14px 24px 12px;
  }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { top: 43px; }
  .lifecycle-portal .overview-banner h3 { margin-bottom: 2px; font-size: 20px; }
  .lifecycle-portal .overview-banner p:last-child { font-size: 12px; }
  .lifecycle-portal .banner-target { top: 15px; right: 20px; }
  .lifecycle-portal .banner-target strong { font-size: 24px; }

  .lifecycle-portal .metric-grid { margin-bottom: 10px; }
  .lifecycle-portal .metric {
    min-height: 86px;
    padding: 10px 9px 8px;
  }
  .lifecycle-portal .metric strong {
    min-height: 36px;
    margin: 5px auto 1px;
    font-size: 22px;
  }
  .lifecycle-portal .metric-slot {
    flex-basis: 32px;
    width: 32px;
    height: 36px;
    font-size: 22px;
  }
  .lifecycle-portal .metric-slot-symbol {
    min-width: 22px;
    padding: 0 2px;
    font-size: 18px;
  }
  .lifecycle-portal .metric span { font-size: 11.5px; }
  .lifecycle-portal .metric small { font-size: 10.5px; }

  .lifecycle-portal .dashboard-charts {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .95fr);
    gap: 10px;
    margin-bottom: 10px;
  }
  .lifecycle-portal .chart-card .card-head { min-height: 34px; padding: 7px 11px; }
  .lifecycle-portal .chart-card .card-head h4 { font-size: 13px; }
  .lifecycle-portal .chart-card .card-body { padding: 10px 12px; }
  .lifecycle-portal .bar-chart { height: 160px; gap: 12px; padding: 4px 4px 0; }
  .lifecycle-portal .bar-track { max-width: 48px; border-radius: 6px; }
  .lifecycle-portal .bar-label { font-size: 11px; }
  .lifecycle-portal .donut-wrap { height: 160px; gap: 8px; }
  .lifecycle-portal .donut { width: 118px; height: 118px; }
  .lifecycle-portal .donut::before { inset: 14px; }
  .lifecycle-portal .donut-center strong { font-size: 24px; }
  .lifecycle-portal .donut-legend p { font-size: 11px; }
  .lifecycle-portal .donut-legend b { font-size: 17px; }

  .lifecycle-portal .grid-2 { gap: 10px; }
  .lifecycle-portal .grid-2 .card-head { padding: 8px 12px; }
  .lifecycle-portal .grid-2 .card-body { padding: 10px 12px; }
  .lifecycle-portal .grid-2 > .card:last-child { display: flex; flex-direction: column; }
  .lifecycle-portal .grid-2 > .card:last-child .card-body { display: flex; flex: 1 1 auto; }
  .lifecycle-portal .stage-row { padding: 8px 0; }
  .lifecycle-portal .stage-index { width: 24px; height: 24px; font-size: 11px; }
  .lifecycle-portal .stage-row > div > strong { font-size: 13px; }
  .lifecycle-portal .stage-row > div > span { font-size: 11px; }
  .lifecycle-portal .stage-bar { height: 4px; margin-top: 3px; }
  .lifecycle-portal .quick-list { flex: 1 1 auto; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lifecycle-portal .quick-action { min-height: 0; padding: 0 10px; }
  .lifecycle-portal .quick-action span { font-size: 12.5px; }
}

/* 宽屏驾驶舱收口：保证 1280px 以上首屏同时展示图表和推进列表。 */
@media (min-width: 1280px) {
  .lifecycle-portal .p-content { padding: 12px 14px 28px 16px; }
  .lifecycle-portal .overview-banner {
    min-height: 96px;
    margin-bottom: 8px;
    padding: 14px 24px 12px;
  }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { top: 43px; }
  .lifecycle-portal .overview-banner h3 { margin-bottom: 2px; font-size: 20px; }
  .lifecycle-portal .overview-banner p:last-child { font-size: 12px; }
  .lifecycle-portal .banner-target { top: 15px; right: 20px; }
  .lifecycle-portal .banner-target strong { font-size: 24px; }

  .lifecycle-portal .metric-grid { margin-bottom: 10px; }
  .lifecycle-portal .metric { min-height: 86px; padding: 10px 9px 8px; }
  .lifecycle-portal .metric strong { min-height: 36px; margin: 5px auto 1px; font-size: 22px; }
  .lifecycle-portal .metric-slot { flex-basis: 32px; width: 32px; height: 36px; font-size: 22px; }
  .lifecycle-portal .metric-slot-symbol { min-width: 22px; padding: 0 2px; font-size: 18px; }
  .lifecycle-portal .metric span { font-size: 11.5px; }
  .lifecycle-portal .metric small { font-size: 10.5px; }

  .lifecycle-portal .dashboard-charts { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .95fr); gap: 10px; margin-bottom: 10px; }
  .lifecycle-portal .chart-card .card-head { min-height: 34px; padding: 7px 11px; }
  .lifecycle-portal .chart-card .card-head h4 { font-size: 13px; }
  .lifecycle-portal .chart-card .card-body { padding: 10px 12px; }
  .lifecycle-portal .bar-chart { height: 160px; gap: 12px; padding: 4px 4px 0; }
  .lifecycle-portal .bar-track { max-width: 48px; border-radius: 6px; }
  .lifecycle-portal .bar-label { font-size: 11px; }
  .lifecycle-portal .donut-wrap { height: 160px; gap: 8px; }
  .lifecycle-portal .donut { width: 118px; height: 118px; }
  .lifecycle-portal .donut::before { inset: 14px; }
  .lifecycle-portal .donut-center strong { font-size: 24px; }
  .lifecycle-portal .donut-legend p { font-size: 11px; }
  .lifecycle-portal .donut-legend b { font-size: 17px; }

  .lifecycle-portal .grid-2 { gap: 10px; }
  .lifecycle-portal .grid-2 .card-head { padding: 8px 12px; }
  .lifecycle-portal .grid-2 .card-body { padding: 10px 12px; }
  .lifecycle-portal .grid-2 > .card:last-child { display: flex; flex-direction: column; }
  .lifecycle-portal .grid-2 > .card:last-child .card-body { display: flex; flex: 1 1 auto; }
  .lifecycle-portal .stage-row { padding: 8px 0; }
  .lifecycle-portal .stage-index { width: 24px; height: 24px; font-size: 11px; }
  .lifecycle-portal .stage-row > div > strong { font-size: 13px; }
  .lifecycle-portal .stage-row > div > span { font-size: 11px; }
  .lifecycle-portal .stage-bar { height: 4px; margin-top: 3px; }
  .lifecycle-portal .quick-list { flex: 1 1 auto; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lifecycle-portal .quick-action { min-height: 0; padding: 0 10px; }
  .lifecycle-portal .quick-action span { font-size: 12.5px; }
}

/* 桌面驾驶舱收口：大屏优先保证首屏能同时看到指标、图表和推进列表。 */
@media (min-width: 1280px) {
  .lifecycle-portal .p-content { padding: 12px 14px 28px 16px; }

  .lifecycle-portal .overview-banner {
    min-height: 96px;
    margin-bottom: 8px;
    padding: 14px 24px 12px;
  }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { top: 43px; }
  .lifecycle-portal .overview-banner h3 { margin-bottom: 2px; font-size: 20px; }
  .lifecycle-portal .overview-banner p:last-child { font-size: 12px; }
  .lifecycle-portal .banner-target { top: 15px; right: 20px; }
  .lifecycle-portal .banner-target strong { font-size: 24px; }

  .lifecycle-portal .metric-grid { margin-bottom: 10px; }
  .lifecycle-portal .metric {
    min-height: 86px;
    padding: 10px 9px 8px;
  }
  .lifecycle-portal .metric strong {
    min-height: 36px;
    margin: 5px auto 1px;
    font-size: 22px;
  }
  .lifecycle-portal .metric-slot {
    flex-basis: 32px;
    width: 32px;
    height: 36px;
    font-size: 22px;
  }
  .lifecycle-portal .metric-slot-symbol {
    min-width: 22px;
    padding: 0 2px;
    font-size: 18px;
  }
  .lifecycle-portal .metric span { font-size: 11.5px; }
  .lifecycle-portal .metric small { font-size: 10.5px; }

  .lifecycle-portal .dashboard-charts {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .95fr);
    gap: 10px;
    margin-bottom: 10px;
  }
  .lifecycle-portal .chart-card .card-head { min-height: 34px; padding: 7px 11px; }
  .lifecycle-portal .chart-card .card-head h4 { font-size: 13px; }
  .lifecycle-portal .chart-card .card-body { padding: 10px 12px; }
  .lifecycle-portal .bar-chart { height: 160px; gap: 12px; padding: 4px 4px 0; }
  .lifecycle-portal .bar-track { max-width: 48px; border-radius: 6px; }
  .lifecycle-portal .bar-label { font-size: 11px; }
  .lifecycle-portal .donut-wrap { height: 160px; gap: 8px; }
  .lifecycle-portal .donut { width: 118px; height: 118px; }
  .lifecycle-portal .donut::before { inset: 14px; }
  .lifecycle-portal .donut-center strong { font-size: 24px; }
  .lifecycle-portal .donut-legend p { font-size: 11px; }
  .lifecycle-portal .donut-legend b { font-size: 17px; }

  .lifecycle-portal .grid-2 { gap: 10px; }
  .lifecycle-portal .grid-2 .card-head { padding: 8px 12px; }
  .lifecycle-portal .grid-2 .card-body { padding: 10px 12px; }
  .lifecycle-portal .grid-2 > .card:last-child { display: flex; flex-direction: column; }
  .lifecycle-portal .grid-2 > .card:last-child .card-body { display: flex; flex: 1 1 auto; }
  .lifecycle-portal .stage-row { padding: 8px 0; }
  .lifecycle-portal .stage-index { width: 24px; height: 24px; font-size: 11px; }
  .lifecycle-portal .stage-row > div > strong { font-size: 13px; }
  .lifecycle-portal .stage-row > div > span { font-size: 11px; }
  .lifecycle-portal .stage-bar { height: 4px; margin-top: 3px; }
  .lifecycle-portal .quick-list { flex: 1 1 auto; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lifecycle-portal .quick-action { min-height: 0; padding: 0 10px; }
  .lifecycle-portal .quick-action span { font-size: 12.5px; }
}

@media (max-width: 420px) {
  .p-banner-tools { gap: 0; }
  .p-banner-btn { min-width: 30px; padding-left: 5px; padding-right: 5px; }
  .p-banner-user { gap: 3px; padding-left: 5px; padding-right: 5px; }
  .p-banner-search.is-expanded { flex-basis: 120px; width: 120px !important; }
}

@media (max-width: 420px) {
  .p-banner-tools { gap: 0; }
  .p-banner-btn { min-width: 30px; padding-left: 5px; padding-right: 5px; }
  .p-banner-user { gap: 3px; padding-left: 5px; padding-right: 5px; }
  .p-banner-search.is-expanded { flex-basis: 120px; width: 120px !important; }
}

@media (max-width: 420px) {
  .p-banner-tools { gap: 0; }
  .p-banner-btn { min-width: 30px; padding-left: 5px; padding-right: 5px; }
  .p-banner-user { gap: 3px; padding-left: 5px; padding-right: 5px; }
  .p-banner-search.is-expanded { flex-basis: 120px; width: 120px !important; }
}

/* 平板宽度也使用抽屉导航，页面本身不再被 1080px 最小宽度撑出视口。 */
@media (max-width: 1180px) {
  body { min-width: 0; overflow-x: auto; }
  .p-shell, .p-main, .main, .p-content, .content { min-width: 0; max-width: 100%; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
}

/* --------------------------------------------------------------------------
   9. 筛选栏
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  padding: 13px 16px;
  margin-bottom: 16px;
  background: var(--p-paper);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow);
}
.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--p-ink);
}
.filters label > span { color: var(--p-muted); white-space: nowrap; }
.filters label[hidden] { display: none !important; }
.filters input,
.filters select,
.filters .search-field input {
  height: 32px;
  min-width: 132px;
  padding: 0 9px;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  background: #fff;
  color: var(--p-ink);
  font-size: 12.5px;
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.filters input:focus,
.filters select:focus { border-color: var(--p-blue-500); box-shadow: 0 0 0 3px var(--p-blue-100); }

/* --------------------------------------------------------------------------
   10. 表格
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12.5px;
}
.data-table thead th,
.data-table th {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 10px 12px;
  background: linear-gradient(var(--p-blue-600), var(--p-blue-700));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, .16);
}
.data-table thead th:last-child { border-right: 0; }

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--p-line-2);
  color: var(--p-ink);
  text-align: left;
  vertical-align: middle;
}
.data-table tbody tr { background: var(--p-paper); }
.data-table tbody tr:nth-child(even) { background: #fafcfe; }
.data-table tbody tr:hover { background: var(--p-blue-50); }
.data-table tbody tr.selected { background: var(--p-blue-100); }

/* 横向滚动时冻结首列（选择列 + 首个数据列），宽表操作不迷失 */
.table-wrap .data-table th:nth-child(1),
.table-wrap .data-table td:nth-child(1) { position: sticky; left: 0; z-index: 4; }
.table-wrap .data-table.has-select th:nth-child(1),
.table-wrap .data-table.has-select td:nth-child(1) {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
}
.table-wrap .data-table.has-select th:nth-child(2),
.table-wrap .data-table.has-select td:nth-child(2) { position: sticky; left: 44px; z-index: 3; }
/* 冻结单元格背景随整行，避免滚动内容透出 */
.data-table tbody td:nth-child(1),
.data-table.has-select tbody td:nth-child(2) { background: inherit; }
.data-table thead th:nth-child(1),
.data-table.has-select thead th:nth-child(2) { z-index: 7; background: linear-gradient(var(--p-blue-600), var(--p-blue-700)); }

.data-table a,
.data-table .link { color: var(--p-blue-700); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* 数字列右对齐、等宽，便于纵向比对 */
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-family: Consolas, "Courier New", monospace;
}

/* --------------------------------------------------------------------------
   10b. 台账表头工具栏 · 列筛选
   -------------------------------------------------------------------------- */
.col-chooser { position: relative; }
.col-chooser > summary { list-style: none; cursor: pointer; user-select: none; }
.col-chooser > summary::-webkit-details-marker { display: none; }
.col-chooser[open] > summary {
  border-color: var(--p-blue-500);
  color: var(--p-blue-700);
  background: var(--p-blue-50);
}
.col-chooser-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 7px;
  min-width: 184px;
  max-height: 280px;
  overflow: auto;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: var(--p-shadow-md);
}
.col-chooser-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--p-ink);
  white-space: nowrap;
  cursor: pointer;
}
.col-chooser-item input { accent-color: var(--p-blue-600); }

/* 表格密度控件 */
.density-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  background: #fff;
  color: var(--p-muted);
}
.density-control svg { width: 15px; height: 15px; flex: 0 0 auto; }
.density-control select {
  border: 0;
  background: transparent;
  color: var(--p-ink);
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}
.density-control:focus-within { border-color: var(--p-blue-500); box-shadow: 0 0 0 3px var(--p-blue-100); }

/* 台账密度：紧凑 / 标准 / 宽松，作用于内容区全部台账 */
.density-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  background: #fff;
  color: var(--p-muted);
}
.density-control svg { width: 15px; height: 15px; }
.density-control select {
  border: 0;
  background: transparent;
  color: var(--p-ink);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
}
#appContent[data-density="compact"] .data-table th,
#appContent[data-density="compact"] .data-table td { padding: 5px 10px; }
#appContent[data-density="compact"] .data-table { font-size: 12px; }
#appContent[data-density="loose"] .data-table th,
#appContent[data-density="loose"] .data-table td { padding: 14px 14px; }

/* --------------------------------------------------------------------------
   11. 状态徽标
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}
/* 说明：badge 类名取自状态首词（COUNTY_REVIEW → .county、EXIT_PENDING → .exit …） */
/* 通过 / 有效（绿） */
.badge.active, .badge.qualified, .badge.signed, .badge.confirmed,
.badge.calculated, .badge.published, .badge.scanned, .badge.matched,
.badge.reserve, .badge.field, .badge.approved {
  background: #e6f6ee; color: #14764c; border-color: #bfe6d3;
}
/* 进行中 / 待办 / 预警（橙） */
.badge.applied, .badge.submitted, .badge.county, .badge.state,
.badge.agreement, .badge.warning, .badge.reviewing, .badge.exit,
.badge.candidate, .badge.pending, .badge.unscanned, .badge.shortage,
.badge.returned {
  background: #fff5e3; color: #a35d0a; border-color: #f5ddb4;
}
/* 驳回 / 终止 / 异常（红） */
.badge.rejected, .badge.exited, .badge.blocked, .badge.conflict,
.badge.unavailable, .badge.surplus {
  background: #fdecea; color: #a83225; border-color: #f5c9c3;
}
/* 草稿 / 失效 / 关闭（灰） */
.badge.draft, .badge.inactive, .badge.unlinked, .badge.unconfigured,
.badge.unvisited, .badge.systemless, .badge.withdrawn, .badge.closed,
.badge.exported {
  background: #eef2f7; color: #5a6c7f; border-color: #d9e2ec;
}
.badge.disabled { background: #efe9fa; color: #573c9e; border-color: #d9cdf2; }

/* 兼容 index.html 的 .status 徽标，统一到同一套状态色 */
.status.matched { color: #14764c; background: #e6f6ee; }
.status.shortage { color: #a83225; background: #fdecea; }
.status.surplus { color: #a35d0a; background: #fff5e3; }
.status.unvisited, .status.systemless { color: #5a6c7f; background: #eef2f7; }

/* --------------------------------------------------------------------------
   12. 按钮
   -------------------------------------------------------------------------- */
.primary, .secondary, .quiet, .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--p-radius);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
}
.primary { background: linear-gradient(var(--p-blue-600), var(--p-blue-700)); color: #fff; box-shadow: 0 1px 3px rgba(17, 76, 158, .28); }
.primary:hover { background: linear-gradient(var(--p-blue-700), var(--p-blue-800)); }
.primary:disabled { background: #a9c4de; box-shadow: none; }
.secondary {
  background: #fff;
  border-color: var(--p-line);
  color: var(--p-ink);
}
.secondary:hover { border-color: var(--p-blue-500); color: var(--p-blue-700); background: var(--p-blue-50); }
.quiet, .icon { padding: 0 9px; border: 0; background: transparent; color: var(--p-muted); }
.quiet:hover, .icon:hover { color: var(--p-blue-700); background: var(--p-blue-50); }
.primary svg, .secondary svg, .quiet svg, .icon svg { width: 14px; height: 14px; }
.wide { width: 100%; }

/* --------------------------------------------------------------------------
   13. 进度、步骤、时间线
   -------------------------------------------------------------------------- */
.stepper { padding: 10px 0 20px; }
.step { font-size: 12px; }
.step i { width: 18px; height: 18px; font-size: 10px; }
.step.done { color: var(--p-blue-700); }
.step.done:before { background: var(--p-blue-600); }
.step.done i { background: var(--p-blue-600); color: #fff; }

.timeline-row { border-left-color: var(--p-line); }
.timeline-row:before { background: var(--p-blue-600); }

.stage-index {
  background: linear-gradient(140deg, var(--p-blue-500), var(--p-cyan-500));
  color: #fff;
}
.stage-row { padding: 11px 0; border-bottom: 1px solid var(--p-line-2); }
.stage-row:last-child { border-bottom: 0; }
.stage-row b { color: var(--p-blue-800); }

/* --------------------------------------------------------------------------
   14. 右侧悬浮工具条
   -------------------------------------------------------------------------- */
.p-rail {
  position: fixed;
  z-index: 25;
  top: calc(var(--p-banner-h) + var(--p-crumb-h) + 16px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}

.p-rail-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 48px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--p-line);
  border-right: 0;
  border-radius: var(--p-radius) 0 0 var(--p-radius);
  background: #fff;
  color: var(--p-ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: -2px 1px 6px rgba(13, 47, 87, .09);
  transition: background .14s, color .14s, transform .14s;
}
.p-rail-btn:hover { background: var(--p-blue-50); color: var(--p-blue-700); transform: translateX(-2px); }
.p-rail-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }

.p-rail-btn.is-blue    { background: linear-gradient(var(--p-blue-600), var(--p-blue-700)); border-color: var(--p-blue-700); color: #fff; }
.p-rail-btn.is-orange  { background: linear-gradient(#e8912a, #d98218); border-color: #cf7d1c; color: #fff; }
.p-rail-btn.is-green   { background: linear-gradient(#26b06a, #12a150); border-color: #0f8a44; color: #fff; }
.p-rail-btn.is-gold    { background: linear-gradient(#eec23f, #e0b32c); border-color: #c79d1f; color: #fff; }
.p-rail-btn.is-slate   { background: linear-gradient(#7b8ea3, #6a7c90); border-color: #5f7085; color: #fff; }

.p-region-panel {
  position: absolute;
  top: 0;
  right: 54px;
  display: grid;
  gap: 4px;
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  background: #fff;
  color: var(--p-ink);
  box-shadow: var(--p-shadow-md);
  font-size: 12px;
}
.p-region-panel strong { color: var(--p-blue-700); font-size: 11px; }
.p-region-panel span { font-weight: 700; }
.p-region-panel small { color: var(--p-muted); line-height: 1.4; }

/* 回到顶部（滚动后出现） */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 26;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--p-line);
  border-radius: 50%;
  background: #fff;
  color: var(--p-blue-700);
  box-shadow: var(--p-shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .18s, transform .18s, background .14s;
}
.back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--p-blue-50); }
.back-to-top svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   15. 登录页
   -------------------------------------------------------------------------- */
.login-screen {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(6, 58, 117, .94), rgba(47, 143, 214, .86)),
    repeating-linear-gradient(45deg, #0a4a8f 0 22px, #0d5aa8 22px 44px);
}
.login-card {
  width: min(400px, 100%);
  padding: 34px 32px;
  border: 0;
  border-top: 3px solid var(--p-gold);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow-lg);
  background: #fff;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--p-blue-600), var(--p-blue-800));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}
.login-wordmark { line-height: 1.2; }
.login-wordmark b { display: block; font-size: 15px; letter-spacing: 1.5px; color: var(--p-blue-900); }
.login-wordmark span { display: block; font-size: 9px; letter-spacing: 1.8px; color: var(--p-muted); text-transform: uppercase; }
.login-card h1 { margin-bottom: 8px; font-size: 20px; }
.login-copy { margin-bottom: 22px; color: var(--p-muted); font-size: 12.5px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 12.5px; font-weight: 700; }
.login-card input {
  height: 38px;
  margin-top: 6px;
  padding: 0 11px;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.login-card input:focus { border-color: var(--p-blue-500); box-shadow: 0 0 0 3px var(--p-blue-100); }
.login-foot { margin: 16px 0 0; color: var(--p-muted); font-size: 11.5px; text-align: center; }

/* 键盘可达性：统一焦点环 */
:where(button, a, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--p-blue-500);
  outline-offset: 2px;
}
.p-banner :where(button, a, input, summary):focus-visible { outline-color: #fff; }

/* --------------------------------------------------------------------------
   16. 弹窗 / 提示
   -------------------------------------------------------------------------- */
.dialog, .modal-content {
  border: 0;
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow-lg);
}
.dialog-heading, .modal-head {
  padding: 15px 18px 12px;
  background: linear-gradient(180deg, #fbfdff, var(--p-blue-50));
  border-bottom: 1px solid var(--p-line);
}
.dialog-heading h3 { font-size: 15.5px; }
.dialog-actions, .modal-foot {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--p-line);
  background: #fcfdff;
}
.dialog input, .dialog select, .dialog textarea,
.modal input, .modal select, .modal textarea {
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.dialog input:focus, .dialog select:focus, .dialog textarea:focus,
.modal input:focus, .modal select:focus, .modal textarea:focus {
  border-color: var(--p-blue-500);
  box-shadow: 0 0 0 3px var(--p-blue-100);
}
.dialog::backdrop { background: rgba(8, 40, 78, .52); animation: p-fade-in .16s ease-out; }
.dialog[open] { animation: p-dialog-in .18s ease-out; }
@keyframes p-dialog-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes p-fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog-heading .eyebrow { color: var(--p-muted); }

.toast { border-radius: var(--p-radius); background: #12304f; box-shadow: var(--p-shadow-md); }
.toast.error { background: #a5322a; }

.empty {
  padding: 40px 16px;
  color: var(--p-muted);
  font-size: 12.5px;
  text-align: center;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin: 6px;
  padding: 40px 16px;
  border: 1px dashed var(--p-line);
  border-radius: var(--p-radius-lg);
  background: #fbfcfe;
}
.empty-state svg { width: 30px; height: 30px; color: var(--p-blue-300); }
.empty-state p { margin: 0; color: var(--p-ink); font-size: 13px; }
.empty-state small { max-width: 420px; color: var(--p-muted); }
.empty-state .secondary { margin-top: 4px; }

/* 表单说明块（申请条件 / 协议甲方乙方等） */
.form-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--p-line);
  border-left: 4px solid var(--p-blue-500);
  border-radius: var(--p-radius);
  background: var(--p-blue-50);
  font-size: 12.5px;
  color: var(--p-ink);
}
.form-note svg { width: 18px; height: 18px; color: var(--p-blue-600); flex: 0 0 auto; margin-top: 2px; }
.form-note strong { display: block; margin-bottom: 5px; }
.form-note ul { margin: 0; padding-left: 18px; color: var(--p-muted); line-height: 1.7; }

/* --------------------------------------------------------------------------
   17. 旧版块收口（lifecycle / index 共用的零散类名）
   -------------------------------------------------------------------------- */
.overview-banner {
  position: relative;
  min-height: 112px;
  padding: 20px 22px;
  margin-bottom: 16px;
  border-radius: var(--p-radius-lg);
  background: linear-gradient(105deg, var(--p-blue-800), var(--p-blue-500) 62%, var(--p-cyan-500));
  box-shadow: var(--p-shadow-md);
  overflow: hidden;
}
.overview-banner::after {
  position: absolute;
  right: -40px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  content: "";
}
.overview-banner h3 { font-size: 20px; color: #fff; }
.overview-banner .eyebrow { color: #bcd9f2; }
.overview-banner p:last-child { color: #d7e9f8; font-size: 12.5px; }
.banner-target strong { font-size: 27px; }

.quick-action { border-radius: var(--p-radius); }
.quick-action:hover { border-color: var(--p-blue-500); background: var(--p-blue-50); }
.quick-action svg { color: var(--p-blue-600); }

.profile-item:hover, .profile-item.active { background: var(--p-blue-50); }
.profile-item.active { box-shadow: inset 3px 0 0 var(--p-blue-600); }

/* 一户一档：档案头、指标格、时间线 */
.profile-hero {
  position: relative;
  padding-left: 26px;
  background: linear-gradient(90deg, var(--p-blue-50), #fff 72%);
  border-bottom: 1px solid var(--p-line);
}
.profile-hero::before {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(var(--p-blue-500), var(--p-cyan-500));
  content: "";
}
.profile-hero h3 { font-size: 19px; }
.profile-hero p { margin: 5px 0 0; color: var(--p-muted); font-size: 12.5px; }

.detail-grid dl {
  margin: 0;
  padding: 12px 14px;
  background: var(--p-blue-50);
  border: 1px solid var(--p-line-2);
  border-radius: var(--p-radius);
}
.detail-grid dd { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--p-ink); }

.timeline-row strong { color: var(--p-ink); }
.timeline-row p { margin: 3px 0 0; color: var(--p-muted); font-size: 12px; }

/* 扫码监测：明细头统一为蓝色调（原为绿色底 #f5faf8） */
.scan-detail-head {
  background: linear-gradient(90deg, var(--p-blue-50), #fff 72%);
  border-bottom-color: var(--p-line);
}

/* 审批中心：待办提示条 */
.approvals-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 11px 16px;
  border: 1px solid var(--p-blue-200);
  border-left: 4px solid var(--p-blue-600);
  border-radius: var(--p-radius);
  background: var(--p-blue-50);
  color: var(--p-blue-800);
  font-size: 13px;
}
.approvals-hint b { font-size: 15px; color: var(--p-blue-900); }
.approvals-hint svg { width: 16px; height: 16px; }

/* index.html：把残留的青绿强调色统一到烟草蓝 */
.icon-button.primary {
  background: linear-gradient(var(--p-blue-600), var(--p-blue-700));
  border-color: var(--p-blue-700);
  color: #fff;
}
.metric-card:nth-child(4) strong { color: var(--p-blue-700); }
.metric-card:nth-child(5) strong { color: var(--p-cyan-600); }
.text-link { color: var(--p-blue-700); }
.text-link:hover { color: var(--p-blue-800); }
.segmented-control button.active { background: var(--p-blue-600); color: #fff; }
.progress-bar span { background: linear-gradient(90deg, var(--p-blue-500), var(--p-cyan-500)); }
.pos-live-table th:nth-child(-n + 4) { background: var(--p-blue-50); }
.selection-cell input { accent-color: var(--p-blue-600); }
.dispatch-manager-group { border-color: var(--p-blue-200); background: var(--p-blue-50); }
.sb-table-wrap th { background: var(--p-blue-50); color: var(--p-muted); }
.sb-badge { background: var(--p-blue-50); color: var(--p-muted); }
.sb-empty strong { color: var(--p-muted); }

.batch-note { background: var(--p-blue-50); color: var(--p-blue-800); border-radius: var(--p-radius); }
.batch-summary div { background: var(--p-blue-50); border-radius: var(--p-radius); }

.upload-zone {
  border-color: var(--p-blue-300);
  border-radius: var(--p-radius-lg);
  background: var(--p-blue-50);
}
.upload-zone svg { color: var(--p-blue-600); }

.scan-source { border-left-color: var(--p-blue-600); border-radius: var(--p-radius-lg); }
.scan-retry { flex: 0 0 auto; height: 28px; padding: 0 12px; }
.scan-source .scan-failure b { color: var(--p-red); }
.scan-busy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-blue-700);
  font-size: 12px;
}
.scan-busy svg { width: 14px; height: 14px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.server-state.warning { border-left-color: var(--p-orange); background: #fffaf2; }
.server-state.loading-inline { color: var(--p-blue-700); }
.server-state.error { color: var(--p-red); }

/* 参考图中的价类表头样式（差异分析等汇总表复用） */
.p-summary-head th {
  background: linear-gradient(var(--p-blue-600), var(--p-blue-700)) !important;
  color: #fff !important;
}

/* --------------------------------------------------------------------------
   18. 响应式
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  :root { --p-side-w: 190px; }
}

@media (max-width: 980px) {
  .p-shell { grid-template-columns: minmax(0, 1fr); }
  .p-side, .side-nav {
    position: fixed;
    z-index: 40;
    top: calc(var(--p-banner-h) + var(--p-crumb-h));
    left: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--p-shadow-lg);
  }
  .p-side.open, .side-nav.open { transform: translateX(0); }
  .p-rail { display: none; }
  .p-content, .content { padding: 14px 14px 38px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   21. 参考截图细节：工具区、页签、图标轨道和数字槽位
   -------------------------------------------------------------------------- */
.p-banner-logo {
  position: relative;
  overflow: hidden;
  font-size: 0;
}
.p-banner-logo::before {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1684dd;
  content: "";
}
.p-banner-logo::after {
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transform: translate(5px, -3px);
}
.p-banner-search {
  display: flex !important;
  width: 30px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border: 0;
}
.p-banner-search input { display: none; }
.p-banner-search:hover { background: rgba(255,255,255,.22); }
.p-banner-btn[aria-pressed="true"] { background: rgba(255,255,255,.28); }
.p-user-panel,
.p-app-panel {
  position: absolute;
  z-index: 20;
  top: 43px;
  right: 58px;
  min-width: 172px;
  padding: 7px;
  border: 1px solid rgba(12,72,135,.18);
  background: #fff;
  box-shadow: 0 6px 20px rgba(24,55,88,.2);
  color: #283847;
}
.p-app-panel { right: 7px; min-width: 190px; }
.p-user-panel-status { display: flex; align-items: center; gap: 7px; padding: 8px; border-bottom: 1px solid #edf1f4; color: #2ca56a; font-size: 11px; }
.p-user-panel button,
.p-app-panel button { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 30px; padding: 0 8px; border: 0; background: transparent; color: #334452; text-align: left; font-size: 12px; }
.p-user-panel button:hover,
.p-app-panel button:hover { background: #eef7fe; color: #147fd0; }
.p-user-panel svg { width: 14px; height: 14px; }
.p-app-panel strong { display: block; padding: 5px 8px 7px; color: #147fd0; font-size: 12px; }
/* Keep the current page title visible so navigation state remains clear for
   keyboard users and roles that can open a read-only settings surface. */
.p-crumb-trail { display: flex !important; }
.p-crumb-current { display: inline-flex !important; align-items: center; gap: 9px; color: #243544; border-bottom-color: #1688e8; }
.p-crumb-close { width: 14px; height: 14px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #8b98a3; line-height: 12px; font-size: 15px; }
.p-crumb-close:hover { color: #1688e8; background: #e8f3fc; }
#syncState, #logoutBtn { display: none !important; }

.p-side {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
}
.p-side-icon-rail {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #f4f6f8;
  border-right: 1px solid #e0e5e9;
}
.p-side-icon-rail button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 43px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  background: transparent;
  color: #687581;
}
.p-side-icon-rail button:hover,
.p-side-icon-rail button.active { background: #1688e8; color: #fff; }
.p-side-icon-rail svg { width: 16px; height: 16px; }
.p-side > .nav,
.p-side > nav { grid-column: 2; grid-row: 1; min-width: 0; }
.p-side .p-nav-head { min-height: 43px; padding: 0 8px 0 9px; }
.p-side .p-nav-head > svg:first-child { display: none; }
.p-side .p-nav-head .p-nav-caret { margin-left: auto; transform: rotate(-90deg); }
.p-side .p-nav-group:not(.collapsed) .p-nav-head .p-nav-caret { transform: rotate(0); }
.p-side .p-nav-head span,
.p-side .nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-side .p-nav-list .nav-item { min-height: 36px; padding-left: 13px; padding-right: 8px; }
.p-side .p-nav-list .nav-item svg { display: none; }
.p-side .p-nav-group { border-bottom: 1px solid #eef1f3; }
.p-side .p-nav-group:first-child .p-nav-head { color: #1688e8; }

.p-rail { right: 0; top: calc(var(--p-banner-h) + var(--p-crumb-h)); width: 48px; gap: 1px; }
.p-rail-btn { min-width: 48px; height: 43px; }
.p-rail-btn.is-location { background: #fff; color: #218fdf; }
.p-rail-btn.is-apps { background: #f8fafb; color: #e51a2f; }
.p-rail-btn.is-purple { background: #4e78c9; color: #fff; }
.p-rail-btn.is-slate { background: #54758d; color: #fff; }
.p-rail-btn span { line-height: 1; }

.lifecycle-portal .metric { padding: 10px 7px 11px; border-radius: 0; text-align: center; }
.lifecycle-portal .metric strong { display: flex; justify-content: center; align-items: center; min-height: 43px; margin: 7px 0 4px; font-size: 0; }
.metric-slots { display: inline-flex !important; flex: 0 0 auto; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center; justify-content: center; gap: 2px; width: max-content; white-space: nowrap; }
.metric-slot { display: grid !important; flex: 0 0 38px; place-items: center; width: 38px; height: 42px; border: 1px solid #86bbf1; background: #f8fbff; color: #1e8ee3; font-style: normal; font-size: 26px; font-weight: 700; line-height: 1; }
.metric-slot-symbol { width: auto; min-width: 25px; padding: 0 3px; border-color: transparent; background: transparent; font-size: 21px; }
.lifecycle-portal .metric small { display: block; font-size: 11px; }
.lifecycle-portal .overview-banner { min-height: 112px; padding: 19px 26px 17px; text-align: center; }
.lifecycle-portal .overview-banner > div:first-child { flex: 1 1 auto; }
.lifecycle-portal .overview-banner .banner-target { min-width: 230px; text-align: right; }
.lifecycle-portal .overview-banner h3 { font-size: 22px; }
.lifecycle-portal .dashboard-charts { gap: 14px; }
.lifecycle-portal .chart-card .card-head { min-height: 39px; padding: 9px 13px; }
.lifecycle-portal .chart-card .card-head h4,
.lifecycle-portal .card-head h4 { position: relative; padding-left: 10px; font-size: 14px; }
.lifecycle-portal .chart-card .card-head h4::before,
.lifecycle-portal .card-head h4::before { position: absolute; left: 0; top: 1px; width: 3px; height: 15px; background: #19b7dc; content: ""; }
.lifecycle-portal .card { border-radius: 0; box-shadow: none; }
.lifecycle-portal .quick-action { min-height: 42px; padding: 0 11px; border-radius: 2px; }

@media (max-width: 980px) {
  .p-side { display: block; }
  .p-side-icon-rail { display: none; }
  .p-side > .nav { display: grid; }
  .p-user-panel, .p-app-panel { top: 43px; }
}

@media (max-width: 720px) {
  .p-banner { gap: 8px; padding-right: 8px; }
  .p-banner-brand { padding: 0 10px; }
  .p-banner-wordmark { display: none; }
  .p-banner-title { font-size: 13.5px; }
  .p-banner-search { display: none; }
  .p-banner-user span { display: none; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .profile-layout, .section-grid { grid-template-columns: minmax(0, 1fr); }
  .filters { gap: 8px; }
  .filters label { width: 100%; }
  .filters input, .filters select { flex: 1 1 auto; min-width: 0; }
  .data-table th, .data-table td { padding: 8px 9px; }

  /* 窄屏：列筛选面板不溢出、密度控件更紧凑、冻结列更窄 */
  .col-chooser-panel {
    right: auto;
    left: 0;
    width: min(240px, calc(100vw - 28px));
    min-width: 0;
  }
  .density-control select { max-width: 92px; }
  .data-table.has-select th:nth-child(1),
  .data-table.has-select td:nth-child(1) { width: 38px; min-width: 38px; max-width: 38px; }
  .table-wrap .data-table.has-select th:nth-child(2),
  .table-wrap .data-table.has-select td:nth-child(2) { left: 38px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 生命周期工作台沿用参考图中的营销门户白侧栏；库存分析入口保留深蓝台账侧栏。 */
.lifecycle-portal .p-side {
  background: #fff;
  border-right-color: var(--p-line);
  box-shadow: 1px 0 0 rgba(13, 47, 87, .03);
}
.lifecycle-portal .p-nav-group { border-bottom-color: var(--p-line-2); }
.lifecycle-portal .p-nav-head {
  color: var(--p-ink);
  background: #fff;
}
.lifecycle-portal .p-nav-head:hover { background: var(--p-blue-50); }
.lifecycle-portal .p-nav-head > svg:first-child { color: var(--p-blue-600); }
.lifecycle-portal .p-nav-head .p-nav-caret { color: var(--p-muted); }
.lifecycle-portal .p-nav-list .nav-item,
.lifecycle-portal .p-side .nav-item {
  color: #506579;
}
.lifecycle-portal .p-side .nav-item:hover {
  background: var(--p-blue-50);
  color: var(--p-blue-800);
}
.lifecycle-portal .p-side .nav-item.active {
  background: linear-gradient(90deg, var(--p-blue-100), #fff);
  color: var(--p-blue-800);
  box-shadow: inset 3px 0 0 var(--p-blue-600);
}
.lifecycle-portal .p-side .nav-item.active::before { display: none; }
.lifecycle-portal .p-side .nav-item svg { color: var(--p-blue-600); }
.lifecycle-portal .p-side-note {
  background: var(--p-blue-50);
  color: var(--p-muted);
  border: 1px solid var(--p-line);
}
.lifecycle-portal .p-side-note strong { color: var(--p-blue-800); }

/* 参考图版式收紧：48px品牌栏、30px页签栏，以及白底的大盘首屏。 */
.p-banner { background: linear-gradient(100deg, var(--p-banner-from) 0%, var(--p-banner-via) 55%, var(--p-banner-to) 100%); }
.p-banner-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: var(--p-blue-700);
  box-shadow: 0 1px 5px rgba(0, 54, 130, .22);
}
.p-crumbbar { height: var(--p-crumb-h); }
.p-crumb-tab { height: 24px; border-radius: 0; }
.p-nav-head { padding-top: 10px; padding-bottom: 10px; }
.lifecycle-portal #appShell.shell {
  display: block;
  min-height: 100vh;
  grid-template-columns: none;
}

.lifecycle-portal .overview-banner {
  min-height: 112px;
  margin: 0 -1px 10px;
  padding: 18px 26px 14px;
  border: 0;
  border-bottom: 7px solid var(--p-canvas);
  border-radius: 0;
  background: #fff;
  color: var(--p-ink);
  box-shadow: none;
  text-align: center;
}
.lifecycle-portal .overview-banner > div:first-child { position: relative; z-index: 1; }
.lifecycle-portal .overview-banner::before,
.lifecycle-portal .overview-banner::after {
  position: absolute;
  top: 51px;
  width: 22%;
  height: 1px;
  background: var(--p-blue-500);
  content: "";
}
.lifecycle-portal .overview-banner::before { left: 10%; }
.lifecycle-portal .overview-banner::after { right: 10%; }
.lifecycle-portal .overview-banner .eyebrow { margin-bottom: 2px; color: var(--p-blue-700); }
.lifecycle-portal .overview-banner h3 { margin: 0 0 4px; color: var(--p-ink); font-size: 21px; }
.lifecycle-portal .overview-banner p:last-child { color: var(--p-muted); }
.lifecycle-portal .banner-target {
  position: absolute;
  right: 24px;
  top: 20px;
  text-align: right;
}
.lifecycle-portal .banner-target strong { color: var(--p-blue-600); font-size: 25px; }
.lifecycle-portal .banner-target span { color: var(--p-muted); }
.lifecycle-portal .metric-grid { gap: 0; margin-bottom: 16px; }
.lifecycle-portal .metric {
  min-height: 102px;
  padding: 13px 12px 10px;
  border: 1px solid var(--p-line);
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}
.lifecycle-portal .metric:first-child { border-left: 1px solid var(--p-line); }
.lifecycle-portal .metric span { color: var(--p-ink); }
.lifecycle-portal .metric strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 42px;
  margin: 7px auto 2px;
  padding: 0 8px;
  border: 1px solid #85baf0;
  background: #f7fbff;
  color: var(--p-blue-600);
  font-size: 25px;
  line-height: 1;
}
.lifecycle-portal .metric small { color: var(--p-muted); }
.lifecycle-portal .metric small {
  display: block;
  margin-top: 3px;
  line-height: 1.35;
}
.lifecycle-portal .p-content { padding-right: 38px; }
.lifecycle-portal .card { border-radius: 0; box-shadow: none; }
.lifecycle-portal .card-head { background: #f3f6f8; }
.lifecycle-portal .stage-index { background: var(--p-cyan-100); color: var(--p-blue-700); }
.lifecycle-portal .stage-bar { background: linear-gradient(90deg, var(--p-blue-500), var(--p-cyan-500)); }

@media (max-width: 720px) {
  .lifecycle-portal .p-content { padding-right: 14px; }
  .lifecycle-portal .overview-banner { margin: 0 0 10px; padding: 18px 16px 14px; text-align: left; }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { display: none; }
  .lifecycle-portal .banner-target { position: static; margin-top: 10px; text-align: left; }
  .lifecycle-portal .metric-grid { gap: 8px; }
  .lifecycle-portal .metric { border-left: 1px solid var(--p-line); border-radius: 2px; }
}

/* --------------------------------------------------------------------------
   19. 无障碍与打印
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .p-banner, .p-crumbbar, .p-side, .p-side-note, .p-rail,
  .top-actions, .server-table-actions, .ledger-controls, .server-pager,
  .filters, .lifecycle-filters, .toast-region, .mobile-menu { display: none !important; }
  .p-shell { grid-template-columns: minmax(0, 1fr); }
  .p-content, .content, .p-shell > .main { padding: 0; }
  body { background: #fff; }
  .card, .panel, .metric { box-shadow: none; border-color: #d0d7e0; }
  .data-table thead th { background: #eef3f9 !important; color: #152534 !important; }
}

/* --------------------------------------------------------------------------
   20. 参考门户风格收口

   参考图采用“蓝色品牌顶栏 + 白色图标导航 + 灰白工作区”的密度和配色。
   下面的收口覆盖前置业务样式，仅调整视觉层，保留现有 DOM、data-view 与
   表单钩子，index.html 与 lifecycle.html 因而共用同一套门户外壳。
   -------------------------------------------------------------------------- */
:root {
  --p-banner-h: 48px;
  --p-crumb-h: 28px;
  --p-side-w: 223px;
  --p-nav-bg: #fff;
  --p-nav-bg-deep: #f4f6f8;
  --p-nav-hover: #e9f4ff;
  --p-nav-active: #1688e8;
  --p-nav-text: #2d3742;
  --p-nav-muted: #7d8791;
  --p-canvas: #f1f3f5;
  --p-paper: #fff;
  --p-line: #d9e0e5;
  --p-line-2: #edf1f4;
  --p-radius: 2px;
  --p-radius-lg: 3px;
  --p-shadow: 0 1px 2px rgba(27, 51, 73, .08);
  --p-shadow-md: 0 2px 8px rgba(27, 51, 73, .12);
  --p-blue-50: #f2f8fd;
  --p-blue-100: #e3f1fc;
  --p-blue-200: #b9dcf8;
  --p-blue-300: #8fc4f0;
  --p-blue-500: #3ea4ef;
  --p-blue-600: #218fdf;
  --p-blue-700: #147fd0;
  --p-blue-800: #1266ad;
  --p-blue-900: #0b4c85;
  --p-cyan-500: #18bedf;
  --p-cyan-600: #0ba7ca;
  --nav: #fff;
  --nav2: #f4f6f8;
  --canvas: var(--p-canvas);
  --paper: var(--p-paper);
  --line: var(--p-line);
  --ink: #25313d;
  --muted: #707b86;
  --shadow: var(--p-shadow);
  --bg: var(--p-canvas);
  --surface: var(--p-paper);
  --surface-soft: #f4f8fb;
  --nav-soft: var(--p-nav-hover);
  --line-strong: #b8c6d1;
  --text: #25313d;
  --primary: var(--p-blue-700);
  --primary-dark: var(--p-blue-800);
  --primary-soft: var(--p-blue-100);
  --good: #27a867;
  --danger: #e15344;
  --warning: #e39a2d;
}

body {
  min-width: 1080px;
  background: var(--p-canvas);
  color: #25313d;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 12px;
}

/* 顶栏：参考图中的 48px 蓝色渐变品牌条 */
.p-banner {
  height: var(--p-banner-h);
  gap: 13px;
  padding-right: 8px;
  isolation: isolate;
  background: linear-gradient(105deg, #1479dc 0%, #4d8ee8 52%, #12c2e8 100%);
  box-shadow: 0 1px 2px rgba(26, 95, 154, .22);
}
.p-banner::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .15;
  background: repeating-linear-gradient(58deg, transparent 0 15px, rgba(255,255,255,.38) 15px 17px);
  content: "";
}
.p-banner > * { position: relative; z-index: 1; }
.p-banner-brand {
  gap: 8px;
  padding: 0 12px 0 9px;
  border-right: 0;
  background: transparent;
}
.p-banner-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #1684dd;
  background: #fff;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.p-banner-wordmark b { font-size: 14px; letter-spacing: 1.2px; }
.p-banner-wordmark span { font-size: 8px; letter-spacing: 1.4px; }
.p-banner-title {
  font-size: 13px;
  letter-spacing: .3px;
  text-shadow: none;
}
.p-banner-tools { gap: 2px; }
.p-banner-search {
  width: 190px;
  height: 30px;
  background: rgba(255,255,255,.14);
}
.p-banner-btn,
.p-banner-user { height: 30px; border-radius: 2px; }
.p-banner-btn:hover,
.p-banner-user:hover { background: rgba(255,255,255,.22); }

/* 标签栏：参考图中紧贴顶栏的浅灰工作区标签 */
.p-crumbbar {
  top: var(--p-banner-h);
  height: var(--p-crumb-h);
  gap: 7px;
  padding: 0 8px;
  background: #f5f6f7;
  border-bottom: 1px solid #dce1e5;
  box-shadow: none;
}
.p-crumb-tab {
  height: 27px;
  margin-top: 1px;
  padding: 0 11px;
  border: 0;
  border-bottom: 2px solid var(--p-blue-600);
  border-radius: 0;
  background: #fff;
  color: var(--p-blue-700);
  font-size: 11px;
  font-weight: 400;
}
.p-crumb-trail { gap: 4px; font-size: 11px; }
.p-crumb-trail svg { display: none; }
.p-crumb-trail .eyebrow { font-size: 11px; font-weight: 400; }
.p-crumbbar > .icon-button,
.p-crumbbar > .secondary { min-height: 24px; height: 24px; padding: 0 9px; border-radius: 2px; font-size: 11px; }

/* 左侧导航：白底、灰色图标、蓝色选中项，与参考图的窄密度一致 */
.p-shell { grid-template-columns: var(--p-side-w) minmax(0, 1fr); min-height: calc(100vh - 76px); }
.p-side {
  top: calc(var(--p-banner-h) + var(--p-crumb-h));
  height: calc(100vh - var(--p-banner-h) - var(--p-crumb-h));
  padding: 0;
  background: #fff;
  border-right: 1px solid #d9e0e5;
  box-shadow: 1px 0 2px rgba(30, 60, 86, .04);
}
.p-nav-group { border-bottom: 1px solid #f1f3f5; }
.p-nav-head {
  min-height: 38px;
  padding: 0 12px 0 15px;
  color: #263442;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}
.p-nav-head:hover { background: #f1f7fc; }
.p-nav-head > svg:first-child { width: 16px; height: 16px; color: #687581; }
.p-nav-head .p-nav-caret { width: 11px; height: 11px; color: #84909b; }
.p-nav-list { gap: 0; padding: 0; }
.p-nav-list .nav-item,
.p-side .nav-item {
  min-height: 36px;
  padding: 0 12px 0 42px;
  border-radius: 0;
  color: #3a4651;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
}
.p-side .nav-item svg { width: 15px; height: 15px; color: #6e7984; }
.p-side .nav-item:hover { color: var(--p-blue-700); background: #eef7fe; }
.p-side .nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, #1685e4, #2999ef);
  box-shadow: none;
  font-weight: 700;
}
.p-side .nav-item.active svg { color: #fff; }
.p-side .nav-item.active::before { display: none; }
.p-side .nav-item b { background: #e85445; }
.p-side-note { display: none; }

/* 兼容旧侧栏选择器，防止未迁移页面出现深色块 */
.side-nav { background: #fff; border-right: 1px solid #d9e0e5; }
.side-nav .brand { border-bottom-color: #edf1f4; }
.side-nav .brand h1 { color: #25313d; }
.side-nav .brand p { color: #7d8791; }
.side-nav nav { padding: 0; }
.side-nav .nav-item { color: #3a4651; border-radius: 0; }
.side-nav .nav-item:hover,
.side-nav .nav-item.active { color: #fff; background: #1688e8; }

/* 内容工作区和标题，保持参考图的灰白底与紧凑间距 */
.p-main { background: var(--p-canvas); }
.p-shell > .main { padding: 12px 14px 28px; }
.p-content,
.content { padding: 12px 14px 28px; }
.topbar { gap: 12px; margin-bottom: 10px; }
.topbar h2 { font-size: 18px; }
.view-header { margin-bottom: 10px; }
.view-header h3 { font-size: 16px; }
.eyebrow { font-size: 11px; }

/* 控件和表格：参考图中的 28px 高度、蓝色表头与浅蓝条纹 */
.panel,
.card,
.metric,
.metric-card { border-radius: 3px; box-shadow: 0 1px 2px rgba(28, 57, 81, .06); }
.panel { background: #fff; }
.filters { gap: 9px; margin-bottom: 10px; padding: 10px; }
input, select,
.filters input, .filters select,
.dialog input, .dialog select, .dialog textarea { height: 29px; border-radius: 2px; padding: 0 8px; font-size: 12px; }
.icon-button, .file-button,
.primary, .secondary, .quiet { min-height: 29px; height: 29px; border-radius: 14px; padding: 0 12px; font-size: 12px; }
.icon-button.primary,
.primary { background: linear-gradient(180deg, #2399ee, #1184e2); border-color: #1286e0; }
.icon-button.secondary,
.secondary { border-color: #b9c6d0; background: #fff; color: #3e4a55; }
.metric-card { min-height: 92px; padding: 12px 14px; }
.metric-card strong { margin: 6px 0 3px; font-size: 26px; }
.card-head { padding: 9px 12px; }
.card-body { padding: 12px; }
.data-table th,
.p-summary-head th { background: #42a5f5 !important; color: #fff !important; font-size: 12px; font-weight: 400; }
.data-table th, .data-table td { padding: 7px 9px; border-color: #d8e1e8; }
.data-table tbody tr:nth-child(even) { background: #eef8fc; }
.data-table tbody tr:hover { background: #e2f2fd; }
.table-wrap { border-radius: 2px; border-color: #d8e1e8; }

/* 右侧浮动工具条：缩窄成参考图的彩色快捷按钮 */
.p-rail {
  top: calc(var(--p-banner-h) + var(--p-crumb-h) + 4px);
  gap: 1px;
}
.p-rail-btn {
  min-width: 42px;
  height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: 0;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  font-size: 10px;
  box-shadow: none;
}
.p-rail-btn svg { width: 16px; height: 16px; }

@media (max-width: 980px) {
  :root { --p-side-w: 223px; }
  .p-shell { grid-template-columns: minmax(0, 1fr); }
  .p-side, .side-nav { top: calc(var(--p-banner-h) + var(--p-crumb-h)); }
  .p-rail { display: none; }
}

@media (max-width: 720px) {
  body { min-width: 0; }
  .p-banner-brand { padding-left: 6px; padding-right: 7px; }
  .p-banner-wordmark,
  .p-banner-search,
  .p-banner-user .user-chip,
  .p-banner-user > span:not(.p-avatar) { display: none; }
  .p-banner-title { font-size: 12px; }
  .p-crumbbar { padding: 0 5px; }
}

@media (max-width: 720px) {
  .p-crumbbar { gap: 6px; overflow: hidden; }
  .p-crumb-trail { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .p-crumb-trail i { flex: 0 0 auto; }
  .p-crumb-spacer, .sync-state { display: none; }
  .p-crumbbar .secondary { flex: 0 0 auto; padding: 5px 8px; }
  .p-crumbbar .secondary span { display: none; }
}

/* 保留原有刷新、连接状态和退出入口，视觉上收紧但不删除功能。 */
#logoutBtn { display: inline-flex !important; flex: 0 0 auto; }
@media (min-width: 721px) {
  #syncState { display: flex !important; align-items: center; gap: 5px; flex: 0 0 auto; color: #2ca56a; font-size: 11px; white-space: nowrap; }
}

/* 平板宽度也使用抽屉导航，页面本身不再被 1080px 最小宽度撑出视口。 */
@media (max-width: 1180px) {
  body { min-width: 0; overflow-x: auto; }
  .p-shell, .p-main, .main, .p-content, .content { min-width: 0; max-width: 100%; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
}

/* 桌面驾驶舱最终收口：确保这组规则位于文件最后，覆盖旧版桌面密度设置。 */
@media (min-width: 1280px) {
  .lifecycle-portal {
    --p-banner-h: 64px;
    --p-crumb-h: 38px;
    --p-side-w: 236px;
  }
  .lifecycle-portal .p-banner-logo { width: 40px; height: 40px; border-radius: 50%; font-size: 22px; }
  .lifecycle-portal .p-banner-logo::before { width: auto; height: auto; border-radius: 0; background: transparent; color: #1684dd; content: "文"; font-size: 22px; font-weight: 800; line-height: 1; }
  .lifecycle-portal .p-banner-logo::after { display: none; }
  .lifecycle-portal .p-banner-wordmark b { font-size: 16px; }
  .lifecycle-portal .p-banner-wordmark span { font-size: 10px; }
  .lifecycle-portal .p-banner-title { font-size: 16px; }
  .lifecycle-portal .p-content { padding: 16px 68px 40px 18px; }
  .lifecycle-portal .p-side { grid-template-columns: minmax(0, 1fr); }
  .lifecycle-portal .p-side-icon-rail { display: none; }
  .lifecycle-portal .p-side > .nav,
  .lifecycle-portal .p-side > nav { grid-column: 1; }
  .lifecycle-portal .p-side .p-nav-head { min-height: 37px; padding: 0 10px 0 14px; font-size: 11.5px; }
  .lifecycle-portal .p-side .p-nav-head > svg:first-child { display: block; width: 16px; height: 16px; color: #1688e8; }
  .lifecycle-portal .p-side .p-nav-list .nav-item { min-height: 33px; padding-left: 18px; padding-right: 10px; gap: 7px; font-size: 11.5px; }
  .lifecycle-portal .p-side .p-nav-list .nav-item svg { display: block; width: 16px; height: 16px; color: #1688e8; }
  .lifecycle-portal .p-side .p-nav-group:first-child > .p-nav-head { display: none; }
  .lifecycle-portal .p-side .p-nav-group:first-child .p-nav-list { display: block; }
  .lifecycle-portal .overview-banner { min-height: 140px; margin-bottom: 10px; padding: 20px 32px 18px; }
  .lifecycle-portal .overview-banner::before,
  .lifecycle-portal .overview-banner::after { top: 43px; }
  .lifecycle-portal .overview-banner h3 { margin-bottom: 4px; font-size: 22px; }
  .lifecycle-portal .overview-banner p:last-child { font-size: 12.5px; }
  .lifecycle-portal .banner-target { top: 20px; right: 20px; }
  .lifecycle-portal .banner-target strong { font-size: 30px; }
  .lifecycle-portal .metric-grid { margin-bottom: 10px; }
  .lifecycle-portal .metric { min-height: 136px; padding: 14px 12px 12px; }
  .lifecycle-portal .metric strong { min-height: 52px; margin: 7px auto 4px; font-size: 28px; }
  .lifecycle-portal .metric-slot { flex-basis: clamp(30px, 2.1vw, 38px); width: clamp(30px, 2.1vw, 38px); height: 46px; font-size: clamp(23px, 1.4vw, 26px); }
  .lifecycle-portal .metric-slot-symbol { min-width: clamp(20px, 1.45vw, 25px); padding: 0 2px; font-size: clamp(18px, 1.1vw, 21px); }
  .lifecycle-portal .metric span { font-size: 12.5px; }
  .lifecycle-portal .metric small { font-size: 11px; }
  .lifecycle-portal .metric:last-child strong { width: 100%; min-width: 0; }
  .lifecycle-portal .metric:last-child .metric-slots { width: 100%; max-width: 100%; gap: 1px; }
  .lifecycle-portal .metric:last-child .metric-slot { flex: 0 1 clamp(20px, 1.8vw, 34px); width: auto; min-width: 0; height: 42px; font-size: clamp(18px, 1.2vw, 23px); }
  .lifecycle-portal .metric:last-child .metric-slot-symbol { flex: 0 1 clamp(16px, 1.1vw, 22px); min-width: 0; font-size: clamp(16px, 1vw, 20px); }
  .lifecycle-portal .dashboard-charts { grid-template-columns: minmax(0, 1.45fr) minmax(360px, .95fr); gap: 14px; margin-bottom: 22px; }
  .lifecycle-portal .chart-card .card-head { min-height: 39px; padding: 9px 13px; }
  .lifecycle-portal .chart-card .card-head h4 { font-size: 14px; }
  .lifecycle-portal .chart-card .card-body { padding: 14px 16px; }
  .lifecycle-portal .bar-chart { height: 270px; gap: 16px; padding: 8px 8px 0; }
  .lifecycle-portal .bar-track { max-width: 48px; border-radius: 6px; }
  .lifecycle-portal .bar-label { font-size: 12px; }
  .lifecycle-portal .donut-wrap { height: 270px; gap: 12px; }
  .lifecycle-portal .donut { width: 172px; height: 172px; }
  .lifecycle-portal .donut::before { inset: 20px; }
  .lifecycle-portal .donut-center strong { font-size: 30px; }
  .lifecycle-portal .donut-legend p { font-size: 12px; }
  .lifecycle-portal .donut-legend b { font-size: 20px; }
  .lifecycle-portal .grid-2 { gap: 14px; }
  .lifecycle-portal .grid-2 .card-head { padding: 8px 12px; }
  .lifecycle-portal .grid-2 .card-body { padding: 10px 12px; }
  .lifecycle-portal .grid-2 > .card:last-child { display: flex; flex-direction: column; }
  .lifecycle-portal .grid-2 > .card:last-child .card-body { display: flex; flex: 1 1 auto; }
  .lifecycle-portal .stage-row { padding: 12px 0; }
  .lifecycle-portal .stage-index { width: 30px; height: 30px; font-size: 13px; }
  .lifecycle-portal .stage-row > div > strong { font-size: 15px; }
  .lifecycle-portal .stage-row > div > span { font-size: 12px; }
  .lifecycle-portal .stage-bar { height: 4px; margin-top: 3px; }
  .lifecycle-portal .quick-list { flex: 1 1 auto; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .lifecycle-portal .quick-action { min-height: 0; padding: 0 14px; }
  .lifecycle-portal .quick-action span { font-size: 14px; }
  .lifecycle-portal .p-rail { width: 58px; }
  .lifecycle-portal .p-rail-btn { min-width: 58px; height: 43px; }
}

