/* =====================================================================
   内蒙古电力（集团）有限责任公司 全税种管理平台 —— 乐企申报平台
   前端样式表  web/css/app.css

   ⚠ 本文件**不定义任何配色变量** —— 配色是主题的一部分，唯一事实来源是
     web/css/themes.css（:root 兜底 = ink 深蓝政企，另有 3 套 html[data-theme]）。
     本文件只保留与皮肤无关的几何量、字号与字体栈。
     新写样式一律用 var(--c-*) 取值，禁止写死颜色，否则暗色主题（night）上会
     出现"深色补丁"：不报错、不崩溃，最难查。
     由 _extract/check-themes.js 做源码级断言（app.css 内不得出现硬编码颜色）。
   ===================================================================== */

:root {
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .04);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .1);
  --header-h: 56px;
  --sider-w: 224px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--c-scroll); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-border-2); }
::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
   登录页
   版面：左侧品牌与能力展示（.login-hero）+ 右侧登录卡（.login-box），
        登录卡在右列垂直居中。本页不放风格选择器。

   ⚠ 本段（.login-art / .login-hero 区间）压在**写死的深色美术渐变**上，
     文字必须用**固定浅色**，不得引用 var(--c-text*)：那些变量在浅色主题下是深色，
     压上去就是 1.1:1，字看不见。四套主题的 --login-bg 均为深色（由门禁断言）。
     区间内也不要写 `color:var(--…)` —— _extract/check-themes.js 会做区间断言，
     该断言对动态生成的兄弟节点天然免疫。
   ===================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--login-bg);
  padding: 30px 24px;
  position: relative; overflow: hidden;
}

/* ---- 科技感底纹：网格 + 光晕 + 电流网络（纯装饰，不参与命中测试） ---- */
.login-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: var(--login-art-op); }
.login-art .grid-lines {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 88% 74% at 32% 46%, #000 42%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 88% 74% at 32% 46%, #000 42%, transparent 100%);
}
.login-art .glow-a,
.login-art .glow-b {
  position: absolute; border-radius: 50%; filter: blur(6px);
}
.login-art .glow-a {
  width: 680px; height: 680px; left: -210px; top: -180px;
  background: radial-gradient(circle, rgba(120, 180, 255, .40) 0%, rgba(120, 180, 255, 0) 68%);
}
.login-art .glow-b {
  width: 760px; height: 760px; right: -230px; bottom: -300px;
  background: radial-gradient(circle, rgba(var(--accentRGB), .55) 0%, rgba(var(--accentRGB), 0) 70%);
}
.login-art .wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 240px; }

/* ---- 两栏舞台（网格区域，便于窄屏重排顺序） ----
   桌面：左列 = 品牌 hero / 能力 caps / 演示账号 accs，右列 = 登录卡 box。
   窄屏：单列，顺序改为 品牌 → 登录卡 → 演示账号 → 能力 —— 手机上先看到登录表单，
        而不是滚过 1000px 的品牌区才够得着输入框。 */
.login-stage {
  position: relative; z-index: 2;
  width: 100%; max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-areas:
    'hero box'
    'caps box'
    'accs box';
  column-gap: 44px; row-gap: 16px;
  align-items: start;
}

