/* =========================================================
   合同电子存档 — iOS 风格 UI (v3 · 极致打磨版)

   设计原则
   - 层次感胜过装饰:灰度+透明层构建空间感,彩色克制
   - 控件统一圆角与阴影梯度 sm<md<lg<xl
   - 动效只做一件事:入场、hover 轻浮起、active 回弹
   - 登录页改为深沉午夜蓝,避免过度鲜艳
   ========================================================= */

/* ========= 基础变量 ========= */
:root {
  /* 主色:更稳重的深钢蓝,替换明亮 iOS Blue */
  --primary:   #1e5fa8;
  --primary-d: #144478;
  --primary-l: rgba(30, 95, 168, .10);

  /* 辅色:统一加深,去掉糖果感 */
  --success:   #2a8a4a;
  --warning:   #c47a08;
  --danger:    #c8342b;
  --purple:    #6b3a9e;
  --indigo:    #3d3f8f;
  --teal:      #1e7a99;

  /* 文本(iOS label 体系) */
  --text:         #1c1c1e;
  --text-s:       #3a3a3c;
  --text-m:       rgba(60, 60, 67, .62);
  --text-l:       rgba(60, 60, 67, .32);
  --text-inverse: #f5f5f7;

  /* 玻璃层 */
  --glass:         rgba(255, 255, 255, .62);
  --glass-strong:  rgba(255, 255, 255, .82);
  --glass-border:  rgba(255, 255, 255, .68);
  --glass-inset:   inset 0 1px 0 rgba(255, 255, 255, .55);

  /* 填充/边界 */
  --fill-1:   rgba(120, 120, 128, .06);
  --fill-2:   rgba(120, 120, 128, .10);
  --fill-3:   rgba(120, 120, 128, .16);
  --border:   rgba(60, 60, 67, .10);
  --separator: rgba(60, 60, 67, .06);
  --card:     rgba(255, 255, 255, .72);

  /* 圆角梯度 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 30px;
  --r-pill: 980px;

  /* 阴影梯度(更近自然光) */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .04), 0 0 0 .5px rgba(16, 24, 40, .04);
  --sh-2: 0 4px 12px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-3: 0 12px 32px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .04);
  --sh-4: 0 24px 64px rgba(16, 24, 40, .14), 0 4px 10px rgba(16, 24, 40, .04);

  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text); font-size: 14px; line-height: 1.55;
  letter-spacing: -.005em;

  /* 极克制的浅灰背景 + 若隐若现的深色光 */
  background:
    radial-gradient(1400px 900px at -5% -10%, rgba(30, 95, 168, .08), transparent 55%),
    radial-gradient(1200px 800px at 110% 10%, rgba(61, 63, 143, .06), transparent 55%),
    radial-gradient(1000px 700px at 50% 120%, rgba(30, 122, 153, .05), transparent 55%),
    linear-gradient(180deg, #eef1f6 0%, #e4e8ef 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: opacity .2s var(--ease); }
a:hover { opacity: .75; }

h1 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; margin: 0; }
h2 { font-size: 26px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.025em; }
h3 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.01em; }

code {
  background: var(--primary-l); color: var(--primary-d);
  padding: 2px 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

::selection { background: rgba(30, 95, 168, .22); }

/* ========= 布局 ========= */
.app {
  display: flex;
  min-height: 100vh;
}

/* ========= 侧栏(深色毛玻璃) ========= */
.sidebar {
  width: 236px; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(22, 28, 44, .94) 0%, rgba(28, 34, 52, .92) 100%);
  backdrop-filter: saturate(160%) blur(30px);
  -webkit-backdrop-filter: saturate(160%) blur(30px);
  color: rgba(220, 225, 238, .84);
  display: flex; flex-direction: column;
  border-right: .5px solid rgba(255, 255, 255, .06);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.sidebar::before {
  content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
  pointer-events: none;
}
.sidebar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 240px;
  pointer-events: none;
  background: radial-gradient(420px 220px at 50% 100%, rgba(40, 90, 160, .18), transparent 70%);
}
.sidebar > * { position: relative; z-index: 1; }

.logo {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 18px 20px; color: #fff;
  border-bottom: .5px solid rgba(255, 255, 255, .06);
}
.logo-svg {
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(20, 68, 120, .5))
          drop-shadow(0 2px 4px rgba(0, 0, 0, .25));
  transition: transform .4s var(--ease-back);
}
.logo:hover .logo-svg { transform: rotate(-4deg) scale(1.05); }
.logo-block { line-height: 1.2; }
.logo-text {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(180deg, #ffffff 0%, #b8c4d8 140%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.logo-sub {
  font-size: 9.5px; color: rgba(235, 235, 245, .42);
  letter-spacing: .16em; text-transform: uppercase; margin-top: 3px; font-weight: 600;
}

.side-nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); border-radius: 4px; }

.nav-group {
  padding: 16px 12px 6px;
  font-size: 10.5px; color: rgba(235, 235, 245, .42);
  text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
}

/* 一级业务区分组标题(合同档案 / 固定资产):极简灰字 + 彩色锚点小方块 */
.nav-section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 22px 0 6px;
  padding: 0 12px;
  font-size: 11px; font-weight: 600;
  color: rgba(255, 255, 255, .5);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-section-title:first-child { margin-top: 8px; }
.nav-section-title .ico {
  width: 6px; height: 6px; border-radius: 2px;
  flex-shrink: 0;
  background: #5b9cf5;
  box-shadow: 0 0 5px rgba(91, 156, 245, .55);
}
.nav-section-title .ico svg { display: none; }
.nav-section-title.section-assets .ico {
  background: #59c87a;
  box-shadow: 0 0 5px rgba(89, 200, 122, .55);
}
.nav-section-title.section-system .ico {
  background: #8e8e93;
  box-shadow: 0 0 5px rgba(142, 142, 147, .35);
}
/* 折叠侧边栏(窄屏鼠标设备下)隐藏文字,只留小方块 */
.sidebar.collapsed .nav-section-title span:not(.ico) { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0; border-radius: var(--r-md);
  color: rgba(235, 235, 245, .86); font-size: 14px; font-weight: 500;
  transition: all .25s var(--ease);
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, .08); color: #fff;
  opacity: 1; text-decoration: none;
}
.nav-item.active {
  background: linear-gradient(135deg, #1e5fa8 0%, #3d3f8f 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 68, 120, .5),
              inset 0 1px 0 rgba(255, 255, 255, .14);
}
.nav-item.active::after {
  content: ''; position: absolute; right: -10px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 24px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, .4);
  opacity: 0;
}
.nav-item .ico {
  width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center; color: inherit;
}
.ic { display: inline-block; vertical-align: middle; }
.ic-lg { width: 26px; height: 26px; }

.nav-fold { margin: 0; }
.nav-fold > summary { list-style: none; cursor: pointer; }
.nav-fold > summary::-webkit-details-marker { display: none; }
.nav-parent { position: relative; }
.fold-arrow {
  margin-left: auto; font-size: 10px;
  color: rgba(235, 235, 245, .4);
  transition: transform .3s var(--ease-back);
}
.nav-fold[open] > summary .fold-arrow { transform: rotate(180deg); }

