/* ============================================================
   方案 A · 奶油糖果（Cream Candy）
   库房管理系统统一样式文件
   —— 暖奶油底 / 草莓糖果主色 / 大圆角 / 柔和分层阴影 / 克制动效
   仅改视觉，不改 DOM、字段、接口与业务逻辑。
   ============================================================ */

:root{
  --brand:#c93d66; --brand-deep:#a92e52; --brand-2:#c4498e;
  --ink:#3b2c33; --ink-2:#6b5760; --muted:#a3909b;
  --line:#f2e2da; --line-strong:#efdcd5;
  --bg:#fff8f3; --surface:#fffdfb; --surface-2:#fff3ec;
  --accent:#ffb26b; --mint:#7ed9c3;
  --success:#2f9e7a; --success-deep:#1f8a67;
  --danger:#d94a63; --danger-deep:#c93b52;
  --warn:#b8792a; --warn-deep:#a8691f;
  --sky:#4b7fc4;
  --topbar-h:56px;
  --r-card:22px; --r-sm:12px; --r-pill:999px;
  --shadow-card:0 2px 4px rgba(196,124,134,.06), 0 18px 34px -26px rgba(196,124,134,.5);
  --shadow-hover:0 4px 8px rgba(196,124,134,.08), 0 26px 46px -30px rgba(196,124,134,.6);
  --ease:cubic-bezier(.22,1,.36,1);
  --font:"Segoe UI",-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;

  /* 表单/对话框统一间距（与字号、颜色无关，只控制留白） */
  --form-label-gap:16px;     /* 标签到输入框 */
  --form-row-gap:26px;       /* 字段行与行 */
  --form-col-gap:20px;       /* 字段列与列 */
  --form-hint-gap:8px;       /* 输入框到提示文字 */
  --form-section-top:30px;   /* 分组标题上方 */
  --form-section-bottom:16px;/* 分组标题下方 */
  --dialog-pad:28px;         /* 对话框内边距 */
  --dialog-title-gap:20px;   /* 对话框标题到首行内容 */
  --dialog-footer-gap:26px;  /* 底部按钮与最后一行字段 */
  --dialog-btn-gap:12px;     /* 按钮之间 */
  --filter-gap:12px;         /* 筛选栏字段之间 */
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  min-height:100vh;
  font-family:var(--font);
  color:var(--ink-2);
  background:
    radial-gradient(900px 520px at 8% -12%, #ffe3ee 0%, rgba(255,227,238,0) 62%),
    radial-gradient(760px 480px at 96% 4%, #fff0d6 0%, rgba(255,240,214,0) 64%),
    radial-gradient(680px 520px at 74% 102%, #e9f8f2 0%, rgba(233,248,242,0) 60%),
    var(--bg);
  -webkit-font-smoothing:antialiased;
}

::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-thumb{background:#ecd8d1;border-radius:8px}
::-webkit-scrollbar-thumb:hover{background:#dfc1b8}
::-webkit-scrollbar-track{background:transparent}

/* ---------- 侧边栏 ---------- */
aside{width:236px}
aside.bg-white{
  background:rgba(255,253,250,.86)!important;
  backdrop-filter:blur(14px) saturate(140%);
  border-right:1px solid var(--line)!important;
}
aside .border-t{border-color:var(--line)!important}

.brand{display:flex;align-items:center;gap:11px;padding:20px 18px 16px}
.brand-logo{
  width:42px;height:42px;border-radius:15px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;font-size:21px;
  background:linear-gradient(135deg,#ff9dc0,#ffc37a);
  box-shadow:0 10px 22px -12px rgba(255,141,175,.9), inset 0 1px 0 rgba(255,255,255,.7);
  animation:candyFloat 6.5s ease-in-out infinite;
}
.brand h1{font-size:15px;font-weight:700;color:var(--ink);margin:0;line-height:1.25}
.brand p{font-size:11px;color:var(--muted);margin:3px 0 0}

.nav-item{
  padding:9px 12px;border-radius:var(--r-pill);cursor:pointer;
  color:var(--ink-2);display:flex;align-items:center;gap:10px;
  font-size:13.5px;
  transition:background .3s var(--ease), color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
  user-select:none;
}
.nav-item span{font-size:14px;line-height:1}
.nav-item:hover{background:#fff1ea;color:var(--brand)}
.nav-item:hover span{transform:translateY(-1px)}
.nav-item.active{
  background:linear-gradient(135deg,#d4476f,#b23a7d);
  color:#fff;font-weight:600;
  box-shadow:0 12px 22px -14px rgba(178,58,125,.85);
}
.nav-item:active{transform:scale(.985)}

/* ---------- 板块导航分组 ---------- */
.nav-group + .nav-group{margin-top:10px;padding-top:10px;border-top:1px dashed var(--line)}
.nav-group-title{
  padding:4px 12px 5px;font-size:11px;font-weight:700;letter-spacing:.08em;
  color:var(--muted);user-select:none;
}

.sidebar-user{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--ink-2);margin-bottom:10px;padding:0 2px}
.sidebar-avatar{
  width:27px;height:27px;border-radius:50%;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  background:#ffeaf1;color:var(--brand-deep);font-size:13px;font-weight:700;
}

/* ---------- 顶栏 ---------- */
.topbar{
  height:var(--topbar-h);
  background:rgba(255,251,247,.86);
  backdrop-filter:blur(12px) saturate(160%);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 24px;position:sticky;top:0;z-index:20;
}
.topbar h2{font-size:13px;font-weight:600;color:var(--muted);margin:0;letter-spacing:0}
.topbar h2::before{content:var(--board-crumb,"库房 / ");color:#c9b3bb}
.topbar .date{font-size:12.5px;color:var(--muted)}

/* ---------- 页面切换动效 ---------- */
.page-section{display:none}
.page-section.active{display:block;animation:candyFade .4s var(--ease)}

/* ---------- 表格 ---------- */
table{width:100%;border-collapse:separate;border-spacing:0;background:transparent}
th,td{padding:11px 14px;text-align:left;vertical-align:middle;font-size:13px;font-variant-numeric:tabular-nums}
th{
  background:#fff2ec;color:#a98b95;font-weight:600;font-size:11.5px;
  letter-spacing:.03em;white-space:nowrap;
  border-bottom:1px solid #f4e0d8;
  position:sticky;top:var(--topbar-h);z-index:5;
}
tbody td{border-bottom:1px solid #fbf0eb;color:var(--ink-2)}
tbody tr{transition:background .2s var(--ease)}
tbody tr:hover td{background:#fff7f2}
tbody tr:last-child td{border-bottom:none}
.nowrap{white-space:nowrap}

.pay-sort{cursor:pointer;user-select:none;transition:background .2s var(--ease), color .2s var(--ease)}
.pay-sort:hover{background:#ffe9e1;color:var(--brand-deep)}
.pay-sort:active{background:#ffe2da}
.cf-trigger{
  display:inline-flex;align-items:center;justify-content:center;
  width:18px;height:18px;margin-left:4px;border-radius:6px;
  color:#bda6af;vertical-align:middle;transition:background .2s, color .2s;
}
.cf-trigger:hover{background:#ffe4ec;color:var(--brand)}
/* 该列正在筛选：漏斗变主色 + 表头浅色底，避免筛选状态不可见 */
th.cf-on{background:#ffe9e1;color:var(--brand-deep)}
th.cf-on .cf-trigger{background:#ffdbe6;color:var(--brand)}
/* 已生效的列/月份筛选标签 */
.filter-chips{display:none;flex-wrap:wrap;align-items:center;gap:8px;margin:-4px 0 14px}
.fchip{
  display:inline-flex;align-items:center;gap:4px;max-width:260px;
  padding:3px 5px 3px 11px;border-radius:var(--r-pill);
  background:#fff1f5;border:1px solid #f7d3dd;
  font-size:11.5px;font-weight:600;color:var(--brand-deep);
}
.fchip > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fchip-x{
  border:0;background:transparent;color:#c86a86;cursor:pointer;
  font-size:15px;line-height:1;padding:0 4px;font-family:inherit;
}
.fchip-x:hover{color:var(--brand)}
.fchip-clear{
  border:0;background:transparent;color:var(--muted);cursor:pointer;
  font-size:11.5px;font-family:inherit;padding:3px 4px;
}
.fchip-clear:hover{color:var(--brand-deep);text-decoration:underline}

/* 列筛选浮层 */
.cf-pop{
  position:absolute;z-index:2000;width:300px;
  background:linear-gradient(180deg,#fffefd,#fffaf6);
  border:1px solid #f0dcd5;border-top:3px solid #d4476f;
  border-radius:16px;box-shadow:0 22px 48px -20px rgba(93,55,66,.45);
  padding:10px;font-size:13px;color:var(--ink);
  /* 视口不足时整体收缩，列表内部滚动，避免被窗口底边裁切 */
  display:flex;flex-direction:column;
  max-height:calc(100vh - 24px);
  box-sizing:border-box;
}
.cf-head,.cf-actions,.cf-foot{flex:0 0 auto}
.cf-pop input{width:auto;height:auto}
.cf-head{padding-bottom:2px}
.cf-head input{
  width:100%;height:32px;border:1px solid var(--line-strong);border-radius:10px;
  padding:0 16px;font-size:13px;box-sizing:border-box;outline:none;background:#fffefd;
}
.cf-head input:focus{border-color:#efadc0;box-shadow:0 0 0 3px rgba(217,79,116,.12)}
.cf-actions{display:flex;gap:12px;padding:8px 2px;border-bottom:1px solid #f7e9e3;color:var(--brand-deep);font-size:12px}
.cf-actions a{cursor:pointer}
.cf-actions a:hover{text-decoration:underline}
.cf-list{flex:1 1 auto;min-height:0;max-height:300px;overflow:auto;padding:4px 0}
.cf-group{margin:2px 0}
.cf-year{display:flex;align-items:center;gap:6px;padding:4px 2px;font-weight:600;cursor:pointer;color:var(--ink)}
.cf-caret{width:12px;color:#bda6af}
.cf-months{padding-left:22px}
.cf-month{display:flex;align-items:center;gap:6px;padding:3px 2px;cursor:pointer;border-radius:8px}
.cf-month:hover{background:#fff4f0}
.cf-item{display:flex;align-items:center;gap:6px;padding:4px 2px;cursor:pointer;border-radius:8px}
.cf-item:hover{background:#fff4f0}
.cf-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cf-count{color:var(--muted);font-weight:400}
.cf-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid #f7e9e3;padding-top:8px;font-size:12px;color:var(--muted)}
.cf-sel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cf-done{
  height:30px;padding:0 15px;border:0;border-radius:var(--r-pill);
  background:linear-gradient(135deg,#cf3f68,#b23a7d);color:#fff;cursor:pointer;
  font-size:12px;font-family:inherit;
  box-shadow:0 8px 16px -12px rgba(178,58,125,.9);
}
.cf-pop input[type=checkbox]{
  width:14px;height:14px;accent-color:var(--brand);margin:0;padding:0;
  border:0;border-radius:0;background:none;box-shadow:none;flex:none;cursor:pointer;
}

/* ---------- 徽章 ---------- */
.badge{
  display:inline-block;padding:2px 9px;border-radius:var(--r-pill);border:1px solid transparent;
  font-size:11.5px;font-weight:600;line-height:1.65;white-space:nowrap;
}
.badge-red{background:#ffe8ec;color:var(--danger-deep);border-color:#ffd4dc}
.badge-green{background:#e3f8ee;color:var(--success-deep);border-color:#c9efdc}
.badge-yellow{background:#fff3dc;color:var(--warn-deep);border-color:#ffe6b8}
.badge-blue{background:#eaf2ff;color:#3568b3;border-color:#d8e6ff}

/* ---------- 表单 ---------- */
/* 用 body 前缀提高特异性：页面同时引入 Tailwind CDN，其 Preflight 会在运行时注入
   button,input,select,textarea{padding:0} 且顺序在本文件之后，同等特异性会覆盖基础内边距 */
body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body select,
body textarea{
  width:100%;height:40px;box-sizing:border-box;
  padding:0 16px;
  border:1px solid var(--line-strong);border-radius:var(--r-sm);
  background:#fffefd;color:var(--ink-2);
  font-family:inherit;outline:none;
  transition:border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
/* 多行文本框：上下 12px、左右 16px，高度随行数自适应 */
body textarea{height:auto;padding:12px 16px;line-height:1.5}
input:hover,select:hover,textarea:hover{border-color:#e8c9c0}
input:focus,select:focus,textarea:focus{
  border-color:#efadc0;
  box-shadow:0 0 0 3px rgba(217,79,116,.12);
  background:#fff;
}
input::placeholder,textarea::placeholder{color:#b9a6af}
input:disabled,select:disabled{background:#fdf6f1;color:var(--muted);cursor:not-allowed;border-color:#f4e6df}
/* 下拉箭头右移：图形右缘距右边框 12px，文字区留足 38px */
body select{
  appearance:none;padding-right:38px;
  background-image:linear-gradient(45deg,transparent 50%,#b9929e 50%),linear-gradient(135deg,#b9929e 50%,transparent 50%);
  background-position:calc(100% - 22px) calc(50% + 1px),calc(100% - 17px) calc(50% + 1px);
  background-size:5px 5px,5px 5px;
  background-repeat:no-repeat;background-color:#fffefd;
}
textarea{resize:vertical}
label{display:block;margin-bottom:5px}
input[type="checkbox"]{width:auto;padding:0;margin:0;accent-color:var(--brand);cursor:pointer}
.divider{color:#cbb6bd;font-size:12px}

/* ---------- 按钮 ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:9px 17px;border:1px solid transparent;border-radius:var(--r-pill);
  font-size:13px;font-weight:600;line-height:1.2;white-space:nowrap;
  cursor:pointer;font-family:inherit;
  transition:transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn:active{transform:scale(.975)}
.btn:disabled{opacity:.45;cursor:not-allowed;transform:none!important;box-shadow:none!important}
.btn-sm{padding:5px 12px;font-size:12px;border-radius:var(--r-pill)}
.btn-primary{
  background:linear-gradient(135deg,#cf3f68,#b23a7d);color:#fff;
  box-shadow:0 10px 20px -14px rgba(178,58,125,.9), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 14px 26px -16px rgba(178,58,125,.95), inset 0 1px 0 rgba(255,255,255,.25)}
.btn-success{
  background:linear-gradient(135deg,#43b58f,#2f9e7a);color:#fff;
  box-shadow:0 10px 20px -14px rgba(47,158,122,.85), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-success:hover{transform:translateY(-1px)}
.btn-danger{background:#fffdfd;border-color:#f6cdd4;color:#cf4257}
.btn-danger:hover{background:#fff2f4;border-color:#f0aab5;transform:translateY(-1px)}
.btn-gray{background:#fffdfb;border-color:var(--line-strong);color:#846f76}
.btn-gray:hover{background:#fff8f5;border-color:#f0c7d2;color:var(--brand-deep);transform:translateY(-1px)}

/* ---------- 卡片 ---------- */
.card{
  background:linear-gradient(180deg,#fffefd,#fffaf6);
  border-radius:var(--r-card);padding:20px;
  border:1px solid var(--line);box-shadow:var(--shadow-card);
  transition:transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.card:hover{transform:translateY(-2px);box-shadow:var(--shadow-hover);border-color:#f4d9d0}
/* 筛选卡片承载联想/日期浮层：单独抬高层级，避免被下方表格粘性表头压住；
   交互中不做上浮，防止浮层跟着卡片抖动 */
.card.toolbar{
  position:relative;z-index:10;
  transition:box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.card.toolbar:hover{transform:none;box-shadow:var(--shadow-card);border-color:var(--line)}
.stat-card{
  background:linear-gradient(180deg,#fffefd,#fff9f5);
  border-radius:20px;padding:16px 17px;
  border:1px solid var(--line);box-shadow:var(--shadow-card);
  display:flex;align-items:center;gap:13px;
  transition:transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.stat-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-hover);border-color:#f4d9d0}
.stat-icon{
  width:44px;height:44px;border-radius:14px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  font-size:20px;background:#ffeaf1;
  animation:candyFloat 7s ease-in-out infinite;
}
.stat-card:nth-child(2n) .stat-icon{animation-delay:.8s}
.stat-card:nth-child(3n) .stat-icon{animation-delay:1.5s}
.stat-label{font-size:12px;color:var(--muted);margin-bottom:2px}
.stat-value{
  font-size:20px;font-weight:700;color:var(--ink);line-height:1.2;
  letter-spacing:-.02em;font-variant-numeric:tabular-nums;
}
.stat-sub{font-size:11px;color:#b6a2ab;margin-top:3px}

/* 兼容 JS 里写死的统计卡色值：统一换成糖果色板（不改 JS） */
.stat-icon[style*="#eef2ff"]{background:#ffeaf1!important;color:var(--brand)!important}
.stat-icon[style*="#eff6ff"]{background:#eaf2ff!important;color:var(--sky)!important}
.stat-icon[style*="#fef2f2"]{background:#ffe7ec!important;color:var(--danger)!important}
.stat-icon[style*="#f0fdf4"]{background:#e4f7ee!important;color:var(--success)!important}
.stat-icon[style*="#fffbeb"]{background:#fff0d9!important;color:var(--warn)!important}

[style*="color:#4f46e5"]{color:var(--brand-deep)!important}
[style*="color:#2563eb"]{color:var(--sky)!important}
[style*="color:#dc2626"]{color:var(--danger-deep)!important}
[style*="color:#16a34a"]{color:var(--success-deep)!important}
[style*="color:#d97706"]{color:var(--warn)!important}
[style*="color:#b45309"]{color:var(--warn-deep)!important}
[style*="color:#0f172a"]{color:var(--ink)!important}
[style*="color:#475569"]{color:var(--ink-2)!important}
[style*="color:#64748b"]{color:#7d6a73!important}
[style*="color:#94a3b8"]{color:var(--muted)!important}

/* Tailwind 工具类的糖果色覆盖 */
.text-green-600{color:var(--success-deep)!important}
.text-red-600{color:var(--danger-deep)!important}
.text-indigo-600{color:var(--brand-deep)!important}
.text-gray-700{color:#5e4a54!important}
.text-gray-500{color:#9c8792!important}
.text-gray-400{color:#b3a1aa!important}

.stat-click{cursor:pointer;user-select:none}
.stat-click:hover{border-color:var(--line-strong)}
.stat-click.active{
  border-color:#eb9bb3;
  box-shadow:0 0 0 3px rgba(217,79,116,.12), var(--shadow-card);
  background:linear-gradient(180deg,#fffafc,#fff1f5);
}
.stat-click.active .stat-label{color:var(--brand-deep)}

.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}
.grid-auto{display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:14px}

.card-title{
  display:flex;align-items:center;gap:8px;
  font-size:14.5px;font-weight:600;color:var(--ink);
  margin:0 0 14px;letter-spacing:-.01em;
}
.card-title .count{font-size:11.5px;font-weight:500;color:var(--muted)}
.empty{text-align:center;padding:44px 20px;color:#b7a3ac;font-size:13px}
td .empty{padding:30px 20px}
.hint{font-size:12px;color:var(--muted);line-height:1.65}
.progress{height:7px;border-radius:var(--r-pill);background:#ffe9e3;overflow:hidden}
.progress > i{
  display:block;height:100%;border-radius:var(--r-pill);
  background:linear-gradient(90deg,#f07d9d,#ffb26b);
  transform-origin:left;
  animation:candyGrow .7s var(--ease) both;
}

/* ---------- 分页 ---------- */
.dash-pager{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 2px 2px;font-size:12px;color:var(--muted)}
.dash-pager button{
  padding:5px 12px;border:1px solid var(--line-strong);border-radius:var(--r-pill);
  background:#fffefd;font-size:12px;color:#7c666e;cursor:pointer;font-family:inherit;
  transition:all .25s var(--ease);
}
.dash-pager button:hover:not(:disabled){background:#fff5f8;border-color:#f2c3d1;color:var(--brand-deep);transform:translateY(-1px)}
.dash-pager button:disabled{opacity:.4;cursor:not-allowed}

/* ---------- 定宽表格 ---------- */
.fixed-table{table-layout:fixed}
.fixed-table th,.fixed-table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fixed-table tbody tr{height:40px}
.fixed-table tbody tr.blank-row{cursor:default}
.fixed-table tbody tr.blank-row td{background:transparent;border-bottom-color:transparent;color:transparent}
.fixed-table tbody tr.blank-row:hover td{background:transparent}

/* 物品选择后短暂高亮的行 */
tr[style*="background:#e8ecff"]{background:#fff0f4!important}

/* ---------- 页头 ---------- */
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:16px}
.page-head .ph-title{
  display:flex;align-items:center;gap:9px;
  font-size:19px;font-weight:700;color:var(--ink);
  letter-spacing:-.01em;line-height:1.3;
}
.page-head .ph-sub{font-size:12.5px;color:var(--muted);margin-top:5px;line-height:1.6}
.count-chip{
  display:inline-flex;align-items:center;
  font-size:11.5px;font-weight:500;color:#a86b58;
  background:#ffeae2;border-radius:var(--r-pill);padding:2px 10px;
  letter-spacing:0;
}

/* ---------- 筛选栏 ---------- */
/* 筛选栏卡片需高于下方表格的 sticky 表头，否则搜索下拉列表会被表头遮住 */
.toolbar{display:flex;gap:var(--filter-gap);align-items:flex-end;flex-wrap:wrap;position:relative;z-index:10}
.toolbar > input,.toolbar > select{width:auto;align-self:flex-end}
/* 搜索字段给足宽度，占位提示不被右侧按钮挤掉；空间不足时整块换行 */
.toolbar .field[style*="flex:1"]{min-width:340px!important}
.field{display:flex;flex-direction:column;gap:var(--form-label-gap);min-width:0}
.field > label{font-size:13px;color:var(--ink-2);font-weight:500;margin:0;line-height:1.4;letter-spacing:.01em}
.field-btns{display:flex;gap:var(--dialog-btn-gap);align-self:flex-end;margin-left:auto;flex-shrink:0}
.field > .field-hint,.field > .hint{font-size:11.5px;color:var(--muted);line-height:1.5;margin-top:var(--form-hint-gap)}
.field-hint{font-size:11.5px;color:var(--muted);line-height:1.5;margin-top:var(--form-hint-gap)}
/* 弹窗内表单：统一的字段行/列间距 */
.form-grid{display:grid;gap:var(--form-row-gap) var(--form-col-gap);min-width:0}
/* 未用 .field 包裹的简单字段，标签与输入框同样留出统一间距 */
.form-grid > div > label:first-child{display:block;margin-bottom:var(--form-label-gap)}
.form-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.form-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.form-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:760px){
  .form-grid-3,.form-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:520px){
  .form-grid-2,.form-grid-3,.form-grid-4{grid-template-columns:minmax(0,1fr)}
}
.toolbar .field input::placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---------- 提示条 ---------- */
.alert{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 16px;border-radius:14px;font-size:12.5px;margin-bottom:16px;line-height:1.6}
.alert-warn{background:#fff7e9;border:1px solid #ffe2ba;color:#8a5b1f}

/* ---------- 表格选择栏 ---------- */
.sel-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;margin:0 0 14px;
  background:#fff8f3;border:1px solid #f4e1da;border-radius:14px;
  font-size:12.5px;color:var(--ink-2);
}
.sel-bar .sel-strong{color:var(--brand-deep);font-weight:700}

/* ---------- 日期区间 ---------- */
.date-range{
  display:flex;align-items:center;gap:8px;
  border:1px solid var(--line-strong);border-radius:var(--r-sm);
  background:#fffefd;padding:6px 16px;white-space:nowrap;
  transition:border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.date-range:hover{border-color:#e8c9c0}
.date-range:focus-within{border-color:#efadc0;box-shadow:0 0 0 3px rgba(217,79,116,.1)}
.date-range .dr-icon{font-size:13px;line-height:1;color:var(--brand)}
.date-range .dr-sep{color:#cbb6bd;font-size:12px}
.date-range input[type="date"]{width:auto;height:auto;min-width:112px;border:none;background:transparent;padding:4px 2px;font-size:12.5px;color:var(--ink-2);box-shadow:none}
.date-range input[type="date"]:hover,.date-range input[type="date"]:focus{border:none;box-shadow:none}
.dr-presets{display:flex;gap:5px;align-items:center;align-self:flex-end}
.dr-presets button{
  padding:5px 11px;border:1px solid var(--line-strong);border-radius:var(--r-pill);
  background:#fffefd;font-size:11.5px;color:#a08a92;cursor:pointer;
  font-family:inherit;transition:all .25s var(--ease);
}
.dr-presets button:hover{border-color:#f2c3d1;color:var(--brand-deep);background:#fff6f9;transform:translateY(-1px)}
.dr-presets button.active{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 8px 14px -10px rgba(201,61,102,.9)}

/* ---------- 筛选栏控件对齐（统一高度 / 标签基线 / 顶部底部对齐） ---------- */
.toolbar{--ctl-h:40px;--field-gap:var(--form-label-gap)}
.toolbar .field{gap:var(--field-gap);justify-content:flex-end}
/* 标签固定行高，保证各字段标签在同一基线 */
.toolbar .field > label{
  display:flex;align-items:center;
  height:16px;line-height:16px;
  font-size:12px;margin:0;
}
/* 单控件字段：输入框 / 下拉 / 联想输入框同高 */
.toolbar .field input:not([type="checkbox"]):not([type="hidden"]),
.toolbar .field select,
.toolbar .picker > input{
  height:var(--ctl-h);box-sizing:border-box;
  padding-top:0;padding-bottom:0;
}
.toolbar .field select{padding-right:38px}
/* 区间类字段（日期 / 金额）：内部一行与控件同高并垂直居中 */
.toolbar .field > div:not(.picker){
  min-height:var(--ctl-h);
  display:flex;align-items:center;box-sizing:border-box;
}
.toolbar .date-range{height:var(--ctl-h);padding:0 16px;gap:8px;align-items:center;box-sizing:border-box}
.toolbar .date-range input[type="date"]{
  height:calc(var(--ctl-h) - 2px);box-sizing:border-box;
  padding:0 2px;line-height:normal;
}
.toolbar .date-range .dr-icon,
.toolbar .date-range .dr-sep{display:flex;align-items:center;align-self:center;line-height:1}
.toolbar .date-preset-row,
.toolbar .dr-presets{min-height:var(--ctl-h);align-items:center}
.toolbar .dr-presets button{
  height:30px;padding:0 12px;
  display:inline-flex;align-items:center;justify-content:center;
}
/* 按钮组与字段组顶部/底部同高 */
/* 按钮组紧跟字段，间距与字段之间保持同一节奏（不再被 margin-left:auto 推到最右） */
.toolbar .field-btns{
  height:var(--ctl-h);align-items:center;align-self:flex-end;margin-left:0;
}
.toolbar .field-btns .btn{height:var(--ctl-h);padding:0 18px}
/* 输入框内边距统一：占位文字起始位置在四个页面保持一致 */
.toolbar .field input:not([type="checkbox"]):not([type="hidden"]),
.toolbar .picker > input{padding-left:16px;padding-right:16px}
.toolbar .field select{padding-left:16px}
/* 图标与文字、图标与占位文字的小间距统一 */
.toolbar .date-range{gap:8px}
.toolbar .date-range .dr-icon{font-size:12px;width:14px;justify-content:center}
.toolbar .btn{gap:6px}

/* ---------- 弹窗 ---------- */
.modal-mask{
  position:fixed;inset:0;z-index:100;
  background:rgba(59,44,51,.42);backdrop-filter:blur(4px);
  display:none;align-items:center;justify-content:center;padding:16px;
}
.modal-mask.show{display:flex}
.modal-box{
  background:linear-gradient(180deg,#fffefd,#fffaf6);
  border:1px solid #f4e2db;border-top:4px solid #f3c6d3;
  border-radius:26px;
  width:100%;max-width:620px;max-height:90vh;
  display:flex;flex-direction:column;overflow:hidden;
  box-shadow:0 28px 64px -30px rgba(93,55,66,.5);
  animation:candyPop .3s var(--ease);
  position:relative;
}
/* 内容区独立滚动：滚动条在弹窗内部，底部按钮栏不随内容滚动 */
.modal-body{
  flex:1 1 auto;min-height:0;overflow-y:auto;
  padding:var(--dialog-pad);
  padding-bottom:24px;
}
/* 统一关闭按钮：所有弹窗由 openModal 自动追加 */
.modal-close{
  position:absolute;top:14px;right:14px;z-index:3;
  width:30px;height:30px;border:0;border-radius:50%;
  background:#fff2ec;color:#b08d99;font-size:18px;line-height:1;
  cursor:pointer;display:inline-flex;align-items:center;justify-content:center;
  font-family:inherit;transition:background .2s, color .2s;
}
.modal-close:hover{background:#ffe2ea;color:var(--brand)}
#modalBox > h3,#modalBox > div > h3{padding-right:34px}
/* 弹窗按内容分档：普通表单 620 / 预览清单与归并 860 / 窄提示 460 */
.modal-box.modal-lg{max-width:860px}
.modal-box.modal-sm{max-width:460px}
/* 长表单：操作按钮固定在弹窗底部，内容区自己滚动 */
.modal-footer{
  position:static;z-index:2;flex:0 0 auto;
  margin-top:0!important;
  padding:14px var(--dialog-pad) calc(var(--dialog-pad) - 8px);
  background:linear-gradient(180deg,rgba(255,250,246,0),#fffaf6 42%);
  border-top:1px solid var(--line);
}
/* 操作行同时带 .flex.justify-end 时，取消上面的字段间距，改由内容区底部留白保证 */
#modalBox .flex.justify-end.modal-footer,
#modalBox .modal-actions.modal-footer{margin-top:0!important}
/* 弹窗底部操作行（未用 .modal-footer 的表单）：统一与最后一行字段拉开、按钮间距一致 */
#modalBox .flex.justify-end,
#modalBox .modal-actions{
  margin-top:var(--dialog-footer-gap)!important;
  gap:var(--dialog-btn-gap)!important;
  align-items:center;
}
/* 必填星号与字段级报错 */
.req{color:#e5484d;font-weight:700;margin-left:2px}
input.is-invalid,select.is-invalid,textarea.is-invalid{
  border-color:#e5484d!important;
  background:#fff7f7!important;
  box-shadow:0 0 0 3px rgba(229,72,77,.12)!important;
}
.field-error{color:#d93a3f;font-size:11.5px;line-height:1.4;margin-top:5px}
.empty-actions{margin-top:10px}
/* 操作列固定宽度：按钮数量变化时不再挤压/抖动其他列 */
table.tbl-ops th:last-child,table.tbl-ops td:last-child{width:112px;min-width:112px;white-space:nowrap}
table.tbl-ops-lg th:last-child,table.tbl-ops-lg td:last-child{width:190px;min-width:190px;white-space:nowrap}
table.tbl-ops-xl th:last-child,table.tbl-ops-xl td:last-child{width:240px;min-width:240px;white-space:nowrap}
table.tbl-ops td:last-child .btn,table.tbl-ops-lg td:last-child .btn,table.tbl-ops-xl td:last-child .btn{margin:1px 0}
/* 批量删除勾选列：窄列 + 垂直居中，不改变行高 */
table.tbl-ops th.col-check,table.tbl-ops td.col-check{
  width:36px;min-width:36px;max-width:36px;
  padding-left:12px;padding-right:0;text-align:center;
}
table.tbl-ops th.col-check input,table.tbl-ops td.col-check input{
  width:15px;height:15px;margin:0;cursor:pointer;vertical-align:middle;
  accent-color:var(--brand);
}
table.tbl-ops td.col-check input:disabled{cursor:not-allowed;opacity:.3}
/* 批量删除确认/结果：被跳过物品清单 */
.batch-skip-list{
  max-height:220px;overflow:auto;margin-top:2px;padding:6px 10px;
  border:1px solid var(--line);border-radius:10px;background:#fffdfc;font-size:12px;
}
.batch-skip-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:4px 0;border-bottom:1px dashed var(--line)}
.batch-skip-item:last-child{border-bottom:0}
.batch-skip-reason{color:#b23a7d;white-space:nowrap;flex:none}
/* 账期 + 快捷区间合成一个字段组，避免工具栏被拆成多行 */
.date-preset-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.date-preset-row .dr-presets{align-self:center}
/* 弹窗内不做粘性表头，避免压住数据行 */
.modal-box table th{position:static;top:auto}
/* 弹窗内清单：紧凑行高、金额右对齐 */
.preview-table th,.preview-table td{padding:8px 12px;font-size:12.5px}
.preview-table thead th{background:#fff3ec;color:#a98b95;font-size:11.5px}
.preview-table td.money,.preview-table th.money{text-align:right;font-variant-numeric:tabular-nums}
.preview-table tbody tr:hover td{background:#fff7f2}
/* ---------- Excel 导入 ---------- */
.import-drop{
  border:1.5px dashed #efc7d3;border-radius:18px;
  background:linear-gradient(180deg,#fffdfb,#fff8f3);
  padding:26px 18px;text-align:center;cursor:pointer;
  transition:border-color .2s,background .2s,transform .2s;color:var(--ink-2);
}
.import-drop:hover,.import-drop.dragover{border-color:var(--brand);background:#fff4f7;transform:translateY(-1px)}
.import-drop .imp-ico{font-size:30px;line-height:1.2;margin-bottom:6px}
.import-drop .imp-file{font-size:12px;color:var(--muted);margin-top:6px;word-break:break-all}
.import-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0}
.import-stat{border:1px solid var(--line);border-radius:14px;background:var(--surface);padding:10px 12px}
.import-stat h4{margin:0 0 6px;font-size:13px;color:var(--ink);font-weight:700}
.import-stat .row{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);padding:1px 0}
.import-stat .row b{color:var(--ink-2);font-variant-numeric:tabular-nums}
.import-err-list{max-height:300px;overflow:auto;border:1px solid #ffd4dc;border-radius:14px;background:#fff7f9;padding:8px 10px}
.import-err{font-size:12px;color:#a83248;line-height:1.55;padding:3px 0;border-bottom:1px dashed #ffe0e6;word-break:break-all}
.import-err:last-child{border-bottom:0}
.import-changes{max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:14px}
@media (max-width:640px){.import-stats{grid-template-columns:1fr}}
#modalBox h3{font-size:17px;font-weight:700;color:var(--ink);letter-spacing:-.01em;margin:0 0 var(--dialog-title-gap)!important}
/* 弹窗表单标签与筛选栏字段保持一致的字号与间距（复选行 .cf-item、勾选框 for 标签除外） */
#modalBox label:not(.cf-item):not([for]){font-size:13px;color:var(--ink-2);font-weight:500;line-height:1.4;margin-bottom:var(--form-label-gap)}
/* .field 的标签间距只由 flex gap 控制，避免被上面的 label 规则二次叠加 */
#modalBox .field > label{margin-bottom:0!important}
/* 花名册表单第一个分组标题与普通弹窗标题保持同一间距 */
#modalBox .staff-section-title:first-of-type{margin-top:var(--dialog-title-gap)}
/* 应付弹窗用 .stat-label 当字段标签，统一成同一规格 */
#modalBox label.stat-label{font-size:13px;color:var(--ink-2);font-weight:500;line-height:1.4;margin-bottom:var(--form-label-gap)}
/* 弹窗内联的旧灰色边框统一为奶油色 */
[style*="border-color:#e6eaf0"]{border-color:var(--line)!important}
[style*="border:1px solid #dfe6ee"]{border-color:var(--line)!important;background:#fffdfb!important}
[style*="border-bottom:1px dashed #e5e7eb"]{border-bottom-color:var(--line)!important}

/* ---------- 可搜索物品选择器 ---------- */
.picker{position:relative}
.picker-list{
  position:absolute;left:0;right:0;top:calc(100% + 5px);
  background:linear-gradient(180deg,#fffefd,#fffaf6);
  border:1px solid var(--line);border-radius:14px;
  box-shadow:0 18px 40px -16px rgba(93,55,66,.35);
  max-height:280px;overflow:auto;z-index:130;display:none;
}
.picker-list.show{display:block}
.picker-item{
  padding:9px 12px;font-size:13px;cursor:pointer;
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  border-bottom:1px solid #fbf0eb;transition:background .2s var(--ease);
}
.picker-item:last-child{border-bottom:none}
.picker-item:hover{background:#fff4f0}
/* 名称单行省略，右侧「货区 · 库存」固定不换行，避免挤成一团 */
.picker-item > span:first-child{
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.picker-item .meta{
  color:var(--muted);font-size:12px;white-space:nowrap;flex-shrink:0;
  max-width:52%;overflow:hidden;text-overflow:ellipsis;
}
/* 历史记录搜索：停用物品保留可选，灰色标签区分；名称仍单行省略，右侧信息不被挤掉 */
.picker-main{display:flex;align-items:center;gap:6px;min-width:0;flex:1}
.picker-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.picker-off{
  flex-shrink:0;white-space:nowrap;font-size:11px;line-height:1.6;
  padding:1px 7px;border-radius:var(--r-pill);
  background:#f6efea;color:var(--muted);border:1px solid var(--line);
}
.picker-item.is-off .picker-name{color:var(--muted)}
.picker-empty{padding:12px;color:#b7a3ac;font-size:12.5px;text-align:center}

/* ---------- 提示 ---------- */
.toast{
  position:fixed;top:18px;right:20px;z-index:300;
  padding:11px 18px;border-radius:var(--r-pill);
  background:#fff;color:var(--ink);
  border:1px solid #f3ddd6;font-size:13px;font-weight:600;
  opacity:0;transform:translateX(13px);
  transition:opacity .3s var(--ease), transform .3s var(--ease);
  pointer-events:none;
  box-shadow:0 18px 34px -20px rgba(93,55,66,.5);
}
.toast.show{opacity:1;transform:none}
.toast-success{background:#f6fdf9;border-color:#c9efdc;color:var(--success-deep)}
.toast-error{background:#fff5f7;border-color:#ffd4dc;color:#b5384d}
.toast-info{background:#fffaf0;border-color:#ffe2ba;color:#8a5b1f}

/* ---------- 登录页 ---------- */
.login-card{
  width:100%;max-width:390px;
  background:linear-gradient(180deg,rgba(255,254,253,.96),rgba(255,250,246,.96));
  backdrop-filter:blur(12px);
  border:1px solid var(--line);border-radius:26px;
  box-shadow:0 28px 64px -30px rgba(93,55,66,.5);
  padding:38px 34px;
  animation:candyPop .45s var(--ease);
}
.login-card .logo{
  width:56px;height:56px;border-radius:18px;margin:0 auto 16px;
  display:flex;align-items:center;justify-content:center;font-size:26px;
  background:linear-gradient(135deg,#ff9dc0,#ffc37a);
  box-shadow:0 14px 28px -14px rgba(255,141,175,.9), inset 0 1px 0 rgba(255,255,255,.7);
  animation:candyFloat 6.5s ease-in-out infinite;
}
.login-card h1{font-size:19px;font-weight:700;color:var(--ink);margin:0;text-align:center;letter-spacing:-.01em}
.login-card .sub{font-size:12.5px;color:var(--muted);text-align:center;margin-top:6px}
.login-card .field{display:block;margin-bottom:16px}
.login-card label{display:block;font-size:12.5px;font-weight:500;color:var(--ink-2);margin-bottom:6px}
.login-card input{padding:0 16px;font-size:14px;border-radius:var(--r-sm)}
.login-card button{
  width:100%;padding:12px;border:none;border-radius:var(--r-pill);
  font-size:14px;font-weight:600;color:#fff;cursor:pointer;font-family:inherit;
  background:linear-gradient(135deg,#cf3f68,#b23a7d);
  box-shadow:0 12px 24px -14px rgba(178,58,125,.9), inset 0 1px 0 rgba(255,255,255,.25);
  transition:transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.login-card button:hover{filter:brightness(1.05);transform:translateY(-1px)}
.login-card button:active{transform:scale(.985)}
.login-card .err{color:var(--danger-deep);font-size:12.5px;margin-bottom:12px}
.login-card .foot{text-align:center;font-size:11.5px;color:var(--muted);margin-top:16px}

/* ---------- 动效 ---------- */
@keyframes candyFade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes candyFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
@keyframes candyPop{from{opacity:0;transform:scale(.965) translateY(8px)}to{opacity:1;transform:none}}
@keyframes candyGrow{from{transform:scaleX(0)}to{transform:scaleX(1)}}

/* ---------- Tailwind 基础布局兜底 ----------
   页面仍走 CDN 版 Tailwind；这里只补布局关键类，
   断网或 CDN 缓慢时侧边栏/主区域/弹窗按钮不会塌掉 */
.flex{display:flex}
.flex-col{flex-direction:column}
.flex-1{flex:1 1 0%}
.flex-shrink-0{flex-shrink:0}
.items-center{align-items:center}
.justify-between{justify-content:space-between}
.justify-end{justify-content:flex-end}
.h-screen{height:100vh}
.w-full{width:100%}
.gap-2{gap:8px}
.p-3{padding:12px}
.pt-1{padding-top:4px}
.p-6{padding:24px}
.mt-4{margin-top:16px}
.mt-5{margin-top:20px}
.mb-4{margin-bottom:16px}
.mb-5{margin-bottom:20px}
.overflow-auto{overflow:auto}
.space-y-1 > * + *{margin-top:4px}
.text-xs{font-size:12px;line-height:1.5}
.text-lg{font-size:17px;line-height:1.5}
.font-medium{font-weight:500}
.font-semibold{font-weight:600}
.font-bold{font-weight:700}
.whitespace-nowrap{white-space:nowrap}
.border-t{border-top:1px solid var(--line)}
.border-r{border-right:1px solid var(--line)}
.bg-white{background:#fff}

/* ---------- 出库表格：固定列宽 + 操作列右侧吸附 ---------- */
/* 仅作用于出库页，不影响入库 / 物品 / 应付等表格 */
#page-outbound table{
  table-layout:fixed;width:100%;min-width:972px;
}
#page-outbound table th,
#page-outbound table td{padding:10px 8px;font-size:12px}
/* 列宽：勾选 / 时间 / 批次 / 物品 / 数量 / 剩余 / 领用人 / 部门 / 单价 / 员工价 / 总价 / 操作人 / 操作 */
#page-outbound table th:nth-child(1){width:36px}
#page-outbound table th:nth-child(2){width:118px}
#page-outbound table th:nth-child(3){width:90px}
#page-outbound table th:nth-child(4){width:104px}
#page-outbound table th:nth-child(5){width:54px}
#page-outbound table th:nth-child(6){width:68px}
#page-outbound table th:nth-child(7){width:62px}
#page-outbound table th:nth-child(8){width:62px}
#page-outbound table th:nth-child(9){width:61px}
#page-outbound table th:nth-child(10){width:65px}
#page-outbound table th:nth-child(11){width:69px}
#page-outbound table th:nth-child(12){width:63px}
#page-outbound table th:nth-child(13){width:118px}
/* 除操作列外一律单行省略；行高由 tr 统一固定 */
#page-outbound table td{
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  line-height:1.5;
}
#page-outbound table tbody tr{height:49px}
#page-outbound table td:last-child{
  overflow:visible;text-overflow:clip;
  text-align:right;
}
/* 批次只放徽章，收紧内边距 */
#page-outbound table td:nth-child(3){padding-left:4px;padding-right:4px}
#page-outbound table td:nth-child(3) .badge{
  max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;
}
/* 操作列吸附在右侧：不透明底色 + 左侧分隔阴影，滚动时不被内容穿透 */
#page-outbound table th:last-child,
#page-outbound table td:last-child{
  position:sticky;right:0;z-index:6;
  background:#fffcf8;
  border-left:1px solid var(--line);
  box-shadow:-12px 0 14px -12px rgba(93,55,66,.35);
}
#page-outbound table thead th:last-child{background:#fff2ec;z-index:7}
#page-outbound table tbody tr:hover td:last-child{background:#fff7f2}
/* 空状态整行占位不参与吸附 */
#page-outbound table td.empty{
  position:static;box-shadow:none;border-left:none;background:transparent;
  text-align:center;height:auto;
}
/* 操作列按钮更紧凑，两个按钮始终放得下；按钮与徽章统一 26px 高，行高稳定 */
#page-outbound table td:last-child .btn-sm{
  height:26px;padding:0 10px;
  display:inline-flex;align-items:center;vertical-align:middle;
  font-size:12px;line-height:1;
}
#page-outbound table td:last-child .btn + .btn{margin-left:4px}
#page-outbound table td:last-child .badge{
  display:inline-flex;align-items:center;height:26px;
  vertical-align:middle;line-height:1;
}
/* 窗口不足以容纳整表时，在卡片内横向滚动，操作列吸附仍然生效 */
@media (max-width:1279px){
  #page-outbound .card:has(table){overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
  #page-outbound .card{padding-bottom:12px}
}

/* ---------- 响应式 ---------- */
@media (max-width:1200px){
  .grid-4{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:900px){
  .grid-2{grid-template-columns:1fr}
}
@media (max-width:640px){
  /* 弹窗内写死的两列表单在窄屏改为单列，避免输入框被压到 150px */
  #modalBox [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
  .grid-4{grid-template-columns:1fr}
  .stat-card{padding:14px}
  .page-head{flex-direction:column;align-items:flex-start}
  .page-head .flex{flex-wrap:wrap}
  .field{flex:1 1 100%;min-width:100%}
  .toolbar .field[style*="flex:1"]{min-width:100%!important}
  .field-btns{margin-left:0;width:100%;justify-content:flex-end;flex-wrap:wrap}
  .date-range{width:100%}
  .date-range input[type="date"]{flex:1;min-width:0}
  .card{padding:14px;border-radius:18px}
  .dr-presets{flex-wrap:wrap}
  th,td{padding:9px 10px}
}
@media (max-width:880px){
  /* 窄窗口表格在卡片内横向滚动，保持列宽可读，不把页面撑破 */
  .page-section .card:has(table){overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
  .page-section .card:has(table) table{width:100%}
  .flex.h-screen{flex-direction:column;height:auto!important;min-height:100vh}
  aside.bg-white{width:auto!important;border-right:0!important;border-bottom:1px solid var(--line)!important}
  aside .brand{padding:14px 16px 6px}
  aside nav{
    display:flex;flex-direction:row;overflow-x:auto;
    padding:6px 12px 10px;gap:6px;
  }
  aside nav > * + *{margin-top:0!important}
  aside .nav-item{width:auto;flex-shrink:0;padding:8px 13px}
  aside nav .nav-group{display:contents}
  aside nav .nav-group-title{display:none}
  aside .sidebar-user{display:none}
  div.p-6{padding:16px}
  .topbar{padding:0 16px}
}

/* ---------- 工作台（板块选择） ---------- */
.ws-view{min-height:100vh;display:flex;flex-direction:column}
.ws-top{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:16px 28px;position:sticky;top:0;z-index:20;
  background:rgba(255,253,250,.88);backdrop-filter:blur(14px) saturate(140%);
  border-bottom:1px solid var(--line);
}
.ws-brand{display:flex;align-items:center;gap:12px}
.ws-brand h1{font-size:17px;font-weight:700;color:var(--ink);margin:0;line-height:1.25}
.ws-brand p{font-size:12px;color:var(--muted);margin:3px 0 0}
.ws-user{display:flex;align-items:center;gap:12px;font-size:13px;color:var(--ink-2)}
.ws-user b{color:var(--ink);font-weight:600}
.ws-main{flex:1;width:100%;max-width:1080px;margin:0 auto;padding:40px 24px 60px}
.ws-title{font-size:22px;font-weight:700;color:var(--ink);margin:0}
.ws-sub{font-size:13px;color:var(--muted);margin:8px 0 26px}
.ws-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
.ws-card{
  position:relative;display:flex;flex-direction:column;text-align:left;
  padding:26px 22px 24px;border-radius:var(--r-card);border:1px solid var(--line);
  background:linear-gradient(160deg,#fffdfb,#fff5ef);
  box-shadow:var(--shadow-card);cursor:pointer;
  transition:transform .3s var(--ease),box-shadow .3s var(--ease),border-color .3s var(--ease);
}
.ws-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-hover);border-color:#f3cfc2}
.ws-card:active{transform:scale(.99)}
.ws-card-icon{
  width:56px;height:56px;border-radius:18px;display:flex;align-items:center;justify-content:center;
  font-size:27px;background:linear-gradient(135deg,#ffe4ee,#ffe9cf);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}
.ws-card-name{font-size:17px;font-weight:700;color:var(--ink);margin-top:16px}
.ws-card-desc{font-size:12.5px;color:var(--muted);line-height:1.6;margin-top:6px}
.ws-card-arrow{position:absolute;right:20px;bottom:18px;color:#d9b3c0;font-size:18px;transition:transform .3s var(--ease)}
.ws-card:hover .ws-card-arrow{transform:translateX(3px);color:var(--brand)}
.ws-back{width:100%;justify-content:center}
.ws-denied{
  max-width:460px;margin:14vh auto;padding:38px 30px;text-align:center;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);
  box-shadow:var(--shadow-card);
}
.ws-denied-icon{font-size:40px;line-height:1}
.ws-denied h2{font-size:19px;color:var(--ink);margin:14px 0 8px}
.ws-denied p{font-size:13px;color:var(--muted);line-height:1.7;margin:0 0 22px}
@media (max-width:1023px){
  .ws-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:639px){
  .ws-top{padding:14px 16px}
  .ws-main{padding:26px 16px 44px}
  .ws-grid{grid-template-columns:1fr;gap:14px}
}

/* ---------- 花名册 ---------- */
.badge-gray{background:#f3f4f6;color:#6b7280;border-color:#e5e7eb}
.table-wrap{overflow-x:auto}
/* .table-wrap 是横向滚动容器，会成为 sticky 表头的定位参照，使表头按 top:56px 下移并压住首行；
   这里恢复为普通表头，保证首行完整可见（其他页面的表格不使用 .table-wrap，粘性表头不受影响） */
.table-wrap thead th{position:static}
.staff-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--form-row-gap) var(--form-col-gap)}
.staff-section-title{
  margin:var(--form-section-top) 0 var(--form-section-bottom);font-size:13px;font-weight:700;color:var(--ink-2);
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
}
.staff-kv-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px var(--form-col-gap)}
.staff-kv{min-width:0}
.staff-kv-label{font-size:11.5px;color:var(--muted);margin-bottom:2px}
.staff-kv-value{font-size:13px;color:var(--ink);word-break:break-all}

/* 部门层级：列表部门列显示「一级 › 二级」，父级用小字弱化，突出从属关系 */
.dept-path{display:inline-flex;align-items:baseline;gap:5px;white-space:nowrap}
.dept-parent{font-size:11px;color:var(--muted);font-weight:400}
.dept-sep{font-size:11px;color:#d8c2ca}
.dept-leaf{color:var(--ink-2);font-weight:600}
/* 盘点等复选框列表里的父级分组标题 */
.dept-group-label{padding:8px 2px 2px;font-size:11.5px;font-weight:700;color:var(--muted)}
@media (max-width:767px){
  .staff-form-grid,.staff-kv-grid{grid-template-columns:1fr}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
}