/* ---- 左：品牌与能力 ---- */
.login-hero { grid-area: hero; color: #fff; min-width: 0; }
.login-caps { grid-area: caps; min-width: 0; }
.hero-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.hero-mark {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 10px;
  background: rgba(0, 0, 0, .38);
  border: 1px solid rgba(255, 255, 255, .30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: -.5px;
  color: #fff; backdrop-filter: blur(4px);
}
.hero-org { font-size: 13.5px; letter-spacing: 1.4px; color: rgba(255, 255, 255, .90); }
.hero-title {
  margin: 0; font-size: 40px; line-height: 1.14; font-weight: 700;
  letter-spacing: 3px; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .26);
}
.hero-title .en {
  display: block; margin-top: 9px;
  font-size: 11.5px; font-weight: 400; letter-spacing: 2.6px;
  color: rgba(255, 255, 255, .80); text-transform: uppercase;
}
.hero-sub {
  margin: 14px 0 0; font-size: 13.5px; line-height: 1.7; color: rgba(255, 255, 255, .90);
}
.hero-sub .sep { margin: 0 8px; color: rgba(255, 255, 255, .5); }
.hero-rule {
  margin: 20px 0 0; width: 62px; height: 3px; border-radius: 2px;
  background: rgba(255, 255, 255, .62);
}

/* 能力卡：玻璃拟态，压在深色渐变上 */
.hero-feats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;   /* 同行能力卡等高，避免"第一行高、第二行矮"的参差感 */
  gap: 10px;
}
.hero-feats li {
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
  border-radius: 8px; padding: 11px 12px 12px;
  min-width: 0; backdrop-filter: blur(3px);
  transition: background .2s, transform .2s, border-color .2s;
}
.hero-feats li:hover {
  background: rgba(0, 0, 0, .46);
  border-color: rgba(255, 255, 255, .42);
  transform: translateY(-2px);
}
.hero-feats .hi {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; margin-bottom: 8px;
  /* 深底 + 强调色描边：--accentRGB 在 night 主题下是亮蓝，直接当底会把白字压到 3.5:1 */
  background: rgba(0, 0, 0, .58);
  box-shadow: inset 0 0 0 1px rgba(var(--accentRGB), .95), 0 0 10px rgba(var(--accentRGB), .30);
  font-size: 12px; color: #fff;
}
.hero-feats b { display: block; font-size: 13px; font-weight: 600; color: #fff; letter-spacing: .3px; }
.hero-feats i {
  display: block; margin-top: 4px; font-style: normal;
  font-size: 11.5px; line-height: 1.55; color: rgba(255, 255, 255, .82);
}

/* ---- 演示账号面板（左侧，玻璃拟态；点击任一账号一键登录） ---- */
.hero-acc {
  grid-area: accs;
  margin-top: 2px; padding: 13px 14px 14px; border-radius: 10px;
  background: rgba(0, 0, 0, .40);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
  backdrop-filter: blur(3px);
}
.hero-acc-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.hero-acc-head b { font-size: 12.5px; font-weight: 600; color: #fff; letter-spacing: .6px; }
.hero-acc-head span { font-size: 11px; color: rgba(255, 255, 255, .82); }
.hero-acc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.hero-acc-item {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 7px 9px 8px; border-radius: 7px; cursor: pointer; text-align: left;
  font-family: var(--font);
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  transition: background .15s, border-color .15s, transform .12s;
}
.hero-acc-item:hover {
  background: rgba(0, 0, 0, .52);
  border-color: rgba(255, 255, 255, .5);
  transform: translateY(-1px);
}
.hero-acc-item:disabled { opacity: .55; cursor: progress; }
.hero-acc-item.busy { border-color: rgba(255, 255, 255, .6); }
.hero-acc-item .ha-role {
  font-size: 12px; font-weight: 600; color: #fff; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-acc-item .ha-org {
  font-size: 11px; color: rgba(255, 255, 255, .84);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-acc-item .ha-code {
  font-family: var(--font-mono); font-size: 10px; line-height: 14px;
  color: rgba(255, 255, 255, .80);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 电流脉冲：沿路径跑一段亮线（尊重"减少动效"偏好） */
.art-pulse { animation: artPulse 4.6s linear infinite; }
@keyframes artPulse {
  from { stroke-dashoffset: 590; }
  to { stroke-dashoffset: -590; }
}
@media (prefers-reduced-motion: reduce) {
  .art-pulse { animation: none; stroke-opacity: .35; }
}

/* ---- 右：登录卡 ---- */
.login-box {
  grid-area: box;
  /* 右列垂直居中：登录卡在「品牌 + 能力 + 演示账号」的总高度区间内居中，
     也就是视觉上的"居于右侧中央"。网格容器的 align-items 是 start（左列必须顶对齐），
     所以这里用 align-self 单独接管右列。 */
  align-self: center;
  width: 100%;
  background: var(--c-white);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .3);
  padding: 30px 30px 24px;
  border: 1px solid var(--c-border);
}
.login-box-head { margin-bottom: 20px; }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.login-logo .mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 9px;
  background: var(--btnGrad);
  color: var(--onAccent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; letter-spacing: -.5px;
}
.login-title { font-size: 18px; font-weight: 600; letter-spacing: .3px; color: var(--c-text); }
.login-sub { font-size: 11.5px; color: var(--c-text-3); margin-top: 2px; }
.login-flag {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--c-border);
}
.login-flag .tag { font-size: 11px; }

.login-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-border);
  font-size: 11.5px; color: var(--c-text-3); line-height: 1.7; text-align: center;
}

/* 登录页不放风格选择器（见 app.js 的 renderLogin 注释）：
   换肤入口是登录后顶栏下拉 + 全局 Alt+T，因此这里也没有 "bar" 形态的样式了。 */