.nav-sub {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 40px; margin: 1px 0; border-radius: var(--r-sm);
  color: rgba(235, 235, 245, .6); font-size: 13px;
  transition: all .2s var(--ease); min-width: 0;
}
.nav-sub-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-sub:hover {
  background: rgba(255, 255, 255, .06); color: rgba(235, 235, 245, .95);
  opacity: 1; text-decoration: none;
}
.nav-sub.active {
  background: linear-gradient(135deg, #1e5fa8 0%, #3d3f8f 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 68, 120, .5),
              inset 0 1px 0 rgba(255, 255, 255, .14);
}
.nav-sub .sub-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .55;
}
.nav-sub.active .sub-dot { background: #fff; opacity: .95; }
.nav-sub.manage-link { color: #7fa8d9; font-size: 12px; margin-top: 4px; }
.nav-sub.manage-link:hover { color: #a6c4e4; }

.user-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: .5px solid rgba(255, 255, 255, .06);
  background: rgba(0, 0, 0, .18);
}
.avatar-wrap { position: relative; flex-shrink: 0; }
/* 隐蔽发票开关:外观与 .avatar-dot 完全一致,不让普通访客看出有交互 */
.inv-toggle-form { display: contents; }
.avatar-dot-btn {
  border: 0; padding: 0; cursor: pointer; outline: none;
}
.avatar-dot-btn.is-on {
  /* 开启状态:微微换色为蓝色光晕(只在自己屏幕上眼神扫一下能确认状态) */
  background: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(22, 28, 44, .95), 0 0 8px rgba(56, 189, 248, .65) !important;
}
.avatar-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(22, 28, 44, .95), 0 0 8px rgba(42, 138, 74, .55);
  animation: pulseDot 2.4s var(--ease) infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(22, 28, 44, .95), 0 0 0 0 rgba(42, 138, 74, .55); }
  50%      { box-shadow: 0 0 0 2px rgba(22, 28, 44, .95), 0 0 0 6px rgba(42, 138, 74, 0);   }
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #3a6ea5 0%, #1f3a5f 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: -.02em;
  box-shadow: 0 3px 10px rgba(20, 40, 80, .5), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.user-info { flex: 1; min-width: 0; }
.uname { color: #fff; font-size: 13px; font-weight: 600; }
.udept { color: rgba(235, 235, 245, .5); font-size: 11px; }

.logout-btn {
  width: 34px; height: 34px; display: flex;
  align-items: center; justify-content: center;
  border-radius: var(--r-md); color: rgba(235, 235, 245, .7);
  transition: all .2s var(--ease);
}
.logout-btn:hover {
  background: rgba(255, 69, 58, .16); color: var(--danger);
  opacity: 1; text-decoration: none;
}

/* ========= 主区 ========= */
.main { flex: 1; padding: 28px 36px; margin-left: 236px; }

/* 页眉:玻璃条 */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px; padding: 20px 24px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1), var(--glass-inset);
  position: relative; overflow: hidden;
}
.page-header::before {
  content: ''; position: absolute; left: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 95, 168, .10), transparent 65%);
  pointer-events: none;
}
.page-header h2 {
  background: linear-gradient(135deg, #1a1f2e 0%, #2d3655 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  position: relative;
}
.page-sub { margin: 6px 0 0; color: var(--text-m); font-size: 13px; position: relative; }
/* 标题区让出空间(min-width:0 让 flex 子项可缩),按钮区固定不换行不收缩 */
.page-header > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-header h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-actions {
  display: flex; gap: 8px; flex-wrap: nowrap; flex-shrink: 0;
  position: relative; white-space: nowrap;
}
.page-header-compact { margin-bottom: 14px; padding: 14px 20px; }
.page-header-compact h2 { font-size: 20px; }

/* ========= 按钮(iOS 胶囊) ========= */
.btn, .btn-primary, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--r-pill);
  border: .5px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .22s var(--ease);
  text-decoration: none; line-height: 1.4;
  text-align: center;
  box-shadow: var(--sh-1);
}
.btn .ic, .btn-primary .ic, .btn-danger .ic { width: 16px; height: 16px; }
.btn:hover { background: #fff; opacity: 1; text-decoration: none; transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0) scale(.97); }

.btn-primary {
  background: linear-gradient(180deg, #2d72bd 0%, #1e5fa8 52%, #144478 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px rgba(20, 68, 120, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #3a80ca 0%, #2a6cb5 52%, #174c82 100%);
  color: #fff; opacity: 1; text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(20, 68, 120, .42), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:active { transform: translateY(0) scale(.96); }

.btn-danger {
  background: linear-gradient(180deg, #d44940 0%, #c8342b 52%, #a12019 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px rgba(160, 32, 25, .32), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-danger:hover {
  background: linear-gradient(180deg, #de584f 0%, #d03d34 52%, #ac251d 100%);
  color: #fff; opacity: 1; text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(160, 32, 25, .4);
}
.btn-danger:active { transform: translateY(0) scale(.96); }

.btn.big, .btn-primary.big, .btn-danger.big { padding: 11px 26px; font-size: 14.5px; font-weight: 600; }
.btn-primary.block { display: block; width: 100%; text-align: center; justify-content: center; }
.btn-sm { padding: 5px 13px; font-size: 12px; border-radius: var(--r-pill); font-weight: 500; }

/* 行内操作(表格) */
.action-cell { white-space: nowrap; }
.act {
  display: inline-flex; align-items: center; justify-content: center; padding: 4px 12px; margin-right: 4px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  background: transparent; transition: all .2s var(--ease);
  line-height: 1.6; text-align: center;
}
.act:hover { transform: translateY(-1px); }
.act-view  { color: var(--primary-d); background: rgba(30, 95, 168, .12); }
.act-view:hover { background: rgba(30, 95, 168, .22); opacity: 1; text-decoration: none; }
.act-edit  { color: #8a5a08;          background: rgba(196, 122, 8, .14); }
.act-edit:hover { background: rgba(196, 122, 8, .24); opacity: 1; text-decoration: none; }
.act-del   { color: #9b261f;          background: rgba(200, 52, 43, .12); border: none; }
.act-del:hover { background: rgba(200, 52, 43, .22); opacity: 1; text-decoration: none; }
.act-move  { color: var(--primary-d); background: rgba(30, 95, 168, .12); border: none; }
.act-move:hover:not(:disabled) { background: rgba(30, 95, 168, .22); opacity: 1; }
.act-move:disabled { color: var(--text-l); background: var(--fill-1); cursor: not-allowed; }

.sort-group { display: inline-flex; gap: 2px; margin-right: 6px; vertical-align: middle; }
.sort-group form { display: inline; }

.file-row { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.file-row .ic { color: var(--text-m); }

.sec-title .ic { color: var(--text-m); }
.section-sum .ic { color: var(--primary); vertical-align: -3px; }
.role-head .ic { color: var(--primary); vertical-align: -3px; margin-right: 4px; }

/* ========= 卡片 ========= */
.section-card {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2), var(--glass-inset);
  border: .5px solid var(--glass-border);
  padding: 22px 26px; margin-bottom: 20px;
}
.section-card.no-pad { padding: 0; overflow: hidden; }
.section-card.no-pad .tbl { border: none; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; }
.sec-title {
  font-size: 14px; margin: 0 0 16px; color: var(--text); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.sec-title.with-pad { padding: 20px 26px 0; margin-bottom: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.link-more {
  color: var(--primary); font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 2px;
  transition: gap .2s var(--ease);
}
.link-more:hover { gap: 6px; opacity: 1; }
.section-sum { cursor: pointer; color: var(--primary); font-weight: 600; padding: 4px 0; outline: none; }
.section-sum::-webkit-details-marker { display: none; }

/* ========= 统计卡 ========= */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); padding: 22px 24px;
  box-shadow: var(--sh-2), var(--glass-inset);
  border: .5px solid var(--glass-border);
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--sh-3); }
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--indigo));
  border-radius: 2px;
}
.stat-card.stat-warn::before   { background: linear-gradient(180deg, #c47a08, #8a5a08); }
.stat-card.stat-danger::before { background: linear-gradient(180deg, #c8342b, #8a1a14); }
.stat-card.stat-ok::before     { background: linear-gradient(180deg, #2a8a4a, #1a6e34); }

.stat-ico {
  width: 56px; height: 56px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(30, 95, 168, .20), rgba(30, 95, 168, .08));
  color: var(--primary-d);
  box-shadow: inset 0 0 0 .5px rgba(30, 95, 168, .22),
              0 4px 10px rgba(30, 95, 168, .12);
}
.stat-warn .stat-ico {
  background: linear-gradient(135deg, rgba(196, 122, 8, .20), rgba(196, 122, 8, .08));
  color: #8a5a08;
  box-shadow: inset 0 0 0 .5px rgba(196, 122, 8, .22), 0 4px 10px rgba(196, 122, 8, .12);
}
.stat-danger .stat-ico {
  background: linear-gradient(135deg, rgba(200, 52, 43, .20), rgba(200, 52, 43, .08));
  color: #9b261f;
  box-shadow: inset 0 0 0 .5px rgba(200, 52, 43, .22), 0 4px 10px rgba(200, 52, 43, .12);
}
.stat-ok .stat-ico {
  background: linear-gradient(135deg, rgba(42, 138, 74, .20), rgba(42, 138, 74, .08));
  color: #1a6e34;
  box-shadow: inset 0 0 0 .5px rgba(42, 138, 74, .22), 0 4px 10px rgba(42, 138, 74, .12);
}
.stat-num {
  font-size: 32px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #1a1f2e 0%, #2d3655 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat-card.stat-ok     .stat-num { background: linear-gradient(135deg, #2a8a4a, #1a6e34); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card.stat-warn   .stat-num { background: linear-gradient(135deg, #a56408, #7a4a06); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card.stat-danger .stat-num { background: linear-gradient(135deg, #c8342b, #8a1a14); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-lbl { color: var(--text-m); font-size: 13px; margin-top: 4px; font-weight: 500; }

/* ========= 表格 ========= */
.tbl {
  width: 100%; border-collapse: collapse;
  background: var(--glass-strong);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); overflow: hidden;
  box-shadow: var(--sh-2), var(--glass-inset);
  border: .5px solid var(--glass-border);
}
.tbl th, .tbl td {
  padding: 14px 20px; text-align: left;
  border-bottom: .5px solid var(--separator);
  font-size: 13px; vertical-align: middle;
  line-height: 1.55; word-break: break-word; overflow-wrap: anywhere;
}
.tbl td { max-width: 260px; }
.tbl td.t-wide { max-width: 360px; }
.tbl td.t-narrow { max-width: 140px; }
.tbl td.nowrap { white-space: nowrap; }
/* 长文本单行截断 + 悬停 tooltip(依赖 title 属性);避免表格里出现多行换行 */
.tbl td.cell-ellipsis {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}
.tbl td.cell-ellipsis .cell-link { display: inline; }
.paid-warn { color: #e5484d; font-weight: 600; }
.money-ok  { color: #1f9d55; font-weight: 600; }
.money-bad { color: #e5484d; font-weight: 600; }

/* ============== 付款记录卡片 ============== */
.pay-card { margin-top: 16px; }
.pay-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: .5px solid var(--separator);
}
.pay-head-left { display: flex; align-items: center; gap: 10px; }
.pay-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.pay-count {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 10px;
  background: rgba(30, 95, 168, .08); color: var(--primary);
  font-size: 11.5px; font-weight: 600;
}
.pay-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.pay-stat { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.pay-stat-lbl { font-size: 11px; color: var(--text-m); letter-spacing: .04em; }
.pay-stat-val {
  font-size: 15px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}

/* 进度条 */
.pay-progress {
  height: 4px; background: rgba(60, 60, 67, .08);
  overflow: hidden;
}
.pay-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff9f0a, #ff453a);
  transition: width .6s cubic-bezier(.16,1,.3,1);
}
.pay-progress-bar.is-full {
  background: linear-gradient(90deg, #34c759, #30b56e);
}

/* 新增付款折叠区 */
.pay-new-wrap { border-bottom: .5px solid var(--separator); background: rgba(245, 247, 250, .5); }
.pay-new-fold > summary { list-style: none; }
.pay-new-fold > summary::-webkit-details-marker { display: none; }
.pay-new-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--primary);
  user-select: none;
  transition: background .15s ease;
}
.pay-new-summary:hover { background: rgba(30, 95, 168, .04); }
.pay-new-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1;
  transition: transform .25s ease;
}
.pay-new-fold[open] .pay-new-ico { transform: rotate(45deg); background: #8e8e93; }
.pay-new-hint {
  margin-left: auto; font-size: 12px; color: var(--text-m); font-weight: 500;
}
.pay-new-hint strong { font-weight: 700; }

/* 付款表单(grid 对齐) */
.pay-form {
  display: grid;
  grid-template-columns: 220px 220px minmax(200px, 1fr) auto;
  gap: 12px;
  padding: 14px 18px 18px;
  align-items: end;
  background: rgba(245, 247, 250, .5);
}
.pay-form-inline {
  background: rgba(250, 251, 252, .9);
  border-top: .5px solid var(--separator);
  padding: 14px 18px;
}
.pay-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pay-field-grow { /* 备注那列自然占满剩余 */ }
.pay-field > label {
  font-size: 11.5px; color: var(--text-m); font-weight: 500;
  letter-spacing: .02em;
}
.pay-field input[type="date"],
.pay-field input[type="number"],
.pay-field input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: .5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pay-field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 95, 168, .12);
}
/* date3 容器在 pay-field 里跟普通 input 同款边框/圆角/高度 */
.pay-field .date3 {
  padding: 0 12px;
  border: .5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  height: 34px; min-height: 0;
  font-size: 13px;
  box-sizing: border-box;
}
.pay-field .date3 input {
  font-size: 13px !important;
  line-height: 1.4 !important;
}
.pay-field .date3:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 95, 168, .12);
}
.pay-actions { flex-direction: row; gap: 8px; align-items: center; }
.pay-actions .btn-primary, .pay-actions .btn {
  padding: 8px 18px; font-size: 13px; white-space: nowrap;
}

/* 编辑行 */
.pay-edit-row > td { padding: 0 !important; background: rgba(250, 251, 252, .9); }

/* 列表 */
.pay-list { padding: 0; }
.pay-tbl { margin: 0; }
.pay-tbl th { background: rgba(120, 120, 128, .04); }
.pay-tbl td { font-size: 13px; }
.pay-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-m);
}
.pay-empty-ico { font-size: 36px; margin-bottom: 8px; opacity: .6; }
.pay-empty-msg { font-size: 13px; }

@media (max-width: 900px) and (pointer: coarse) {
  .pay-form { grid-template-columns: 1fr 1fr; }
  .pay-field-grow, .pay-actions { grid-column: span 2; }
  .pay-stats { gap: 14px; }
}
/* 详情页长文本"展开/收起"容器,默认折叠到 3 行 */
.longtext {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}
.longtext.is-open {
  display: block;
  -webkit-line-clamp: unset;
}
.longtext-toggle {
  display: inline-block; margin-top: 4px;
  color: var(--brand, #1a73e8); cursor: pointer;
  font-size: 12px; user-select: none;
}

/* 会话过期通知:顶部居中,阻塞操作 */
.idle-toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; min-width: 340px; max-width: 460px;
  padding: 20px 26px; border-radius: 16px;
  background: rgba(28, 28, 30, .96); color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  border: .5px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(30px);
  animation: idle-toast-in .25s ease-out;
}
@keyframes idle-toast-in {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.idle-toast-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.idle-toast-msg { font-size: 13px; color: rgba(255, 255, 255, .8); line-height: 1.6; margin-bottom: 14px; }
.idle-toast-msg #idle-countdown { color: #ff9f0a; font-weight: 700; font-size: 15px; }
.idle-toast-actions { text-align: right; }
.idle-toast-actions .btn-primary { padding: 8px 20px; font-size: 13px; }

/* 通用 toast 容器:顶部居中,可堆叠多条 */
.toast-stack {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9998; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100vw - 40px);
}
.flash-toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  min-width: 300px; max-width: 520px;
  padding: 13px 18px 13px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, .14),
    0 2px 8px rgba(0, 0, 0, .06),
    0 0 0 .5px rgba(0, 0, 0, .04);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  font-size: 13.5px; line-height: 1.5; color: #1c1c1e;
  animation: flash-toast-in .32s cubic-bezier(.16,1,.3,1);
}
@keyframes flash-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.flash-toast.flash-leaving {
  opacity: 0; transform: translateY(-10px) scale(.98);
  transition: opacity .28s ease, transform .28s ease;
}
.flash-toast .flash-icon {
  flex: 0 0 22px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; font-size: 13px; color: #fff;
  line-height: 1;
}
.flash-toast.flash-error   .flash-icon { background: #ff453a; }
.flash-toast.flash-success .flash-icon { background: #34c759; }
.flash-toast.flash-warn    .flash-icon { background: #ff9f0a; }
.flash-toast.flash-error   { box-shadow: 0 10px 32px rgba(255, 69, 58, .18), 0 2px 8px rgba(0,0,0,.06), 0 0 0 .5px rgba(255, 69, 58, .25); }
.flash-toast.flash-success { box-shadow: 0 10px 32px rgba(52, 199, 89, .18), 0 2px 8px rgba(0,0,0,.06), 0 0 0 .5px rgba(52, 199, 89, .25); }
.flash-toast.flash-warn    { box-shadow: 0 10px 32px rgba(255, 159, 10, .18), 0 2px 8px rgba(0,0,0,.06), 0 0 0 .5px rgba(255, 159, 10, .25); }
.flash-toast .flash-msg { flex: 1; word-break: break-word; }
.flash-toast .flash-close {
  flex: 0 0 auto; background: transparent; border: 0;
  font-size: 20px; line-height: 1; color: #8e8e93;
  cursor: pointer; padding: 0 2px; margin-left: 4px;
  transition: color .15s ease;
}
.flash-toast .flash-close:hover { color: #1c1c1e; }
.tbl th {
  background: rgba(120, 120, 128, .05); font-weight: 600; color: var(--text-m);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  position: sticky; top: 0; z-index: 1; backdrop-filter: blur(20px);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl-hover tbody tr { transition: all .2s var(--ease); }
.tbl-hover tbody tr:hover td {
  background: linear-gradient(90deg, rgba(30, 95, 168, .05), rgba(61, 63, 143, .02));
}
.tbl-hover tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.tbl .empty { text-align: center; color: var(--text-l); padding: 60px 20px; font-size: 13px; }
.tbl .num { font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -.005em; }
.tbl .t-right { text-align: right; }
.tbl td.num.t-right { font-weight: 600; font-size: 13.5px; color: var(--text); }
.tbl td a:not(.act):not(.tag):not(.link-strong) { color: var(--text); font-weight: 500; }
.tbl td a:not(.act):not(.tag):not(.link-strong):hover { color: var(--primary); opacity: 1; text-decoration: none; }

/* PC 端隐藏移动卡片用的字段标签 */
.fld-lbl { display: none; }
.fld-val { display: contents; }

/* ========= 徽章 / 芯片(低调版:左侧点缀 + 文本色,不再大面积填色) ========= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; background: transparent;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0;
  color: var(--text-s);
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge-active     { color: #1a6e34; }
.badge-expiring   { color: #8a5a08; }
.badge-expired    { color: #9b261f; }
.badge-terminated { color: #636670; }
.badge-draft      { color: #5e3488; }
.badge-login, .badge-view      { color: var(--primary-d); }
.badge-create                  { color: #1a6e34; }
.badge-update                  { color: #8a5a08; }
.badge-delete                  { color: #9b261f; }
.badge-download, .badge-export { color: #5e3488; }

/* 类型:纯文本 + 细边,不再像胶囊药丸 */
.type-chip {
  display: inline-block; padding: 0;
  background: transparent; color: var(--text-s);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
}

/* 标签:淡底胶囊,但支持多行换行,不再是高亮圆药丸 */
.tag {
  display: inline-block; max-width: 100%;
  background: var(--fill-1); color: var(--text-s);
  padding: 2px 10px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  margin: 2px 4px 2px 0;
  border: .5px solid var(--border);
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.5;
  transition: all .2s var(--ease);
}
a.tag { color: var(--primary-d); }
a.tag:hover {
  background: var(--primary-l); border-color: rgba(30, 95, 168, .25);
  opacity: 1; text-decoration: none;
}

/* 合同编号:仅保留等宽字色 + 下划悬浮,不再是彩色底块 */
.link-strong {
  color: var(--primary-d); font-weight: 600;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; letter-spacing: .01em;
  padding: 0; background: transparent; border-radius: 0;
  transition: color .2s var(--ease);
}
.link-strong:hover { color: var(--primary); opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.link-strong:visited { color: var(--primary-d); }
.link-strong:focus, .link-strong:focus-visible { outline: none; -webkit-tap-highlight-color: transparent; }

/* 表格内普通链接(如单位名):纯文本 + 悬浮下划线 */
.cell-link {
  color: var(--text); font-weight: 500;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.cell-link:hover {
  color: var(--primary-d); opacity: 1;
  border-bottom-color: rgba(30, 95, 168, .4);
  text-decoration: none;
}

/* ========= 表单 ========= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .filter-item label {
  display: block; font-weight: 500; margin-bottom: 6px;
  color: var(--text-m); font-size: 12px;
}
.form-grid input, .form-grid select, .form-grid textarea,
.filter-item input, .filter-item select, .login-form input {
  width: 100%; padding: 10px 14px;
  border: .5px solid var(--border); border-radius: var(--r-md);
  font-size: 14px;
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(10px);
  transition: border .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  font-family: inherit; color: var(--text);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.filter-item input:focus, .filter-item select:focus, .login-form input:focus {
  outline: none; border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(30, 95, 168, .14);
}
.file-input { padding: 8px; background: var(--fill-1); }
.req { color: var(--danger); margin-left: 2px; }

/* date3 在 form-grid 容器里要跟普通 input 同款圆角/边色/高度/背景 */
.form-grid .date3 {
  padding: 0 14px;
  border: .5px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(10px);
  height: 42px; min-height: 0;
  box-sizing: border-box;
}
.form-grid .date3 input { font-size: 14px !important; }
.form-grid .date3:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(30, 95, 168, .14);
}

.sticky-actions {
  display: flex; gap: 10px; margin-top: 20px; padding-top: 16px;
  border-top: .5px solid var(--separator);
}
.sticky-actions.inline { border-top: none; padding-top: 8px; }

/* 自绘 select 箭头 */
.form-grid select, .filter-item select, .scan-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}

/* ========= 筛选卡 ========= */
.filter-card {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  padding: 18px 22px; border-radius: var(--r-xl);
  margin-bottom: 18px;
  border: .5px solid var(--glass-border);
  box-shadow: var(--sh-1), var(--glass-inset);
}
.filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-item { min-width: 150px; }
.filter-item.grow { flex: 2; min-width: 220px; }
.filter-item.actions { display: flex; gap: 8px; }

/* ========= 详情 ========= */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.info-list > div > label {
  display: block; color: var(--text-m); font-size: 11px; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.info-list > div > div { font-size: 14px; color: var(--text); }
.num-big {
  font-size: 20px; font-weight: 700; color: var(--primary);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.remark {
  white-space: pre-wrap; color: var(--text);
  padding: 14px 16px; background: var(--fill-1); border-radius: var(--r-md);
  border-left: 3px solid var(--primary);
}

/* =====================================================
   登录页 — 深沉午夜蓝版本(避免高饱和鲜艳)
   ===================================================== */
.login-body {
  background:
    radial-gradient(900px 700px at 20% 10%, rgba(72, 101, 159, .35), transparent 55%),
    radial-gradient(800px 700px at 95% 20%, rgba(58, 45, 106, .35), transparent 55%),
    radial-gradient(700px 600px at 50% 110%, rgba(25, 80, 120, .3), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #141b2d 40%, #1a1730 100%);
  min-height: 100vh; position: relative; overflow: hidden;
  color: #e6eaf2;
}
/* 夜空颗粒 */
.login-body::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, rgba(255,255,255,.7) 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 30% 70%, rgba(255,255,255,.5) 0, transparent 50%),
    radial-gradient(1px 1px at 55% 35%, rgba(255,255,255,.65) 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 75% 80%, rgba(255,255,255,.55) 0, transparent 50%),
    radial-gradient(1px 1px at 85% 15%, rgba(255,255,255,.5) 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 45% 90%, rgba(255,255,255,.45) 0, transparent 50%);
  opacity: .7;
}
.login-body::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(180, 210, 250, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 210, 250, .035) 1px, transparent 1px),
    radial-gradient(600px 400px at 85% -10%, rgba(100, 140, 200, .14), transparent 60%),
    radial-gradient(500px 350px at 10% 100%, rgba(120, 90, 180, .12), transparent 60%);
  background-size: 44px 44px, 44px 44px, auto, auto;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}

.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  padding: 20px; position: relative; z-index: 1;
}
.login-card {
  background: rgba(22, 28, 46, .58);
  backdrop-filter: saturate(160%) blur(40px);
  -webkit-backdrop-filter: saturate(160%) blur(40px);
  padding: 44px 40px; border-radius: var(--r-2xl);
  width: 420px; max-width: 100%;
  border: .5px solid rgba(255, 255, 255, .1);
  box-shadow:
    0 40px 80px rgba(0, 0, 0, .5),
    0 2px 0 rgba(255, 255, 255, .04) inset,
    0 0 0 1px rgba(255, 255, 255, .03) inset;
  color: #e6eaf2;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 80px; height: 80px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 16px 32px rgba(40, 80, 140, .55));
}
.login-card h1 {
  margin: 0; font-size: 22px; color: #f5f5f7;
  font-weight: 700; letter-spacing: -.02em;
}
.login-card .subtitle {
  color: rgba(235, 235, 245, .5); font-size: 11px; margin: 8px 0 0;
  letter-spacing: .04em; text-transform: uppercase; font-weight: 500;
  white-space: nowrap;
}
/* 小屏(<480px)允许换行,避免英文长串溢出卡片 */
@media (max-width: 480px) {
  .login-card .subtitle {
    white-space: normal;
    font-size: 11px;
    letter-spacing: .06em;
  }
}
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.login-form input {
  background: rgba(255, 255, 255, .06);
  border: .5px solid rgba(255, 255, 255, .12);
  color: #f5f5f7; height: 48px; border-radius: var(--r-md);
  padding: 10px 14px 10px 44px; font-size: 14.5px;
  transition: all .22s var(--ease);
}
.login-form input::placeholder { color: rgba(235, 235, 245, .35); }
.login-form input:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); }
.login-form input:focus {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(120, 160, 220, .6);
  box-shadow: 0 0 0 4px rgba(60, 110, 180, .2);
  color: #fff;
}
.login-form .btn-primary {
  height: 48px;
  background: linear-gradient(180deg, #4a6fa5 0%, #2a4971 55%, #1d3558 100%);
  color: #fff;
  border-radius: var(--r-md); border: .5px solid rgba(255, 255, 255, .1);
  box-shadow:
    0 12px 28px rgba(10, 20, 50, .55),
    inset 0 1px 0 rgba(255, 255, 255, .14);
  font-weight: 600; font-size: 15px; letter-spacing: .2em;
  transition: all .25s var(--ease);
}
.login-form .btn-primary:hover {
  background: linear-gradient(180deg, #5a80b8 0%, #335a85 55%, #24406a 100%);
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(10, 20, 50, .65), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.login-form .btn-primary:active { transform: translateY(0) scale(.99); }

.input-group { position: relative; }
.input-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: rgba(235, 235, 245, .55);
  display: inline-flex; width: 18px; height: 18px;
}
.input-group input { padding-left: 44px; }

.hint {
  margin-top: 22px; color: rgba(235, 235, 245, .45); font-size: 12px;
  text-align: center; padding-top: 18px;
  border-top: .5px solid rgba(255, 255, 255, .08);
}
.hint code {
  background: rgba(255, 255, 255, .08); color: #e6eaf2;
  padding: 2px 8px; border-radius: 6px; font-weight: 500;
}

.alert-notice {
  background: rgba(255, 159, 10, .14); color: #ffd591;
  padding: 12px 14px; border-radius: var(--r-md);
  margin-bottom: 14px; font-size: 13px;
  border: .5px solid rgba(255, 159, 10, .35);
  backdrop-filter: blur(10px);
}
.alert-error {
  background: rgba(255, 69, 58, .14); color: #ffb4ae;
  padding: 12px 14px; border-radius: var(--r-md);
  margin-bottom: 14px; font-size: 13px;
  border: .5px solid rgba(255, 69, 58, .3);
  backdrop-filter: blur(10px);
}
.login-error {
  background: rgba(255, 69, 58, .14); color: #ffb4ae;
  padding: 12px 14px; border-radius: var(--r-md);
  margin-bottom: 14px; font-size: 13px; text-align: center;
  border: .5px solid rgba(255, 69, 58, .3);
  backdrop-filter: blur(10px);
}
.login-error.shake {
  animation: shakeX .4s ease;
}
@keyframes shakeX {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.alert-success {
  background: rgba(48, 209, 88, .14); color: #b6f0c1;
  padding: 12px 14px; border-radius: var(--r-md);
  margin-bottom: 14px; font-size: 13px;
  border: .5px solid rgba(48, 209, 88, .3);
  backdrop-filter: blur(10px);
}

/* 注册页验证码 */
.captcha-row { display: flex; gap: 10px; align-items: stretch; margin-bottom: 14px; }
.captcha-row input {
  flex: 1; padding: 12px 14px; border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-md); background: rgba(255,255,255,.06); color: #fff;
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
}
.captcha-row img {
  height: 46px; width: 140px; border-radius: var(--r-md);
  cursor: pointer; user-select: none; background: #f5f7fa;
}

/* ========= 杂项 ========= */
.muted { color: var(--text-m); font-size: 13px; font-weight: 500; }
.muted-sm { color: var(--text-m); font-size: 12px; font-variant-numeric: tabular-nums; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.chk-row { display: flex; flex-wrap: wrap; gap: 12px; }
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--fill-1); border-radius: var(--r-pill);
  font-weight: normal; font-size: 13px; cursor: pointer;
  border: .5px solid transparent; transition: all .2s var(--ease);
}
.chk:hover { background: var(--primary-l); border-color: rgba(30, 95, 168, .3); }
.chk input { width: auto; margin: 0; accent-color: var(--primary); }
.role-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: .5px solid var(--separator);
}

/* ========= 统计分析 ========= */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-box { width: 100%; height: 340px; }
.chart-box-lg { width: 100%; height: 380px; }

.pct-bar {
  position: relative; width: 140px; height: 16px;
  background: var(--fill-1); border-radius: var(--r-pill);
  overflow: hidden; margin-left: auto;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.pct-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #1e5fa8, #3d3f8f);
  border-radius: var(--r-pill); transition: width .6s var(--ease);
  box-shadow: 0 0 8px rgba(20, 68, 120, .35);
}
.pct-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text); font-weight: 600;
  text-shadow: 0 0 4px rgba(255, 255, 255, .8);
}