/* ---------------------------------------------------------------------------
 * 美术底上的「玻璃」一律用**黑**玻璃，不用白玻璃。
 * 白玻璃（rgba(255,255,255,.07)）会把底色提亮 13% 以上，压在上面的浅色文字
 * 再怎么调 alpha 也够不到 4.5:1 —— 实测 .ha-org 提到 .9 也只有 4.4:1。
 * 黑玻璃同时把底色压暗、层次感和对比度一起拿到，是这类深色美术底的标准做法。
 * ------------------------------------------------------------------------- */
/* 风格选择器：list（顶栏下拉）。card（列式带说明）保留给将来的"外观设置"页备用。
   bar（登录页浮动横排）形态已随登录页改造移除。 */
.thm-switch { display: flex; }
.thm-switch-card { flex-direction: column; gap: 6px; }
.thm-switch-list { flex-direction: column; gap: 2px; min-width: 196px; }
.thm-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font); border: 1px solid transparent; background: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
/* card / list 形态放在主题表面上 → 用主题变量 */
.thm-switch-card .thm-item,
.thm-switch-list .thm-item {
  padding: 7px 9px; border-radius: var(--radius-sm); color: var(--c-text-2);
  border-color: var(--c-border);
}
.thm-switch-card .thm-item { background: var(--c-white); }
.thm-switch-list .thm-item { border-color: transparent; }
.thm-switch-card .thm-item:hover,
.thm-switch-list .thm-item:hover { background: var(--c-bg-2); border-color: var(--c-border-2); color: var(--c-text); }
.thm-switch-card .thm-item.on { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-text); }
.thm-switch-list .thm-item.on { background: var(--c-primary-light); color: var(--c-primary); font-weight: 600; }

.thm-dot { display: inline-flex; flex: 0 0 auto; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12) inset; }
.thm-dot i { display: block; width: 7px; height: 16px; }
.thm-switch-list .thm-dot i { height: 14px; width: 6px; }
.thm-txt { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; text-align: left; }
.thm-name { font-size: 12.5px; font-weight: 500; line-height: 1.35; white-space: nowrap; }
.thm-desc { font-size: 11px; color: var(--c-text-3); line-height: 1.4; margin-top: 1px; }
.thm-tag {
  flex: 0 0 auto; font-size: 10.5px; padding: 0 5px; line-height: 15px; border-radius: 8px;
  background: var(--c-bg); color: var(--c-text-3);
}
.thm-ck { flex: 0 0 auto; font-size: 12px; color: var(--c-primary); opacity: 0; }
.thm-item.on .thm-ck { opacity: 1; }

/* 顶栏风格入口 */
.header-thm {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 3px 9px; border-radius: 13px; border: 1px solid var(--c-border);
  font-size: 12px; color: var(--c-text-2); transition: border-color .15s, color .15s;
}
.header-thm:hover { border-color: var(--c-primary); color: var(--c-primary); }
.header-thm .thm-dot i { height: 12px; width: 5px; }

@media (max-width: 1080px) {
  /* 单栏堆叠：左右两栏合成一列，居中限宽，避免 1024 档出现大片留白 */
  .login-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'hero' 'box' 'accs' 'caps';
    row-gap: 20px; max-width: 820px;
  }
  .login-hero { width: 100%; max-width: 760px; margin: 0 auto; }
  .login-box { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 620px) {
  .login-wrap { padding: 62px 16px 24px; align-items: flex-start; }
  .login-stage { gap: 20px; }
  .hero-title { font-size: 27px; letter-spacing: 2px; }
  .hero-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero-feats i { display: none; }
  .hero-acc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-box { padding: 22px 18px 18px; max-width: none; }
}
/* 窄手机：演示账号改单列 —— 双列时 320px 宽度下角色/单位/账号码会被省略号截断 */
@media (max-width: 480px) {
  .hero-acc-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-acc-item .ha-role { font-size: 12.5px; }
  .hero-acc-item .ha-org, .hero-acc-item .ha-code { font-size: 11px; }
  .hero-acc-item .ha-code { line-height: 15px; }
}
/* 矮屏（1366×768 一类）：压缩纵向留白，避免出现纵向滚动条 */
@media (max-height: 820px) and (min-width: 1081px) {
  .login-wrap { padding: 20px 24px; }
  .hero-title { font-size: 34px; }
  .hero-brand { margin-bottom: 12px; }
  .hero-rule { margin: 14px 0 0; }
  .hero-sub { margin-top: 10px; font-size: 13px; }
  .hero-feats li { padding: 9px 10px 10px; }
  .hero-feats .hi { margin-bottom: 6px; }
  .login-stage { row-gap: 13px; }
  .login-box { padding: 22px 24px 18px; }
  .login-box-head { margin-bottom: 14px; }
  .login-logo { margin-bottom: 9px; }
  .login-foot { margin-top: 10px; padding-top: 9px; }
}
/* 更矮（1280×720 一类）：再压一档，能力说明文字仍然保留。
   边界从 665 提到 730：665~730 这段以前落在上面那档里，压缩量不够，
   实测视口 713px 高时纵向多出 7px（登录卡下沿被切）。 */
@media (max-height: 730px) and (min-width: 1081px) {
  .login-wrap { padding: 16px 24px; }
  .hero-brand { margin-bottom: 9px; }
  .hero-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .hero-title { font-size: 29px; letter-spacing: 2.2px; }
  .hero-title .en { margin-top: 6px; }
  .hero-sub { margin-top: 8px; font-size: 12.5px; }
  .hero-rule { margin: 10px 0 0; }
  .hero-feats { gap: 8px; }
  .hero-feats li { padding: 7px 9px 8px; }
  .hero-feats .hi { width: 19px; height: 19px; margin-bottom: 5px; font-size: 11px; }
  .login-stage { row-gap: 11px; }
  .hero-acc { padding: 9px 10px 10px; }
  .hero-acc-head { margin-bottom: 7px; }
  .hero-acc-grid { gap: 5px; }
  .hero-acc-item { padding: 5px 8px 6px; }
  .hero-acc-item .ha-code { font-size: 9.5px; line-height: 13px; }
  .login-box { padding: 18px 20px 15px; }
  .login-box-head { margin-bottom: 12px; }
  .login-logo .mark { width: 32px; height: 32px; flex-basis: 32px; }
  .login-title { font-size: 16.5px; }
  .login-flag { margin-bottom: 12px; padding-bottom: 11px; }
}
/* 极矮（1280×720 一类，可用高度不足 620px）：去掉英文副标题与部分留白，
   保证「能力说明 + 7 个演示账号」仍然一次性全部落在首屏内 */
@media (max-height: 620px) and (min-width: 1081px) {
  .hero-title { font-size: 26px; }
  .hero-title .en { display: none; }
  .hero-sub { font-size: 12px; }
  .hero-rule { margin: 8px 0 0; height: 2px; }
  .hero-feats li { padding: 6px 8px 6px; }
  .hero-feats b { font-size: 12.5px; }
  .hero-feats i { font-size: 11px; line-height: 1.5; }
  .login-stage { row-gap: 9px; }
  .hero-acc { padding: 7px 9px 8px; }
  .hero-acc-head { margin-bottom: 5px; }
  .hero-acc-item { padding: 4px 8px 5px; }
  .hero-acc-item .ha-role { font-size: 11.5px; }
  .hero-acc-item .ha-org { font-size: 10.5px; }
  .hero-acc-item .ha-code { font-size: 9px; line-height: 12px; }
  .login-box { padding: 16px 20px 13px; }
  .login-box-head { margin-bottom: 10px; }
  .login-flag { margin-bottom: 10px; padding-bottom: 9px; }
}

/* ---------------- 主框架 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sider {
  width: var(--sider-w); flex: 0 0 var(--sider-w);
  background: var(--sider-bg); color: var(--sider-text);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
}
.sider-brand {
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--sider-border);
  flex: 0 0 var(--header-h);
}
.sider-brand .mark {
  width: 28px; height: 28px; border-radius: 6px; flex: 0 0 28px;
  background: var(--sider-mark-grad);
  /* 压在饱和品牌渐变上的文字：用 --onAccent（暗色主题下渐变是亮蓝，白字只有 2.5:1） */
  color: var(--onAccent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.sider-brand .t1 { font-size: 14px; font-weight: 600; color: var(--sider-text-strong); letter-spacing: .2px; }
.sider-brand .t2 { font-size: 11px; color: var(--sider-text-2); }

.nav { flex: 1; overflow-y: auto; padding: 10px 0 24px; }
.nav-group { margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; font-size: 13.5px; color: var(--sider-text);
  cursor: pointer; user-select: none; border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(var(--hlRGB), .06); color: var(--sider-text-strong); }
.nav-item.active {
  background: rgba(var(--accentRGB), .22); color: var(--sider-text-strong);
  border-left-color: var(--c-primary); font-weight: 500;
}
.nav-item .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; }
.nav-parent {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 6px; font-size: 11.5px; color: var(--sider-text-3);
  letter-spacing: .6px; text-transform: uppercase;
}
.nav-children { overflow: hidden; }