.section-head-bar { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 14px; }
.section-head-bar h3 { font-size: 17px; letter-spacing: -.015em; }

.unit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px;
}
.unit-card {
  display: block; background: var(--card);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid var(--glass-border);
  border-radius: var(--r-xl); padding: 22px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--sh-1), var(--glass-inset);
  transition: all .35s var(--ease); position: relative;
}
.unit-card:hover {
  transform: translateY(-4px); box-shadow: var(--sh-3);
  background: var(--glass-strong); opacity: 1;
}
.unit-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.unit-avatar {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #2a5a8f, #3d3f8f);
  color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(20, 68, 120, .42), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.unit-title { flex: 1; min-width: 0; }
.unit-name { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.unit-remark {
  font-size: 12px; color: var(--text-m); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.unit-arrow {
  font-size: 22px; color: var(--text-l); line-height: 1;
  transition: all .35s var(--ease);
}
.unit-card:hover .unit-arrow { color: var(--primary); transform: translateX(5px); }

.unit-kpis {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding: 14px 0;
  border-top: .5px solid var(--separator);
  border-bottom: .5px solid var(--separator);
}
.kpi { text-align: center; }
.kpi-num { font-size: 16px; font-weight: 700; color: var(--primary); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-lbl { font-size: 11px; color: var(--text-m); margin-top: 2px; }

.unit-bar-wrap { margin-top: 14px; }
.unit-bar { height: 6px; background: var(--fill-1); border-radius: var(--r-pill); overflow: hidden; }
.unit-bar-fill {
  height: 100%; background: linear-gradient(90deg, #3a7cc4, #144478);
  border-radius: var(--r-pill); transition: width .6s var(--ease);
}
.unit-bar-lbl { font-size: 11px; color: var(--text-m); margin-top: 6px; }

.unit-tags { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.utag { font-size: 11px; padding: 3px 10px; border-radius: var(--r-pill); font-weight: 500; }
.utag-ok     { background: rgba(42, 138, 74, .15);  color: #175a2b; }
.utag-warn   { background: rgba(196, 122, 8, .18);  color: #7a4a06; }
.utag-danger { background: rgba(200, 52, 43, .14);  color: #8a1a14; }

.empty-block {
  grid-column: 1 / -1; padding: 48px; text-align: center;
  color: var(--text-m);
  background: var(--card); backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); border: 1px dashed var(--border);
}

.stat-grid-6 { grid-template-columns: repeat(6, 1fr); }

.year-fold { border-top: .5px solid var(--separator); }
.year-fold:first-of-type { border-top: none; }
.year-sum {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--text);
  transition: background .2s var(--ease);
}
.year-sum:hover { background: var(--fill-1); }
.year-sum::-webkit-details-marker { display: none; }
.year-sum::before {
  content: '▸'; margin-right: 10px; color: var(--primary);
  transition: transform .25s var(--ease);
}
.year-fold[open] > .year-sum::before { transform: rotate(90deg); }
.year-fold[open] > .year-sum {
  border-bottom: .5px solid var(--separator);
  background: var(--fill-1);
}
.year-label { font-size: 15px; color: var(--primary); }
.year-meta { font-size: 13px; color: var(--text-m); font-weight: 400; }

.status-bar {
  display: flex; height: 54px; border-radius: var(--r-md); overflow: hidden;
  border: .5px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), var(--sh-1);
}
.status-chunk {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; padding: 0 10px; min-width: 0;
}
.status-chunk .sc-lbl { font-weight: 600; }
.status-chunk .sc-num { font-size: 11px; opacity: .9; }
.sc-active     { background: linear-gradient(135deg, #2a8a4a, #17552a); }
.sc-expiring   { background: linear-gradient(135deg, #a56408, #6b3d06); }
.sc-expired    { background: linear-gradient(135deg, #c8342b, #8a1a14); }
.sc-terminated { background: linear-gradient(135deg, #6d717c, #4a4e58); }

/* ========= 录入模式切换 ========= */
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.mode-tab {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 22px;
  background: var(--card);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid var(--glass-border);
  border-radius: var(--r-xl);
  text-decoration: none; color: var(--text-m);
  transition: all .3s var(--ease);
  box-shadow: var(--sh-1), var(--glass-inset);
}
.mode-tab:hover {
  border-color: rgba(30, 95, 168, .4); color: var(--primary-d); opacity: 1;
  transform: translateY(-3px); box-shadow: var(--sh-2);
}
.mode-tab.active {
  border-color: transparent; color: var(--primary-d);
  background: linear-gradient(135deg, rgba(30, 95, 168, .12), rgba(61, 63, 143, .08));
  box-shadow: 0 0 0 1.5px var(--primary), 0 6px 16px rgba(20, 68, 120, .22);
}
.mode-tab .ic { width: 26px; height: 26px; flex-shrink: 0; }
.mode-tab-text { flex: 1; min-width: 0; }
.mode-tab-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.mode-tab-sub { font-size: 12px; color: var(--text-m); margin-top: 3px; }
.mode-tab.active .mode-tab-sub { color: var(--primary); opacity: .75; }

@media (max-width: 700px) and (pointer: coarse) { .mode-tabs { grid-template-columns: 1fr; } }

/* ========= 扫描录入 ========= */
.scan-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); gap: 14px; }
.scan-left { padding: 10px; }
.scan-right { display: flex; flex-direction: column; gap: 12px; }
.scan-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: .5px solid var(--separator); margin-bottom: 10px;
}
.scan-label { font-size: 13px; color: var(--text-m); font-weight: 600; }
.scan-select {
  flex: 1; min-width: 180px; padding: 7px 12px;
  border: .5px solid var(--border); border-radius: var(--r-md);
  background: rgba(255, 255, 255, .7); backdrop-filter: blur(10px);
}
.scan-select:disabled { background: var(--fill-1); color: var(--text-m); cursor: wait; }
.cam-select-wrap { position: relative; flex: 1; min-width: 200px; display: flex; }
.cam-select-wrap .scan-select { flex: 1; padding-right: 30px; }
.cam-inline-spinner {
  position: absolute; right: 10px; top: calc(50% - 7px);
  width: 14px; height: 14px;
  border: 2px solid rgba(0, 0, 0, .12); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; pointer-events: none;
}
.scan-hint { font-size: 12px; color: var(--text-m); margin-left: auto; }

.scan-stage {
  position: relative;
  background: linear-gradient(180deg, #1c1c1e 0%, #0a0a0c 100%);
  border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 3 / 4; height: calc(100vh - 220px); max-height: 90vh;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), 0 16px 40px rgba(0, 0, 0, .22);
}
/* 沉浸式扫描布局:画面铺满左栏,工具栏悬浮在画面上下方的黑边上 */
.scan-left-immersive { padding: 0 !important; background: transparent !important; box-shadow: none !important; border: none !important; }
.scan-stage-immersive {
  width: 100%; height: calc(100vh - 140px); max-height: none;
  aspect-ratio: auto; margin: 0; border-radius: 12px;
}
.scan-toolbar-floating {
  position: absolute; left: 12px; right: 12px; top: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(20, 20, 24, .55); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
.scan-toolbar-floating .scan-label,
.scan-toolbar-floating .scan-hint { color: rgba(255,255,255,.85); }
.scan-toolbar-floating .scan-select { background: rgba(255,255,255,.92); }
/* 悬浮工具栏上的按钮:玻璃拟态深色款,跟工具栏背景融为一体 */
.scan-toolbar-floating .btn,
.scan-toolbar-floating .btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px; padding: 0 12px;
  font-size: 13px; font-weight: 500; line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.scan-toolbar-floating .btn:hover:not(:disabled),
.scan-toolbar-floating .btn-sm:hover:not(:disabled) {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.30);
}
.scan-toolbar-floating .btn:active:not(:disabled),
.scan-toolbar-floating .btn-sm:active:not(:disabled) {
  transform: translateY(1px);
  background: rgba(255,255,255,.22);
}
.scan-toolbar-floating .btn:disabled,
.scan-toolbar-floating .btn-sm:disabled {
  color: rgba(255,255,255,.40);
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  cursor: not-allowed;
}
.scan-toolbar-floating .btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(255,255,255,.20);
  box-shadow: 0 2px 6px rgba(37,99,235,.35);
}
.scan-toolbar-floating .btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4b8ff8, #2f6df0);
  border-color: rgba(255,255,255,.30);
}
.scan-toolbar-floating .btn-primary:disabled {
  background: rgba(37,99,235,.30);
  color: rgba(255,255,255,.55);
  box-shadow: none;
}
/* 按钮内部 icon 尺寸统一 */
.scan-toolbar-floating .btn svg,
.scan-toolbar-floating .btn-sm svg { width: 14px; height: 14px; }
.scan-capture-bar-floating {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(20, 20, 24, .55); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
.scan-capture-bar-floating .scan-chk { color: rgba(255,255,255,.9); }

/* 已完成合同(ready 状态):合同信息 + 按钮上下两行,避免横向挤压 */
.done-row-stacked { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.done-row-stacked .done-info { width: 100%; }
.done-actions-bottom { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding-top: 4px; border-top: 1px dashed rgba(0,0,0,.06); }
.scan-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: rgba(235, 235, 245, .75); font-size: 16px;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px);
}
.stage-overlay small { font-size: 12px; color: rgba(235, 235, 245, .5); margin-top: 6px; }

.scan-capture-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-capture-ghost {
  background: var(--glass-strong); color: var(--text-m);
  border: .5px solid var(--border);
  padding: 7px 14px; font-size: 13px; opacity: .9;
}
.btn-capture-ghost:hover:not(:disabled) { background: #fff; opacity: 1; }
.btn-next-big { padding: 13px 30px; font-size: 15px; font-weight: 600; min-width: 220px; letter-spacing: .02em; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.scan-chk { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--text-m); }

.page-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px; max-height: 340px; overflow-y: auto;
}
.empty-thumbs {
  grid-column: 1 / -1; padding: 28px; text-align: center;
  color: var(--text-m); font-size: 13px;
  border: 1px dashed var(--border); border-radius: var(--r-md);
  background: var(--fill-1);
}
.page-thumb {
  position: relative; aspect-ratio: 3 / 4;
  border: .5px solid var(--border); border-radius: var(--r-sm); overflow: hidden;
  background: var(--fill-1); box-shadow: var(--sh-1);
}
.page-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-idx {
  position: absolute; top: 5px; left: 5px;
  background: rgba(28, 28, 30, .72); backdrop-filter: blur(10px);
  color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 5px;
}
.thumb-del {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px;
  background: rgba(255, 69, 58, .92); color: #fff;
  border: none; border-radius: 50%;
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.done-list { max-height: 420px; overflow-y: auto; }
.done-item {
  padding: 13px; border: .5px solid var(--border); border-radius: var(--r-md);
  margin-bottom: 8px; background: var(--fill-1);
}
.done-item.done-ok { background: rgba(42, 138, 74, .10); border-color: rgba(42, 138, 74, .34); }
.done-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.done-info { flex: 1; min-width: 0; font-size: 13px; }
.done-actions { display: flex; gap: 6px; flex-shrink: 0; }
.done-err { color: #b30010; }
.done-ok-row { color: #175a2b; font-size: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(42, 138, 74, .5); }
.done-mini-wrap { display: flex; gap: 4px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.done-mini { width: 32px; height: 42px; object-fit: cover; border: .5px solid var(--border); border-radius: 4px; background: #fff; }
.done-mini-more { font-size: 11px; color: var(--text-m); padding: 0 4px; }
.pages-editor-body { padding: 4px 2px; overflow: auto; flex: 1; min-height: 0; }
.pages-editor-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 12px; margin-top: 12px; border-top: .5px solid var(--separator);
}
.pages-editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pages-editor-grid .page-thumb { aspect-ratio: 3 / 4; background: var(--fill-1); }
.pages-editor-grid .page-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pages-editor-grid .thumb-del { width: 28px; height: 28px; font-size: 16px; }
.pages-editor-grid .thumb-idx { font-size: 13px; padding: 3px 9px; }

/* 裁切预览模态:两张图等宽 + 等高同行;手机端依然两列(用户要求同行) */
.crop-preview-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 12px; max-height: 72vh; overflow: auto;
  align-items: start;
}
.crop-preview-col { display: flex; flex-direction: column; min-width: 0; }
.crop-preview-label {
  margin-bottom: 6px; min-height: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crop-canvas-wrap {
  width: 100%; aspect-ratio: 3 / 4;
  border: 1px solid #e5e7eb; border-radius: 6px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: #f5f5f7;
}
.crop-canvas-wrap canvas {
  width: 100%; height: 100%; object-fit: contain;
  display: block;
}
@media (max-width: 600px) and (pointer: coarse) {
  .crop-preview-grid { gap: 6px; padding: 8px; }
  .crop-preview-label { font-size: 11px; }
  .crop-canvas-wrap { aspect-ratio: 3 / 4; }
  .pages-editor-foot { flex-wrap: wrap; gap: 6px; justify-content: stretch; }
  .pages-editor-foot .btn,
  .pages-editor-foot .btn-primary {
    flex: 1 1 30%; padding: 10px 6px; font-size: 12.5px;
    justify-content: center; text-align: center; min-width: 0;
  }
}

.modal-mask-center { align-items: center; padding-top: 0; }
.modal-box-xl {
  width: 92vw; max-width: 92vw;
  height: 92vh; max-height: 92vh;
  display: flex; flex-direction: column;
  padding: 22px 26px;
}
.modal-box-xl .modal-head { margin-bottom: 8px; }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(0, 0, 0, .12); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 5vh; z-index: 1000;
  animation: fadeIn .25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--glass-strong);
  backdrop-filter: saturate(180%) blur(40px);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  border-radius: var(--r-2xl); padding: 24px;
  width: 720px; max-width: 90vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sh-4), inset 0 1px 0 rgba(255, 255, 255, .5);
  border: .5px solid rgba(255, 255, 255, .4);
  animation: modalIn .32s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: .5px solid var(--separator);
}
.modal-x {
  background: var(--fill-1); border: none; cursor: pointer;
  color: var(--text-m); padding: 6px; border-radius: 50%;
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  transition: all .25s var(--ease);
}
.modal-x:hover { background: rgba(200, 52, 43, .14); color: var(--danger); transform: rotate(90deg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ocr-preview pre {
  max-height: 150px; overflow-y: auto;
  background: var(--fill-1); padding: 12px; border-radius: var(--r-md);
  font-size: 12px; white-space: pre-wrap; word-break: break-all;
}

@media (max-width: 1100px) and (pointer: coarse) { .scan-layout { grid-template-columns: 1fr; } }

/* 手机端扫描录入:顶部工具栏隐藏;画面充满黑框;功能栏紧贴画面下边、不占画面 */
@media (max-width: 600px) and (pointer: coarse) {
  .scan-layout { gap: 8px; }
  /* 关键:容器要 relative,并留出底部空间给功能栏(功能栏用绝对定位钉在这块空间里) */
  .scan-left-immersive {
    margin: 0 -10px;
    position: relative;
    padding-bottom: 140px !important;  /* 给底部功能栏预留高度 */
  }
  /* 取景画面:破坏原本 flex 居中,改成 block,允许 overflow 不再裁;
     但 video 仍铺满 stage 自身,功能栏会脱离 stage 用绝对定位钉在外面 */
  .scan-stage-immersive {
    height: 58vh; min-height: 320px;
    border-radius: 8px;
    display: block;          /* 取消 flex,避免子元素被强制并排 */
    overflow: visible;       /* 允许功能栏跨出 stage 边界 */
  }
  .scan-stage video {
    object-fit: cover;       /* 视频铺满整个黑框,不留黑边 */
    border-radius: 8px;
  }

  /* 顶部工具栏整个隐藏 */
  .scan-toolbar-floating { display: none !important; }

  /* 底部功能栏:绝对定位钉在 stage 之下、紧贴下沿、不覆盖画面 */
  .scan-capture-bar-floating {
    position: absolute !important;
    left: 0 !important; right: 0 !important;
    top: calc(58vh + 6px) !important;   /* 紧贴 stage 下沿(stage 高度 = 58vh) */
    bottom: auto !important;
    margin: 0;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 10px;
    display: flex; flex-wrap: wrap; gap: 8px;
    background: rgba(20, 20, 24, .85);
    color: #fff;
    z-index: 5;
  }
  /* 拍摄 + 结束本份 并排同一行,各 50%;内部 svg+文字水平居中,不再贴左 */
  .scan-capture-bar-floating #btn-capture,
  .scan-capture-bar-floating #btn-next {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 8px;
    margin: 0;
    text-align: center;
    white-space: nowrap;
  }
  .scan-capture-bar-floating #btn-capture {
    flex: 1 1 calc(50% - 4px); width: calc(50% - 4px);
    font-size: 15px; font-weight: 600;
    order: 1;
  }
  .scan-capture-bar-floating #btn-next {
    flex: 1 1 calc(50% - 4px); width: calc(50% - 4px);
    font-size: 14px;
    order: 2;
  }
  /* 两个复选框:占满整行,各占一半 */
  .scan-capture-bar-floating .scan-chk {
    margin: 0; font-size: 12px;
    flex: 1 1 calc(50% - 4px);
  }
  .scan-capture-bar-floating .scan-chk:nth-of-type(1) { order: 3; }
  .scan-capture-bar-floating .scan-chk:nth-of-type(2) { order: 4; }
  .scan-capture-bar-floating #ocv-status { display: none; }

  /* 右侧列表手机上挪到下方,缩略图更小一点 */
  .scan-right { gap: 8px; margin-top: 8px; }
  .page-thumbs { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 220px; }
  .done-list { max-height: 320px; }
}

/* ========= 合同详情:PDF 阅读器 ========= */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
.pdf-viewer-wrap { padding: 0; display: flex; flex-direction: column; min-height: 620px; }
.pdf-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: .5px solid var(--separator);
  background: rgba(255, 255, 255, .55);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.pdf-toolbar .btn-sm { padding: 5px 12px; font-size: 12.5px; background: var(--glass-strong); }
.pdf-page-indicator { font-size: 13px; color: var(--text-m); }
.pdf-page-indicator input {
  width: 50px; text-align: center;
  padding: 4px 8px; border: .5px solid var(--border); border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .8);
}
#pdf-zoom-lbl { font-size: 12px; color: var(--text-m); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-scroll {
  /* 允许水平滚动:用户放大到比容器宽时,出横向滚动条而不是把容器撑爆 */
  flex: 1; overflow: auto; padding: 20px;
  background: var(--fill-1); max-height: calc(100vh - 220px);
}
.pdf-page {
  /* fit-content + max-width:100%:zoom=1 时(fit-page)宽度小于容器 → 配合 margin:0 auto 自动居中,左右留白
     zoom>1 时宽度超过容器 → .pdf-scroll 出水平滚动条,内容不被裁切 */
  margin: 0 auto 16px; background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px; width: fit-content; box-sizing: border-box;
  border-radius: 6px;
}
.pdf-page canvas { display: block; max-width: 100%; height: auto; }  /* 桌面 JS 写绝对 px,手机不写 → 由 max-width:100% 自适应,不破坏 zoom */
.pdf-page-label { font-size: 11px; color: var(--text-m); margin-top: 6px; }
.pdf-empty {
  padding: 60px 20px; text-align: center; color: var(--text-m);
  border: 2px dashed var(--border); border-radius: var(--r-md); margin: 20px;
  background: var(--fill-1);
}

/* 右侧栏:用 grid 的 stretch 与左侧 PDF 卡同高 */
.detail-layout { align-items: stretch; }
.detail-side {
  display: flex; flex-direction: column; gap: 12px;
  height: 100%; min-height: 0;
}
/* 基础信息卡:占上半部分(去掉滚动条) */
.detail-side > .section-card:first-child {
  flex: 1 1 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.detail-side > .section-card:first-child .info-compact {
  flex: 1; min-height: 0;
}
/* 页面导航卡:占下半部分,底部与 PDF 对齐 */
.detail-side > .section-card:last-child {
  flex: 1 1 0; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
/* 缩略图:3 列等宽,每张固定 A4 比例,可滚动 —— 3 列让单张更小,页面导航整体更紧凑 */
.detail-side > .section-card:last-child .pdf-thumbs {
  flex: 1; min-height: 0; max-height: none;
  display: grid; grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: max-content;
  gap: 6px; padding: 8px;
  overflow-y: auto;
}
.detail-side .pdf-thumb {
  /* 用 aspect-ratio 锁定 A4 比例,但 height 用 auto 让浏览器算 —— 配合下面 canvas 的
     width:100%; height:auto; aspect-ratio,无论 PDF 各页 pt 尺寸如何,所有缩略图框等大。 */
  width: 100%; aspect-ratio: 1 / 1.414;
  overflow: hidden;
  /* 不用 flex 居中:flex 会让子的 height:100% 在某些浏览器下表现不一致,
     直接用 block 让 canvas 自然占满。 */
  display: block;
}
.detail-side .pdf-thumb canvas {
  /* canvas 也强制 A4 比例 → 任何 PDF 都铺满框,从根本上消除"两个缩略图大小不一"的可能 */
  width: 100%; height: 100%;
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
  display: block;
}
.sec-title-sm {
  font-size: 11px; color: var(--text-m); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; margin: 0 0 10px;
}
.sec-title-sm.with-pad { padding: 14px 18px 8px; margin: 0; }

.info-compact { display: grid; grid-template-columns: 1fr; gap: 0; }
.info-compact > div {
  display: grid; grid-template-columns: 64px minmax(0, 1fr);
  align-items: start; gap: 10px;
  padding: 5px 0;
  border-bottom: .5px dashed var(--separator);
  font-size: 12.5px;
}
.info-compact > div:last-child { border-bottom: none; }
.info-compact label {
  color: var(--text-m); font-size: 11.5px; font-weight: 500;
  padding-top: 1px;
}
.info-compact span {
  text-align: left; color: var(--text);
  word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.45; min-width: 0;
}
.info-compact .num-big { font-size: 15px; font-weight: 700; color: var(--primary-d); }

.pdf-thumbs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  padding: 10px; overflow-y: auto;
}
.pdf-thumb {
  position: relative; cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--r-sm); transition: all .25s var(--ease);
  background: var(--fill-1); overflow: hidden;
}
.pdf-thumb canvas { width: 100%; height: auto; display: block; }
.pdf-thumb:hover { border-color: var(--primary); transform: scale(1.03); }
.pdf-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(30, 95, 168, .18); }
.pdf-thumb .thumb-n {
  position: absolute; bottom: 5px; right: 7px;
  background: rgba(28, 28, 30, .75); backdrop-filter: blur(10px);
  color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 4px;
}

.remark-mini { font-size: 13px; color: var(--text); white-space: pre-wrap; }

.file-list-mini { list-style: none; margin: 0; padding: 0; }
.file-list-mini li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-top: .5px solid var(--separator);
  font-size: 12px; transition: background .15s var(--ease);
}
.file-list-mini li:hover { background: var(--fill-1); }
.file-list-mini .file-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-list-mini .file-meta { color: var(--text-m); font-size: 11px; }

@media (max-width: 1100px) and (pointer: coarse) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { max-height: none; }
}

/* 简洁 PDF 顶栏提示:替代原有的翻页/缩放/下载工具条(实际功能已不再需要,下载移到页面顶部) */
.pdf-tip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: .5px solid var(--separator);
  background: rgba(255, 255, 255, .55);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  color: var(--text-m);
}
.pdf-tip svg { width: 18px; height: 18px; opacity: .7; flex: none; }
.pdf-tip-main { font-size: 14px; font-weight: 600; color: var(--text-h); }
.pdf-tip-sub { font-size: 12px; color: var(--text-m); margin-left: 4px; }
/* PDF 缩放工具条:仅 PC 端显示;手机有原生双指捏合缩放,不需要这套按钮 */
.pdf-zoom-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.pdf-zoom-tools .btn { min-width: 28px; padding: 2px 8px; font-size: 14px; line-height: 1.4; }
.pdf-zoom-label { font-size: 12px; color: var(--text-m); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-zoom-hint { font-size: 11px; color: var(--text-m); opacity: .7; margin-left: 6px; }
@media (max-width: 768px) and (pointer: coarse) {
  .pdf-zoom-tools { display: none !important; }  /* 整条工具栏隐藏(手机用双指捏合即可) */
}

/* 手机端:把"基础信息卡片"挪到 PDF 上方,避免长 PDF 把底部信息挤到屏外看不见 */
/* PC 端默认:折叠箭头和提示不显示,基础信息一直展开 */
.info-toggle-chev,
.info-toggle-right { display: none; }

@media (max-width: 768px) and (pointer: coarse) {
  /* 用 block(单列堆叠),不依赖 flex+order — Samsung Internet 部分版本对 grid/flex order 渲染不一致
     DOM 顺序由 JS 在 reorderForMobile 里调整,布局只管堆叠 */
  .detail-layout { display: block; }
  .detail-side {
    height: auto; min-height: 0;
    display: block;
    margin-bottom: 12px;
  }
  .detail-side > .section-card:first-child,
  .detail-side > .section-card:last-child {
    flex: none; overflow: visible; height: auto;
  }
  .detail-side > .section-card:first-child .info-compact { flex: none; }
  /* 手机端隐藏"页面导航"缩略图卡片 */
  .detail-side > .section-card:last-child { display: none; }

  /* 基础信息卡片:点击标题展开/收起 */
  .info-collapsible .sec-title-sm.info-toggle {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
    margin: 0; padding: 4px 0;
    font-size: 13px; text-transform: none; letter-spacing: 0;
    color: var(--text-h); font-weight: 700;
  }
  .info-collapsible .info-toggle-right {
    display: inline-flex; align-items: center; gap: 6px;
  }
  .info-collapsible .info-toggle-hint {
    font-size: 11px; color: var(--text-m); font-weight: 500;
    background: var(--fill-1); padding: 2px 8px; border-radius: 10px;
    letter-spacing: 0;
  }
  .info-collapsible .info-toggle-chev {
    display: inline-block;
    transition: transform .2s ease;
    color: var(--text-m); font-size: 14px;
  }
  .info-collapsible.is-open .info-toggle-chev { transform: rotate(180deg); }
  /* 默认收起:内容隐藏 */
  .info-collapsible .info-compact {
    max-height: 0; overflow: hidden;
    transition: max-height .25s ease, margin .25s ease;
    margin: 0;
  }
  .info-collapsible.is-open .info-compact {
    max-height: 1200px;
    margin-top: 10px;
  }

  /* PDF 顶栏紧凑 */
  .pdf-tip { padding: 8px 12px; }
  .pdf-tip-main { font-size: 13px; }
  .pdf-tip-sub { font-size: 11px; }
  .pdf-viewer-wrap { min-height: 480px; margin: 0; max-width: 100%; overflow: hidden; }
  /* 手机端 PDF 滚动区:几乎贴边,把空间最大化让给页面 */
  .pdf-scroll { padding: 4px; max-height: calc(100vh - 180px); }
  .pdf-page {
    padding: 2px; margin: 0 auto 8px;
    width: 100%; max-width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    border-radius: 4px;
  }
  .pdf-page canvas { width: 100%; height: auto; max-width: 100%; }

  /* 顶部操作行:4 按钮全部挤进一行,4 等分,强制等宽等高 */
  .page-header .page-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  /* 网格直接子项(a / button / form)都拉满格子;display:flex 让 form 里的按钮也撑满 */
  .page-header .page-actions > * {
    width: 100%; min-width: 0; margin: 0;
    display: flex;
  }
  /* 实际可见按钮:无论是直接 a/button,还是 form 里的 button,统一样式 */
  .page-header .page-actions > a,
  .page-header .page-actions > button,
  .page-header .page-actions > form > button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; box-sizing: border-box;
    height: 38px;                  /* 等高:不再受文字/图标尺寸差异影响 */
    padding: 0 6px;
    font-size: 12px;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
  }
  /* 图标缩小,文字才有位置 */
  .page-header .page-actions svg { width: 14px; height: 14px; flex: none; }
  /* ≤380px 极窄屏:文字隐藏,只剩图标(图标足够表达含义) */
}
@media (max-width: 380px) and (pointer: coarse) {
  .page-header .page-actions > a span,
  .page-header .page-actions > button span,
  .page-header .page-actions form button span { display: none; }
  .page-header .page-actions > a,
  .page-header .page-actions > button,
  .page-header .page-actions form button { padding: 8px 4px; gap: 0; }
  .page-header .page-actions svg { width: 16px; height: 16px; }
}

/* ========= 响应式 ========= */
@media (max-width: 1024px) and (pointer: coarse) {
  .detail-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 16px; }
  .tbl th, .tbl td { padding: 10px 12px; }
}
/* PC 中屏(1025-1100)侧边栏图标化 */
@media (max-width: 1100px) and (min-width: 1025px) {
  .sidebar { width: 64px; }
  .main { margin-left: 64px; }
  .logo-text, .logo-sub, .nav-item span:not(.ico), .user-info, .nav-group,
  .nav-sub, .fold-arrow { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 120, 128, .28); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 120, 128, .48); }

/* 页面入场动画 */
.main > * { animation: rise .5s var(--ease) both; }
.main > *:nth-child(1) { animation-delay: .02s; }
.main > *:nth-child(2) { animation-delay: .08s; }
.main > *:nth-child(3) { animation-delay: .14s; }
.main > *:nth-child(4) { animation-delay: .2s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 用户编辑内联表单 */
.edit-user-form .edit-grid {
  display: grid; grid-template-columns: 2fr 1fr 1.5fr; gap: 16px;
}
.edit-user-form label { display:block; font-size:12px; color:#666; margin-bottom:6px; }
.edit-user-form input[type=text], .edit-user-form select {
  padding:6px 10px; border:1px solid #d0d7de; border-radius:6px; font-size:14px;
  width:100%; background:#fff;
}
@media (max-width: 800px) and (pointer: coarse) {
  .edit-user-form .edit-grid { grid-template-columns: 1fr; }
}

/* 操作日志筛选条 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar label { display: flex; flex-direction: column; font-size: 12px; color: #666; gap: 4px; }
.filter-bar select, .filter-bar input[type=text], .filter-bar input[type=search], .filter-bar input[type=number], .filter-bar input[type=date] {
  box-sizing: border-box; height: 34px; line-height: normal;
  padding: 0 10px; border: 1px solid #d0d7de; border-radius: 6px; font-size: 14px;
  min-width: 140px; background: #fff;
}
.filter-bar .btn { padding: 7px 16px; box-sizing: border-box; height: 34px; }


/* ============================================================
   📱 手机端适配(≤820px)
   设计目标:
   1) 侧边栏 → 抽屉式,顶部新增汉堡顶栏
   2) 表格在窄屏自动按 data-label 转卡片
   3) 表单/筛选条变单列、触摸目标 ≥44px
   4) 字号/间距收紧,模态/toast 居中
   ============================================================ */

/* 默认顶栏在 PC 隐藏 */
.mobile-topbar { display: none; }
.sidebar-mask { display: none; }

@media (max-width: 1024px) and (pointer: coarse) {
  /* —— 整体布局 —— */
  body { font-size: 14px; }
  .app { display: block; }
  .main {
    padding: 14px 14px 80px;
    max-width: 100%;
    margin-left: 0; /* 手机端抽屉模式:不再为桌面端 fixed 侧栏让位 */
  }

  /* —— 顶部汉堡导航条 —— */
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 900;
    height: 52px; padding: 0 12px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: .5px solid rgba(0,0,0,.06);
  }
  /* fixed 顶栏要给 body 让出 52px,避免遮住正文 */
  body { padding-top: 52px; }
  .mobile-topbar .hamburger {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: transparent; border: none; cursor: pointer;
    color: var(--primary-d, #1e5fa8);
  }
  .mobile-topbar .hamburger:active { background: rgba(30,95,168,.1); }
  .mobile-topbar .hamburger svg { width: 22px; height: 22px; }
  .mobile-topbar .mt-title {
    flex: 1; font-size: 16px; font-weight: 600; color: #1e3a5f;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mobile-topbar .mt-logout {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; color: #666;
  }
  .mobile-topbar .mt-logout svg { width: 20px; height: 20px; }

  /* —— 侧边栏改为抽屉 —— */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 78%; max-width: 320px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s var(--ease, ease);
    box-shadow: 6px 0 24px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,.32);
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-mask.show { display: block; opacity: 1; pointer-events: auto; }

  /* —— 标题/按钮区 —— */
  .page-header {
    flex-direction: column; align-items: stretch; gap: 12px;
  }
  .page-header h2 { font-size: 18px; }
  .page-sub { font-size: 12px; }
  .page-header .btn,
  .page-header .btn-primary { width: 100%; justify-content: center; }

  /* —— 卡片/区块 —— */
  .section-card { border-radius: 14px; }
  .section-card.no-pad,
  .section-card { padding: 14px; }
  .section-card.no-pad { padding: 0; }

  /* —— 表格 → 卡片(只在 .tbl 上生效) —— */
  .tbl,
  .tbl thead,
  .tbl tbody,
  .tbl tr,
  .tbl td,
  .tbl th { display: block; width: 100% !important; }
  .tbl thead { display: none; }
  .tbl tr {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 12px 14px; margin: 10px 14px;
    width: auto !important;
    box-sizing: border-box;
  }
  .tbl td {
    padding: 6px 0 !important;
    max-width: 100% !important;
    border: none !important;
    white-space: normal !important;
    display: flex !important; justify-content: space-between; align-items: center;
    gap: 12px; font-size: 13.5px;
  }
  /* 手机端显示字段标签 */
  .fld-lbl {
    display: inline-block !important;
    flex: 0 0 72px;
    color: #6b7785;
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
  }
  .fld-val {
    display: inline-block !important;
    flex: 1;
    text-align: right;
    word-break: break-word;
  }
  /* 操作列横排显示 */
  .tbl td.action-cell,
  .tbl td:last-child {
    display: flex !important; flex-wrap: wrap; gap: 8px;
    padding-top: 10px !important;
    border-top: 1px dashed #eee !important;
    margin-top: 6px;
  }
  .tbl td.action-cell .fld-lbl,
  .tbl td:last-child .fld-lbl { display: none !important; }
  .tbl .act {
    flex: 1; min-width: 72px; justify-content: center;
    padding: 8px 10px; font-size: 13px;
  }

  /* —— 表单 —— */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .form-grid .full { grid-column: span 1 !important; }
  input[type=text], input[type=password], input[type=number],
  input[type=date], input[type=email], select, textarea {
    font-size: 16px !important; /* iOS 防自动放大 */
    padding: 10px 12px !important;
    border-radius: 10px !important;
  }
  .sticky-actions {
    position: sticky; bottom: 12px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    padding: 12px 14px;
    margin: 16px -2px 0;
    border: .5px solid rgba(255,255,255,.7);
    border-radius: 18px;
    box-shadow:
      0 6px 22px rgba(15,30,60,.14),
      inset 0 1px 0 rgba(255,255,255,.9);
    z-index: 10;
    gap: 10px;
  }
  .sticky-actions .btn,
  .sticky-actions .btn-primary { width: 100%; padding: 12px; font-size: 15px; }

  /* —— 筛选条 —— */
  .filter-bar { gap: 8px; }
  .filter-bar label { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .filter-bar select, .filter-bar input[type=text] {
    min-width: 0; width: 100%; font-size: 16px;
  }
  .filter-item { min-width: 0 !important; flex: 1 1 calc(50% - 8px) !important; }
  .filter-item.grow { flex: 1 1 100% !important; }

  /* —— 按钮触摸最低尺寸 —— */
  .btn, .btn-primary {
    min-height: 40px; font-size: 14px;
    padding: 10px 16px;
  }

  /* —— 登录页(手机端 · iOS App 规范比例) —— */
  .login-body { min-height: 100vh; }
  .login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 22px;
    box-sizing: border-box;
  }
  .login-card {
    width: 100% !important;
    max-width: 440px !important;
    padding: 44px 28px 36px !important;
    border-radius: 24px !important;
    box-sizing: border-box;
    margin: 0 auto;
  }
  .login-brand { margin-bottom: 36px; }
  .login-logo {
    width: 76px; height: 76px; margin: 0 auto 18px;
  }
  .login-logo svg { width: 60px; height: 60px; }
  .login-card h1 {
    font-size: 26px !important;
    font-weight: 700;
    line-height: 1.25;
  }
  .login-card .subtitle {
    font-size: 12px;
    margin-top: 10px;
    letter-spacing: .14em;
    opacity: .5;
  }
  .login-form { gap: 14px; margin-top: 18px; }
  .login-form input {
    height: 52px !important;
    font-size: 17px !important;
    padding: 12px 16px 12px 50px !important;
    border-radius: 13px !important;
    box-sizing: border-box;
  }
  .input-group { position: relative; }
  .input-icon {
    left: 18px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    z-index: 2;
  }
  .login-form .btn-primary {
    height: 52px !important;
    font-size: 17px !important;
    border-radius: 13px !important;
    letter-spacing: .3em;
    margin-top: 10px;
    font-weight: 600;
  }
  .hint {
    margin-top: 28px;
    font-size: 14px;
    padding-top: 20px;
  }
  .alert-error, .alert-notice {
    font-size: 14px; padding: 12px 14px; border-radius: 12px;
  }

  /* —— 模态框 —— */
  .modal-content,
  .crop-modal-content {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 80px) !important;
  }

  /* —— toast/通知缩窄 —— */
  .toast-stack { left: 12px !important; right: 12px !important; transform: none !important; }
  .flash-toast { min-width: 0; max-width: 100%; }
  .idle-toast { min-width: 0; left: 12px; right: 12px; transform: none; width: auto; }

  /* —— 详情页两栏改单栏 —— */
  .detail-grid { grid-template-columns: 1fr !important; }

  /* —— 隐藏 PC 才用得上的窄/宽列宽限制 —— */
  .tbl td.t-narrow, .tbl td.t-wide { max-width: 100% !important; }

  /* —— 编辑用户内联表单 —— */
  .edit-user-form .edit-grid { grid-template-columns: 1fr !important; }
}

/* 超小屏(<=420)再收紧一点 */
@media (max-width: 420px) and (pointer: coarse) {
  .main { padding: 10px 10px 80px; }
  .tbl tr { margin: 8px 0; }
  .page-header h2 { font-size: 17px; }
}

/* ============================================================
   🫧 手机端通用卡片 + 合同卡片(液态玻璃风)
   ============================================================ */
@media (max-width: 1024px) and (pointer: coarse) {

  /* —— 通用 .tbl 卡片(用于用户、角色、日志等) —— */
  .tbl tr {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,253,.86));
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: .5px solid rgba(255,255,255,.7);
    border-radius: 14px;
    box-shadow:
      0 1px 2px rgba(15,30,60,.05),
      0 4px 14px rgba(15,30,60,.06),
      inset 0 1px 0 rgba(255,255,255,.9);
    padding: 12px 14px;
    margin: 10px 12px;
    -webkit-tap-highlight-color: transparent;
  }
  /* —— 合同列表卡片专属增强 —— */
  .tbl-contracts tr {
    padding: 14px 16px;
    margin: 12px 10px;
    width: auto !important;
    box-sizing: border-box;
    border-radius: 16px;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      0 1px 1px rgba(15,30,60,.04),
      0 2px 6px rgba(15,30,60,.05),
      0 12px 28px -10px rgba(30,95,168,.10),
      inset 0 1px 0 rgba(255,255,255,.95);
    transition: box-shadow .25s ease, transform .25s ease;
  }
  /* Samsung Internet 点击蓝条修复:只针对卡片整行和内部链接 */
  .tbl-contracts tr,
  .tbl-contracts td,
  .tbl-contracts a {
    -webkit-tap-highlight-color: transparent;
  }

  /* 禁用卡片内文字选区:卡片是"按钮式整体跳转",不需要选文字。
     避免 Edge/Chrome 在手机模拟视口下产生蓝色选区背景假象 */
  .tbl-contracts tr {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  /* 清除文字选区颜色(防止其他情况下选中文字时蓝色高亮) */
  .tbl-contracts tr::selection,
  .tbl-contracts tr *::selection { background: transparent; }
  .tbl-contracts tr::-moz-selection,
  .tbl-contracts tr *::-moz-selection { background: transparent; }
  .tbl-contracts a:focus,
  .tbl-contracts a:active,
  .tbl-contracts a:focus-visible {
    outline: none;
  }
  .tbl-contracts td[data-label="名称"] a:visited { color: #1e3a5f; }
  .tbl-contracts td[data-label="签订日"] a:visited { color: #1e3a5f; }

  /* 「刚刚浏览过的卡片」高亮 — 2 秒淡出 */
  /* 「刚刚浏览过的卡片」高亮:用淡蓝背景渐入渐出(不用 box-shadow 扩散,避免在卡片边产生竖条) */
  .tbl-contracts tr.was-viewed {
    animation: viewedFade 1.6s ease;
  }
  @keyframes viewedFade {
    0%   { background: linear-gradient(180deg, rgba(204,224,250,.95), rgba(220,234,252,.85)); }
    100% { background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,253,.86)); }
  }

  /* 名称 = 卡片标题(独占第一行,大号粗体,不显示标签) */
  .tbl-contracts td[data-label="名称"] {
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 0 0 10px !important;
    margin-bottom: 8px;
    display: block !important;
  }
  .tbl-contracts td[data-label="名称"] a {
    font-size: 15.5px;
    font-weight: 600;
    color: #1e3a5f;
    text-decoration: none;
    line-height: 1.4;
    display: block;
  }

  /* 手机端:让签订日的链接「不再像链接」 */
  .tbl-contracts td[data-label="签订日"] a {
    display: contents;
    color: inherit !important;
    pointer-events: none;
  }

  /* Samsung Internet 在「被选中/聚焦」的卡片上会画一条蓝色 caret 竖线,
     禁用整个卡片的文字选择 + caret 颜色,彻底消除 */
  .tbl-contracts tr {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    caret-color: transparent;
  }
  .tbl-contracts tr * {
    caret-color: transparent;
  }

  /* 签订日:取消 link-strong 悬浮蓝色粗体效果 */
  .tbl-contracts td[data-label="签订日"] a.link-strong {
    color: #1e3a5f;
    font-family: inherit;
    font-weight: 500;
    font-size: 13.5px;
    letter-spacing: 0;
    background: none;
    padding: 0;
  }
  .tbl-contracts td[data-label="签订日"] a.link-strong:hover {
    text-decoration: none;
  }

  /* 金额加重显示 */
  .tbl-contracts td[data-label="金额"] .fld-val {
    font-weight: 600; color: #1e3a5f;
  }
  .tbl-contracts td[data-label="未付"] .money-bad,
  .tbl-contracts td[data-label="已付"] .money-bad { color: #c8342b; font-weight: 600; }
  .tbl-contracts td[data-label="未付"] .money-ok,
  .tbl-contracts td[data-label="已付"] .money-ok { color: #1a6e34; font-weight: 600; }

  /* 类型 chip 化 */
  .tbl-contracts .type-chip {
    background: rgba(30,95,168,.1);
    color: var(--primary-d, #1e5fa8);
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
  }

  /* 操作单元格美化:按钮变成淡蓝色胶囊 */
  .tbl-contracts td.action-cell {
    margin-top: 10px;
    padding-top: 10px !important;
    border-top: 1px solid rgba(0,0,0,.05) !important;
  }
  .tbl-contracts td.action-cell .act {
    flex: 1;
    padding: 8px 14px;
    background: linear-gradient(180deg, #f5f9ff, #e6efff);
    color: var(--primary-d, #1e5fa8);
    font-weight: 500;
    border-radius: 999px;
    border: .5px solid rgba(30,95,168,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  }
}

/* —— 回到顶部按钮(默认隐藏,手机端滚动一屏后出现) —— */
.back-to-top {
  display: none;
  position: fixed; right: 16px; bottom: 24px;
  z-index: 800;
  flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(30, 58, 95, .88);
  color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(10px);
}
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top span {
  font-size: 9px; line-height: 1; margin-top: 1px;
  letter-spacing: .5px;
}
.back-to-top.show {
  opacity: 1; transform: translateY(0);
}
.back-to-top:active {
  background: rgba(30, 58, 95, 1);
  transform: scale(.96);
}
@media (max-width: 1024px) and (pointer: coarse) {
  .back-to-top { display: flex; }
}


/* ============================================================
   📱 手机端覆盖:让侧边栏文字回来(覆盖 900px 那条只显示图标的规则)
   ============================================================ */
@media (max-width: 1024px) and (pointer: coarse) {
  .sidebar { width: 78%; max-width: 320px; }
  .sidebar .logo-text,
  .sidebar .logo-sub,
  .sidebar .nav-item span:not(.ico),
  .sidebar .user-info,
  .sidebar .nav-group,
  .sidebar .nav-sub,
  .sidebar .fold-arrow { display: ''; }
  .sidebar .logo-text { display: block; }
  .sidebar .logo-sub { display: block; }
  .sidebar .nav-item span:not(.ico) { display: inline; }
  .sidebar .user-info { display: block; }
  .sidebar .nav-group { display: block; }
  .sidebar .nav-sub { display: flex; }
  .sidebar .fold-arrow { display: inline-block; }
  .sidebar .nav-item { justify-content: flex-start; padding: 10px 14px; }
}

/* ============================================================
   🫧 全局液态玻璃风:统一圆角、表单/文件选择/原生按钮 都圆润化
   ============================================================ */

/* 所有原生 button(没套 .btn 类的)默认圆角 + 不留直角 */
button {
  font-family: inherit;
  border-radius: 10px;
}
button:not(.btn):not(.btn-primary):not(.btn-danger):not(.act):not(.btn-sm):not(.hamburger):not(.mt-logout):not(.flash-close):not(.back-to-top) {
  cursor: pointer;
}

/* 所有输入框统一更圆润的角 */
input[type=text], input[type=password], input[type=number],
input[type=date], input[type=email], input[type=tel], input[type=search],
select, textarea {
  border-radius: 10px;
  transition: all .2s var(--ease, ease);
}
textarea { border-radius: 12px; }

/* 文件选择按钮:浏览器原生那个丑按钮统一美化 */
input[type=file] {
  font-size: 13px;
  color: #5a6470;
  cursor: pointer;
}
input[type=file]::-webkit-file-upload-button,
input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #f5f7fb 0%, #e3e9f2 100%);
  color: #1e3a5f;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.7);
}
input[type=file]::-webkit-file-upload-button:hover,
input[type=file]::file-selector-button:hover {
  background: linear-gradient(180deg, #ffffff 0%, #ecf1f9 100%);
  box-shadow: 0 2px 6px rgba(30,95,168,.18), inset 0 1px 0 rgba(255,255,255,.8);
}
.file-input {
  padding: 10px 12px;
  background: rgba(245, 247, 251, .7);
  border: .5px dashed rgba(30, 95, 168, .35);
  border-radius: 12px;
}

/* 状态徽章圆润 */
.badge {
  border-radius: 999px !important;
  padding-left: 12px !important; padding-right: 12px !important;
}

/* 用户编辑内联表单的 select 圆润化 */
.edit-user-form input[type=text],
.edit-user-form select {
  border-radius: 10px !important;
}

/* PC/移动 显隐工具类 */
.mobile-only { display: none; }
@media (max-width: 1024px) and (pointer: coarse) {
  .pc-only { display: none !important; }
  .mobile-only { display: block; }
}

/* 手机:常显示的公司选择条 */
.mobile-company-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; padding: 10px 12px; border-radius: 12px;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.mobile-company-bar label {
  font-size: 13px; color: #666; flex-shrink: 0;
}
.mobile-company-bar select {
  flex: 1; padding: 8px 10px; border: 1px solid #d0d7de;
  border-radius: 8px; font-size: 15px; background: #fff;
}

/* 可折叠的筛选条(手机端用 JS 控制 .open) */
.filter-fold .filter-form-collapse { display: none; }
.filter-fold.open .filter-form-collapse { display: block; }
.filter-fold > .filter-sum {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: transparent; border: none;
  text-align: left;
  padding: 10px 14px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  font-size: 14px; font-weight: 500; color: #333;
}
.filter-fold > .filter-sum::-webkit-details-marker { display: none; }
.filter-fold > .filter-sum .fold-arrow {
  margin-left: auto; transition: transform .2s;
  color: #888;
}
.filter-fold.open > .filter-sum .fold-arrow { transform: rotate(180deg); }
.filter-fold .filter-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 8px;
  background: rgba(30,95,168,.12); color: var(--primary-d, #1e5fa8);
}
.filter-fold > form.filter-form-collapse { margin-top: 12px; }
@media (min-width: 1025px) {
  /* PC 上始终展开,隐藏触发按钮 */
  .filter-fold > .filter-sum { display: none !important; }
  .filter-fold .filter-form-collapse { display: block !important; margin-top: 0 !important; }
  .filter-fold {
    background: #fff; padding: 14px 16px;
    border-radius: 12px; margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }
}

/* ====== PDF 懒加载占位骨架 ====== */
.pdf-page.loading {
  background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: pdfShimmer 1.5s infinite;
  border: 1px solid #e0e0e0;
  position: relative;
}
.pdf-thumb.loading {
  background: linear-gradient(90deg, #f3f3f3 0%, #fafafa 50%, #f3f3f3 100%);
  background-size: 200% 100%;
  animation: pdfShimmer 1.5s infinite;
  min-height: 60px;
}
@keyframes pdfShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========= 固定资产模块专属样式 ========= */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.status-pill.status-in_use   { background: rgba(89, 200, 122, .15); color: #2a8a4a; border-color: rgba(89, 200, 122, .35); }
.status-pill.status-idle     { background: rgba(255, 184, 74, .15); color: #b76a00; border-color: rgba(255, 184, 74, .4); }
.status-pill.status-scrapped { background: rgba(142, 142, 147, .18); color: #5f5f63; border-color: rgba(142, 142, 147, .35); }
.status-pill.status-lost     { background: rgba(255, 69, 58, .15); color: #c0382b; border-color: rgba(255, 69, 58, .35); }

.form-card {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.form-section { margin-bottom: 20px; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section > h3 {
  font-size: 13px; font-weight: 600;
  color: #6e6e73;
  text-transform: uppercase; letter-spacing: .08em;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f4;
}
.form-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.form-row:last-child { margin-bottom: 0; }
.form-field {
  flex: 1 1 240px; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.form-field.grow { flex: 1 1 100%; }
.form-field > label {
  font-size: 12.5px; color: #6e6e73; font-weight: 500;
}
.form-field .req { color: #ff3b30; margin-left: 2px; }
.form-field input, .form-field select, .form-field textarea {
  padding: 9px 11px; font-size: 14px;
  border: 1px solid #d2d2d7; border-radius: 8px;
  background: #fff; color: #1d1d1f;
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: #5b9cf5;
  box-shadow: 0 0 0 3px rgba(91, 156, 245, .18);
}
.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f4;
  display: flex; gap: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.detail-card {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.detail-card.grow { grid-column: 1 / -1; }
.detail-card > h3 {
  font-size: 13px; font-weight: 600;
  color: #6e6e73;
  text-transform: uppercase; letter-spacing: .08em;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f4;
}
.kv-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0; font-size: 14px;
}
.kv-list dt { color: #86868b; font-weight: 500; }
.kv-list dd { margin: 0; color: #1d1d1f; }
.remark-text { white-space: pre-wrap; line-height: 1.6; color: #1d1d1f; font-size: 14px; margin: 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #86868b;
  background: #fff;
  border: 1px dashed #d2d2d7;
  border-radius: 12px;
}
.empty-state p { margin-bottom: 16px; font-size: 14px; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  background: #fff; color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, .3);
  border-radius: 8px; cursor: pointer;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(255, 59, 48, .08); }

.btn-sm {
  display: inline-block;
  padding: 4px 10px; font-size: 12.5px;
  border: 1px solid #d2d2d7; border-radius: 6px;
  color: #1d1d1f; background: #fff;
  transition: all .15s;
}
.btn-sm:hover { background: #f4f5f7; opacity: 1; text-decoration: none; }
.row-actions { white-space: nowrap; }
.row-actions .btn-sm { margin-right: 4px; }

/* ========= 资产模块·列表表格 ========= */
.table-wrap {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  margin-top: 16px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  background: #f8f9fb;
  color: #6e6e73;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .03em;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e5ea;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f4;
  color: #1d1d1f;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfd; }
.data-table tbody td a {
  color: #1e5fa8; font-weight: 500;
}
.data-table tbody td a:hover { text-decoration: underline; }
.row-actions {
  white-space: nowrap;
  display: flex; gap: 6px; flex-wrap: wrap;
}

/* ========= 资产模块·搜索/筛选条按钮独立成行 ========= */
.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f0f0f4;
}
.filter-actions .btn,
.filter-actions .btn-primary {
  padding: 8px 18px;
  font-size: 13.5px;
}

/* ========= 资产模块·手机卡片列表 ========= */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.data-card {
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 14px 16px;
  display: block;
  color: #1d1d1f;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.data-card:hover { background: #fafbfd; }
.data-card .dc-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 8px;
}
.data-card .dc-title { font-weight: 600; font-size: 15px; }
.data-card .dc-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: #6e6e73; line-height: 1.6;
}
.data-card .dc-meta + .dc-meta { margin-top: 4px; }

/* ========= 资产模块·详情网格(覆盖旧的 2fr/1fr,改为自适应卡片) ========= */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* ========= 资产模块·表单操作行间距 ========= */
.form-actions-spacer {
  flex: 1;
}
.form-actions {
  align-items: center;
  flex-wrap: wrap;
}

/* 资产列表的手机卡片在 PC 上隐藏(覆盖 .card-list 的 display:flex) */
.card-list.mobile-only { display: none; }
@media (max-width: 1024px) and (pointer: coarse) {
  .card-list.mobile-only { display: flex; }
}

/* ========= 资产详情·两列对齐网格(替代 auto-fit 造成的缺口) ========= */
.asset-detail-grid {
  grid-template-columns: 2fr 1fr;
  align-items: stretch;
}
.asset-detail-grid .span-left  { grid-column: 1; }
.asset-detail-grid .span-right { grid-column: 2; display: flex; flex-direction: column; gap: 16px; }
.asset-detail-grid .span-full  { grid-column: 1 / -1; }
.asset-detail-grid .span-right .detail-card { margin: 0; }

@media (max-width: 900px) {
  .asset-detail-grid {
    grid-template-columns: 1fr;
  }
  .asset-detail-grid .span-left,
  .asset-detail-grid .span-right { grid-column: 1; }
}

/* ========= 资产列表 PC 端:固定列宽 + 长文本省略,防止某行型号超长把其它列挤窄 ========= */
@media (min-width: 1025px), (pointer: fine) {
  .tbl-assets { table-layout: fixed; }
  .tbl-assets td { max-width: none; }
  .tbl-assets td:not(.cell-ellipsis):not(.action-cell):not(.nowrap) {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}

/* ========= 资产列表卡片增强(复用合同列表 .tbl-contracts 的样式) ========= */
@media (max-width: 1024px) and (pointer: coarse) {
  .tbl-assets tr {
    padding: 14px 16px;
    margin: 12px 10px;
    width: auto !important;
    box-sizing: border-box;
    border-radius: 16px;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      0 1px 1px rgba(15,30,60,.04),
      0 2px 6px rgba(15,30,60,.05),
      0 12px 28px -10px rgba(30,95,168,.10),
      inset 0 1px 0 rgba(255,255,255,.95);
    transition: box-shadow .25s ease, transform .25s ease;
    -webkit-user-select: none;
    user-select: none;
  }
  .tbl-assets tr,
  .tbl-assets td,
  .tbl-assets a {
    -webkit-tap-highlight-color: transparent;
  }
  .tbl-assets tr:active {
    box-shadow:
      0 1px 1px rgba(15,30,60,.04),
      0 2px 6px rgba(15,30,60,.06),
      0 4px 10px rgba(30,95,168,.10),
      inset 0 1px 0 rgba(255,255,255,.95);
    transform: translateY(1px);
  }
  /* 卡片里"名称"那一栏放大、字号粗 */
  .tbl-assets td[data-label="名称"] {
    font-size: 16px; font-weight: 600;
    color: #1e3a5f;
  }
  .tbl-assets td[data-label="名称"] .fld-lbl { display: none !important; }
  .tbl-assets td[data-label="名称"] a {
    color: #1e3a5f; text-decoration: none;
  }
}

/* ========= 资产分类蓝色胶囊(PC 表格 + 手机卡片 + 详情页统一) ========= */
.cat-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(30, 95, 168, .1);
  color: #1e5fa8;
  border: 1px solid rgba(30, 95, 168, .25);
}
.cat-chip[data-cat="其他"],
.cat-chip[data-cat=""] {
  background: rgba(142, 142, 147, .15); color: #5f5f63;
  border-color: rgba(142, 142, 147, .25);
}

/* ========= 资产流转时间线 ========= */
.card-head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.card-head-row h3 { margin: 0; }
.transfer-timeline {
  list-style: none; padding: 0; margin: 8px 0 0;
  position: relative;
}
.transfer-timeline::before {
  content: ""; position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: rgba(30, 95, 168, .15);
}
.transfer-timeline li {
  position: relative; padding: 0 0 14px 26px;
}
.transfer-timeline li:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: 0; top: 5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  border: 3px solid #1e5fa8;
  box-shadow: 0 0 0 2px rgba(30, 95, 168, .12);
}
.tl-body { font-size: 14px; line-height: 1.55; }
.tl-line1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-arrow { color: #1e5fa8; font-weight: 600; }
.tl-date {
  margin-left: auto; font-size: 12px; color: var(--text-s);
  background: var(--fill-1); padding: 1px 8px; border-radius: 4px;
}
.tl-reason {
  margin-top: 4px; padding: 6px 10px;
  background: var(--fill-1); border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.tl-meta {
  margin-top: 4px; font-size: 12px; color: var(--text-s);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.tl-void-btn {
  background: transparent; border: 1px solid rgba(220, 53, 69, .35);
  color: #b3261e; padding: 2px 10px; border-radius: 4px;
  font-size: 12px; cursor: pointer; transition: background .15s;
}
.tl-void-btn:hover { background: rgba(220, 53, 69, .08); }

/* 已作废条目:灰底 + 删除线 + 红字徽章 */
.transfer-timeline li.tl-voided .tl-dot {
  border-color: #b3b3b8;
  box-shadow: 0 0 0 2px rgba(142, 142, 147, .12);
}
.transfer-timeline li.tl-voided .tl-line1 strong,
.transfer-timeline li.tl-voided .tl-arrow {
  text-decoration: line-through;
  color: var(--text-s);
}
.tl-void-badge {
  display: inline-block;
  background: rgba(220, 53, 69, .12); color: #b3261e;
  border: 1px solid rgba(220, 53, 69, .3);
  padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.tl-void-info {
  margin-top: 6px; padding: 6px 10px;
  background: rgba(220, 53, 69, .06);
  border-left: 3px solid rgba(220, 53, 69, .5);
  border-radius: 4px;
  font-size: 12px; color: #8a261d;
}

/* ========= 通用模态弹层(流转表单等) ========= */
.modal-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
  animation: modalFadeIn .18s ease;
}
.modal-mask[hidden] { display: none; }
@keyframes modalFadeIn { from{opacity:0} to{opacity:1} }
.modal-card {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modalSlideIn .22s ease;
  overflow: hidden;
}
@keyframes modalSlideIn { from{transform:translateY(-12px);opacity:.4} to{transform:translateY(0);opacity:1} }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  background: none; border: 0; cursor: pointer;
  font-size: 22px; color: var(--text-s); padding: 0 6px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-card .form-section { padding: 16px 18px 0; }
.modal-card .form-actions {
  padding: 12px 18px 16px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .modal-card { max-width: 100%; }
  .modal-mask { padding: 12px; }
}

/* ========= 资产附件:照片缩略图 + 文档列表 ========= */
.detail-card { overflow: hidden; }     /* 兜底防附件区撑爆视口 */
.asset-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0 0;
  min-width: 0;
}
@media (max-width: 640px) {
  .asset-photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }
}
.asset-photo-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--fill-1);
  border: 1px solid var(--border);
}
.asset-photo-link {
  display: block; width: 100%; height: 100%;
}
.asset-photo-link img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .25s ease;
}
.asset-photo-cell:hover .asset-photo-link img { transform: scale(1.05); }
.asset-photo-del-form {
  position: absolute; top: 4px; right: 4px;
  margin: 0; padding: 0;
}
.asset-photo-del {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff;
  border: 0; cursor: pointer;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.asset-photo-cell:hover .asset-photo-del { opacity: 1; }
.asset-photo-del:hover { background: rgba(220, 53, 69, .9); }
@media (pointer: coarse) {
  .asset-photo-del { opacity: 1; }
}

.asset-doc-list {
  list-style: none; padding: 0; margin: 10px 0 0;
  display: flex; flex-direction: column; gap: 6px;
}
.asset-doc-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--fill-1);
  border-radius: 6px;
  border: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
}
.asset-doc-link {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  max-width: 100%;
  text-decoration: none; color: var(--text);
  overflow: hidden;
}
.asset-doc-link:hover .asset-doc-name { color: #1e5fa8; }
.asset-doc-icon { font-size: 18px; flex-shrink: 0; }
.asset-doc-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px;
}
.asset-doc-size {
  flex-shrink: 0;
  font-size: 12px; color: var(--text-s);
}
.asset-doc-del {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-s); font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  flex-shrink: 0;
}
.asset-doc-del:hover { background: rgba(220, 53, 69, .12); color: #b3261e; }

/* ========= 操作日志:模块徽章(蓝合同/绿资产/灰用户/灰系统) ========= */
.mod-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mod-contract {
  background: rgba(30, 95, 168, .1);
  color: #1e5fa8;
  border-color: rgba(30, 95, 168, .25);
}
.mod-asset {
  background: rgba(89, 200, 122, .15);
  color: #1a6e34;
  border-color: rgba(89, 200, 122, .3);
}
.mod-user {
  background: rgba(142, 142, 147, .15);
  color: #5f5f63;
  border-color: rgba(142, 142, 147, .25);
}
.mod-system {
  background: rgba(142, 142, 147, .08);
  color: #8e8e93;
  border-color: rgba(142, 142, 147, .2);
}

/* ========= 编辑页"危险操作"区(独立 form,避免 form 嵌套) ========= */
.form-card.danger-zone {
  margin-top: 16px;
  border: 1px solid rgba(220, 53, 69, .25);
  background: rgba(220, 53, 69, .03);
}
.danger-zone-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.danger-zone h3 { margin: 0 0 4px; color: #b3261e; }
@media (max-width: 640px) {
  .danger-zone-inner { flex-direction: column; align-items: stretch; }
  .danger-zone form { width: 100%; }
  .danger-zone .btn-danger { width: 100%; justify-content: center; }
}