.main {
  flex: 1; margin-left: var(--sider-w); display: flex; flex-direction: column;
  min-width: 0;
}
.header {
  height: var(--header-h); background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 0 20px; position: sticky; top: 0; z-index: 15;
}
/* 面包屑是"可牺牲"的一侧：允许它被压缩并截断 */
.breadcrumb {
  font-size: 13px; color: var(--c-text-3);
  display: flex; align-items: center; gap: 6px;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.breadcrumb .cur { color: var(--c-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
/* 顶栏右侧是"必须能点"的一侧：绝不收缩、绝不换行。
   少了 white-space:nowrap，390px 窄屏下每个字各占一行，顶栏会变成 3 倍高的竖排文字墙。 */
.header-right {
  display: flex; align-items: center; gap: 16px; font-size: 13px;
  flex: 0 0 auto; white-space: nowrap;
}
.header-org {
  color: var(--c-text-3);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.header-user { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }

/* 窄屏顶栏：按"锦上添花 → 无关紧要"的顺序依次丢掉信息，
   保住三样必须能点的：风格入口、用户头像、退出菜单。 */
@media (max-width: 1080px) {
  .header { padding: 0 12px; gap: 8px; }
  .header-right { gap: 10px; }
  .header-org { max-width: 150px; }
}
@media (max-width: 760px) {
  /* 单位全称与环境徽标最先丢：它们在登录后的欢迎语/个人中心里都能看到 */
  .header-org, .env-badge { display: none; }
}
@media (max-width: 520px) {
  /* 面包屑最后丢：手机上顶栏只留风格入口 + 头像 */
  .breadcrumb { display: none; }
  .header-right { margin-left: auto; }
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  /* 实心头像：--c-primary 上配 --onAccent，浅色/暗色主题都达标（5.2:1 / 7.5:1） */
  background: var(--c-primary); color: var(--onAccent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.env-badge {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: var(--c-warning-light); color: var(--c-warning-dark); font-weight: 500;
}
.dropdown {
  position: absolute; right: 0; top: 38px; min-width: 150px;
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 5px; z-index: 40;
}
.dropdown div {
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  color: var(--c-text-2);
}
.dropdown div:hover { background: var(--c-bg-2); color: var(--c-text); }

.content { padding: 16px 20px 40px; flex: 1; min-width: 0; }

/* ---------------- 卡片 / 区块 ---------------- */
.card {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-1); margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--c-border); gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .bar { width: 3px; height: 14px; border-radius: 2px; background: var(--c-primary); }
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--c-text-3); }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
  background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 60px; height: 60px; border-radius: 50%; background: var(--c-primary-light); opacity: .55;
}
.stat .label { font-size: 12.5px; color: var(--c-text-3); margin-bottom: 8px; }
.stat .value { font-size: 24px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 12px; font-weight: 400; color: var(--c-text-3); margin-left: 4px; }
.stat .foot { font-size: 12px; color: var(--c-text-3); margin-top: 6px; }
.stat.s-blue .value { color: var(--c-primary); }
.stat.s-green .value { color: var(--c-success-dark); }
.stat.s-orange .value { color: var(--c-warning-dark); }
.stat.s-red .value { color: var(--c-danger-dark); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; padding: 0 13px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  background: var(--c-white); color: var(--c-text-2); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--c-border-2); color: var(--c-text-2); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--onAccent); }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: var(--onAccent); }
/* 实心填充用 -dark 档：白字压 --c-success 只有 3.1:1，达不到 AA */
.btn-success { background: var(--c-success-dark); border-color: var(--c-success-dark); color: var(--onAccent); }
/* 悬停用内阴影压暗填充：文字色保持不变，对比度只升不降 */
.btn-success:hover { background: var(--c-success-dark); border-color: var(--c-success); box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .12); }
.btn-danger { background: var(--c-danger-dark); border-color: var(--c-danger-dark); color: var(--onAccent); }
.btn-danger:hover { background: var(--c-danger-dark); border-color: var(--c-danger); box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .12); }
.btn-text { border-color: transparent; background: transparent; padding: 0 6px; height: auto; }
.btn-text:hover { border-color: transparent; background: var(--c-primary-light); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; color: var(--c-text-2); }
.field.required > label::after { content: ' *'; color: var(--c-danger-dark); }
.input, .select, .textarea {
  height: 30px; padding: 0 9px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  background: var(--c-white); color: var(--c-text); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 7px 9px; min-height: 68px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-focus-ring);
}
.input[readonly] { background: var(--c-bg-2); color: var(--c-text-2); }
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.filter-bar .field { min-width: 132px; }
.filter-bar .field.grow { flex: 1; min-width: 180px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  background: var(--c-bg-2); color: var(--c-text-2); font-weight: 600;
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--c-border);
  white-space: nowrap; font-size: 12.5px;
}
table.tb td {
  padding: 9px 12px; border-bottom: 1px solid var(--c-border);
  color: var(--c-text); vertical-align: middle;
}
table.tb tbody tr:hover { background: var(--c-row-hover); }
table.tb td.num, table.tb th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb td.mono, table.tb th.mono { font-family: var(--font-mono); font-size: 12.5px; }
table.tb td.nowrap, table.tb th.nowrap { white-space: nowrap; }
table.tb .empty { text-align: center; color: var(--c-text-3); padding: 34px 0; }

/* 长文本列：允许折行，避免"内容被挤成一条"或反过来把表格撑到天文宽度 */
table.tb td.wrap-cell { white-space: normal; word-break: break-word; max-width: 260px; }

/* 操作列：按钮组不换行 + 右侧吸附。
   修复两个系统性问题：
   ① 操作列被压到 69px 宽时 .btn-group{flex-wrap:wrap} 会把 5 个按钮折成 5 行 → 行高 157px；
   ② 宽表横向滚动时操作按钮滚出可视区，用户看不到"提交/作废/详情"（被裁切）。 */
table.tb th.act, table.tb td.act {
  white-space: nowrap;
  position: sticky; right: 0; z-index: 1;
  background: var(--c-white);
  box-shadow: inset 1px 0 0 var(--c-border);
}
table.tb th.act { background: var(--c-bg-2); z-index: 2; }
table.tb tbody tr:hover > td.act { background: var(--c-row-hover); }
table.tb td.act .btn-group { flex-wrap: nowrap; gap: 2px; }
/* 演示数据行的橙底要在吸附列上保持同色，否则右侧会出现一条白缝 */
table.tb tbody tr.demo-row > td.act { background: var(--c-demo-row); }
table.tb tbody tr.demo-row:hover > td.act { background: var(--c-demo-row-hover); }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 3px; font-size: 12px; line-height: 18px;
  border: 1px solid transparent; white-space: nowrap;
}
/* 浅底药丸：文字一律取「-dark」档。
   基色档（--c-success / --c-warning / --c-danger / --c-info）压在自家 -light 底上
   只有 2.6~3.6:1，11px 小字读不清；-dark 档在 5:1 以上（check-themes.js 4.11 守住）。 */
.tag-blue { background: var(--c-primary-light); color: var(--c-primary); }
.tag-green { background: var(--c-success-light); color: var(--c-success-dark); }
.tag-orange { background: var(--c-warning-light); color: var(--c-warning-dark); }
.tag-red { background: var(--c-danger-light); color: var(--c-danger-dark); }
.tag-gray { background: var(--c-bg-2); color: var(--c-text-2); border-color: var(--c-border); }
.tag-cyan { background: var(--c-info-light); color: var(--c-info-dark); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; font-size: 13px; color: var(--c-text-2); flex-wrap: wrap;
}
.pager .total { margin-right: auto; color: var(--c-text-3); font-size: 12.5px; }
.pager .pg {
  min-width: 28px; height: 28px; padding: 0 7px; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm); background: var(--c-white); cursor: pointer; font-size: 13px;
}
.pager .pg:hover:not(.disabled):not(.active) { border-color: var(--c-primary); color: var(--c-primary); }
.pager .pg.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--onAccent); }
.pager .pg.disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: var(--c-mask);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 60px 20px 20px; overflow-y: auto;
}
.modal {
  background: var(--c-white); border-radius: 8px; box-shadow: var(--shadow-2);
  width: 100%; max-width: 620px; animation: pop .16s ease-out;
}
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1200px; }
@keyframes pop { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--c-border);
}
.modal-head .t { font-size: 15px; font-weight: 600; }
.modal-head .x {
  width: 26px; height: 26px; border-radius: var(--radius-sm); border: none;
  background: transparent; cursor: pointer; color: var(--c-text-3); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.modal-head .x:hover { background: var(--c-bg-2); color: var(--c-text); }
.modal-body { padding: 18px; max-height: 62vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--c-border);
}

/* 表单栅格 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-full { grid-column: 1 / -1; }

/* 栅格 / 弹性布局中的内容列必须允许收缩到小于内容宽度，
   否则内部一张宽表会把栅格轨道顶宽，最终把整个页面撑出横向滚动条
   （实测 /master/org：html.scrollWidth 2577 > clientWidth 1440）。 */
.grid2 > *, .grid3 > *, .layout > *, .form-layout > * { min-width: 0; }
/* 卡片自身也要可收缩，避免作为栅格项时被内容顶开 */
.card { min-width: 0; }
/* 页面级两栏布局（如组织树 + 内容区）统一用这个类，替代内联 grid。
   第二列用 minmax(0,1fr) 而不是 1fr：1fr 的自动最小尺寸是 min-content，
   内部一张宽表会把这个轨道顶到 2333px，最终把整页撑出横向滚动条。 */
.split-2 { display: grid; grid-template-columns: var(--c1, 300px) minmax(0, 1fr); gap: 14px; align-items: start; }
.split-2 > * { min-width: 0; }
@media (max-width: 1080px) {
  .split-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------- 提示 ---------------- */
.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 9px 16px; border-radius: var(--radius); font-size: 13px;
  box-shadow: var(--shadow-2); background: var(--c-white);
  border-left: 3px solid var(--c-info); max-width: 560px; line-height: 1.6;
  animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-left-color: var(--c-success); }
.toast.error { border-left-color: var(--c-danger); }
.toast.warning { border-left-color: var(--c-warning); }

.alert {
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px;
  line-height: 1.7; margin-bottom: 12px;
}
.alert-info { background: var(--c-info-light); color: var(--c-alert-info-fg); }
.alert-warn { background: var(--c-warning-light); color: var(--c-alert-warn-fg); }
.alert-error { background: var(--c-danger-light); color: var(--c-alert-error-fg); }
.alert-success { background: var(--c-success-light); color: var(--c-alert-success-fg); }

.loading { padding: 40px; text-align: center; color: var(--c-text-3); font-size: 13px; }
.loading .sp {
  display: inline-block; width: 18px; height: 18px; border: 2px solid var(--c-border);
  border-top-color: var(--c-primary); border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -3px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.blank { padding: 40px; text-align: center; color: var(--c-text-3); font-size: 13px; }

/* ---------------- 进度条 ---------------- */
.bar-track {
  height: 6px; background: var(--c-bg); border-radius: 3px; overflow: hidden; min-width: 60px;
}
.bar-fill { height: 100%; background: var(--c-primary); border-radius: 3px; transition: width .3s; }
.bar-fill.ok { background: var(--c-success); }
.bar-fill.warn { background: var(--c-warning); }
.bar-fill.bad { background: var(--c-danger); }

/* ---------------- 简易图表（纯 CSS/SVG） ---------------- */
.chart-row { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 8px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.chart-col .bar2 {
  width: 100%; max-width: 34px; background: var(--c-primary); border-radius: 3px 3px 0 0;
  transition: height .4s; min-height: 2px;
}
.chart-col .bar2.ok { background: var(--c-success); }
.chart-col .lbl { font-size: 11px; color: var(--c-text-3); white-space: nowrap; }
.chart-col .vv { font-size: 11px; color: var(--c-text-2); font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--c-text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------- 申报表节点树 ---------------- */
.form-layout { display: grid; grid-template-columns: 236px 1fr; gap: 0; align-items: stretch; }
.node-tree {
  border-right: 1px solid var(--c-border); padding: 8px 0; max-height: 620px; overflow-y: auto;
}
.node-item {
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--c-text-2);
  border-left: 3px solid transparent; display: flex; justify-content: space-between; gap: 6px;
}
.node-item:hover { background: var(--c-bg-2); }
.node-item.active { background: var(--c-primary-light); color: var(--c-primary); border-left-color: var(--c-primary); font-weight: 500; }
.node-item .cnt { font-size: 11.5px; color: var(--c-text-3); }
.field-cell input {
  width: 100%; height: 26px; padding: 0 7px; border: 1px solid transparent;
  background: transparent; font-size: 13px; text-align: right; border-radius: 3px;
  font-variant-numeric: tabular-nums; font-family: var(--font); color: var(--c-text);
}
.field-cell input:hover { border-color: var(--c-border-2); background: var(--c-white); }
.field-cell input:focus {
  border-color: var(--c-primary); background: var(--c-white);
  box-shadow: 0 0 0 2px var(--c-focus-ring); outline: none;
}
.field-cell input.modified { background: var(--c-modified-bg); border-color: var(--c-modified-border); }

/* ---------------- 时间轴 ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 2px; background: var(--c-border);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item .dot2 {
  position: absolute; left: -22px; top: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--c-white); border: 2px solid var(--c-primary);
}
.tl-item.ok .dot2 { border-color: var(--c-success); }
.tl-item.bad .dot2 { border-color: var(--c-danger); }
.tl-item .n { font-size: 13.5px; font-weight: 500; }
.tl-item .t { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }
.tl-item .d { font-size: 12.5px; color: var(--c-text-2); margin-top: 3px; line-height: 1.6; }

/* ---------------- 描述列表 ---------------- */
.desc { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.desc .it { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.desc .it .k { font-size: 12px; color: var(--c-text-3); }
.desc .it .v { font-size: 13px; color: var(--c-text); word-break: break-all; }

/* ---------------- 代码块 ---------------- */
pre.code {
  background: var(--c-bg-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
  max-height: 340px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all;
  color: var(--c-code-text);
}

/* ---------------- 复选框 ---------------- */
.cb { width: 14px; height: 14px; cursor: pointer; accent-color: var(--c-primary); vertical-align: -2px; }

/* ---------------- 分组标题 ---------------- */
.sec-title {
  font-size: 13px; font-weight: 600; color: var(--c-text);
  padding: 4px 0 10px; display: flex; align-items: center; gap: 8px;
}
.sec-title::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: var(--c-primary); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .form-layout { grid-template-columns: 1fr; }
  .node-tree { border-right: none; border-bottom: 1px solid var(--c-border); max-height: 200px; }
}
@media (max-width: 900px) {
  :root { --sider-w: 0px; }
  .sider { transform: translateX(-100%); transition: transform .2s; width: 224px; }
  .sider.open { transform: none; }
  .main { margin-left: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .content { padding: 12px; }
}

/* =====================================================================
   演示（模拟）数据标识
   需求：开发系统中演示数据用突出颜色标记，并注明。
   橙色 #ed7b2f = 演示业务源数据；红色 #e34d59 = 由演示数据生成的平台单据。
   ===================================================================== */

/* ---- 全局常驻提示条 ---- */
.demo-banner-holder { flex: 0 0 auto; }
.demo-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px 0; padding: 8px 14px;
  background: var(--c-demo-banner-bg);
  border: 1px solid var(--c-demo-banner-border); border-left: 4px solid var(--c-warning);
  border-radius: var(--radius); cursor: pointer;
  font-size: 12.5px; color: var(--c-demo-banner-fg); line-height: 1.65;
  transition: box-shadow .15s, background .15s;
}
.demo-banner:hover { box-shadow: var(--shadow-1); background: var(--c-demo-banner-bg-hover); }
.demo-banner-ico {
  flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-warning-dark); color: var(--onAccent); font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.demo-banner-text { flex: 1 1 auto; }
.demo-banner-more {
  flex: 0 0 auto; color: var(--c-warning-dark); font-weight: 600; white-space: nowrap;
}
@media (max-width: 900px) {
  .demo-banner { margin: 8px 12px 0; font-size: 12px; }
  .demo-banner-more { display: none; }
}

/* ---- 行级角标与行高亮 ---- */
.demo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 9px;
  color: var(--onAccent); font-size: 11px; line-height: 16px; white-space: nowrap;
  font-weight: 500;
}
.demo-badge .demo-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--onAccent); opacity: .9;
}
.tb tbody tr.demo-row > td { background: var(--c-demo-row); }
.tb tbody tr.demo-row > td:first-child { box-shadow: inset 3px 0 0 var(--c-warning); }
.tb tbody tr.demo-row:hover > td { background: var(--c-demo-row-hover); }

/* ---- 明细弹窗 ---- */
.demo-legend { display: flex; flex-wrap: wrap; gap: 22px; margin: 0 0 14px; }
.demo-legend-item { display: flex; align-items: flex-start; gap: 8px; }
.demo-swatch {
  flex: 0 0 14px; width: 14px; height: 14px; border-radius: 3px; margin-top: 3px;
}
.demo-legend-label { font-size: 13px; font-weight: 600; line-height: 1.5; }
.demo-legend-desc { font-size: 12px; color: var(--c-text-3); line-height: 1.5; }
.demo-sec-title {
  margin: 16px 0 8px; padding-left: 8px;
  border-left: 3px solid var(--c-primary);
  font-size: 13.5px; font-weight: 600; color: var(--c-text);
}
.demo-note {
  margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--c-bg-2); border: 1px dashed var(--c-border-2);
  font-size: 12.5px; color: var(--c-text-2); line-height: 1.8;
}
.demo-note b { color: var(--c-text); margin-right: 4px; }
