/* ==========================================================================
   积分统计系统 · 全局样式
   --------------------------------------------------------------------------
   组织顺序：① 设计令牌 ② 基础元素 ③ 布局外壳 ④ 通用组件 ⑤ 业务模块样式
             ⑥ 响应式（1024 / 900 / 720 / 560）⑦ 可访问性与降级
   约定：类名向后兼容（旧类名一律保留），新增能力以追加方式实现。
   ========================================================================== */

/* ---------------------------------------------------------------- ① 设计令牌 */
/* 浅色（默认）——所有颜色一律走令牌，业务样式里不写死色值，暗色模式才能一并生效 */
:root {
  /* 基础表面与文字 —— 暖调中性色：底色带极轻的暖意，与橙色主色同源，避免"冷底+暖主色"的割裂感 */
  --bg: #f7f5f2;
  --card: #ffffff;
  --surface: #ffffff;              /* 顶栏 / 表头 / 弹窗等"抬升面" */
  --surface-2: #faf8f6;            /* 次级面：只读输入、缩略图底 */
  --line: #ebe6e0;
  --line-strong: #ddd6cd;
  --line-hover: #cdc4b8;           /* 输入/按钮 hover 边框 */
  --text: #1c1917;
  --text-2: #44403c;
  --muted: #78716c;
  --muted-2: #a8a29e;              /* 更淡的说明文字 */
  /* 主色：暖橙（高品质感的深橙，不用荧光橙） */
  --primary: #e8590c;
  --primary-dark: #c2410c;
  --primary-soft: #fff4ed;
  --on-primary: #ffffff;           /* 主色底上的文字 */
  --on-solid: #ffffff;             /* 成功/危险等实色底上的文字（暗色下反转为深色） */
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #f3c7c7;          /* 危险按钮的边框（浅） */
  --danger-line-2: #eab6b6;        /* 危险按钮 hover 边框 */
  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-line: #bbf7d0;
  --success-text: #166534;
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --warn-text: #92400e;
  --warn-strong: #b45309;          /* 周末/警示文字（可读性更高） */
  --info-line: #e7ddd3;            /* 中性信息条：改用暖灰描边，不再抢主色 */
  --info-text: #57534e;
  --hover: #faf8f6;
  --skeleton: #f0ece7;
  --skeleton-hi: #f8f5f1;
  --disabled-bg: #faf8f6;
  --readonly-bg: #f5f2ef;
  --chip-line: #d6cfc6;            /* 未绑定班次的虚线边 */
  --mask: rgba(28, 25, 23, .45);   /* 模态遮罩（暖黑，不用冷蓝黑） */
  --focus-ring: rgba(232, 89, 12, .14);

  /* 徽章 / 状态色（客诉、问题归总、班次类型）—— 统一收敛为低饱和暖色
     注：--b-orange-* 仍保留"橙"语义，但改用与主色不同的红橙调，避免与主色撞色 */
  --b-neutral-bg: #f2efec;  --b-neutral-fg: #44403c;  --b-neutral-fg-2: #78716c;
  --b-neutral-bg-2: #f5f2ef;
  --b-amber-bg: #fef3c7;
  --b-blue-bg: #eef2f7;     --b-blue-fg: #475569;   /* 中性灰蓝：退居次要，不与主色争 */
  --b-blue-bg-2: #e8eef5;   --b-blue-fg-2: #3f5266;
  --b-red-bg: #fee2e2;      --b-red-fg: #b91c1c;
  --b-orange-bg: #ffe4d3;   --b-orange-fg: #9a3412;
  --b-orange-bg-2: #fff1e8;
  --b-green-bg: #d9f2e0;
  --b-slate-bg: #eceae7;    --b-slate-fg: #57534e;
  --b-purple-bg: #ede9f7;   --b-purple-fg: #5b3fa8;
  --b-teal-bg: #e3f2ee;     --b-teal-line: #c7e5dd;  --b-teal-fg: #0f6e56;

  /* 尺寸与间距 —— 精致简约：更克制的圆角、更宽的留白、更松的行距 */
  --radius: 12px;
  --radius-sm: 8px;
  --content-max: 1240px;
  --gap: 12px;
  --gap-lg: 20px;
  --tap: 34px;                    /* 触摸目标最小高度 */

  /* 字号 */
  --fs-body: 14px;
  --fs-sm: 13px;
  --fs-xs: 12px;
  --fs-h2: 15px;
  --fs-h3: 14px;

  /* 阴影与动画 —— 去掉"厚阴影"，改用极轻的分层阴影 + 细描边表达层次 */
  --shadow-1: 0 1px 2px rgba(28, 25, 23, .04);
  --shadow-2: 0 12px 32px rgba(28, 25, 23, .10);
  --t-fast: .12s ease;
  --t-base: .18s ease;
}

/* 暗色（夜间）——只覆盖颜色令牌，尺寸/字号/动画沿用 :root
   挂载方式：<html data-theme="dark">；"跟随系统"由 app.js 写 data-theme 值决定。
   深色下阴影改为纯黑且更实，避免"发灰发糊"。 */
[data-theme="dark"] {
  /* 暖调暗色：底色用带棕调的深褐（而非冷蓝黑），与橙色主色同源 */
  --bg: #14110f;
  --card: #1c1917;
  --surface: #1c1917;
  --surface-2: #221e1b;
  --line: #302a26;
  --line-strong: #423a34;
  --line-hover: #564c44;
  --text: #f5f1ed;
  --text-2: #d6cfc8;
  --muted: #a39b94;
  --muted-2: #857d76;
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-soft: #2a1a10;
  --on-primary: #ffffff;
  --on-solid: #1c1917;             /* 暗色下 --success/--danger 偏亮，改用深字保证对比度 */
  --danger: #f87171;
  --danger-soft: #2a1a1a;
  --danger-line: #6b3232;
  --danger-line-2: #834040;
  --success: #4ade80;
  --success-soft: #12251a;
  --success-line: #235c39;
  --success-text: #86efac;
  --warn-bg: #2a2312;
  --warn-line: #4d3f1c;
  --warn-text: #fcd34d;
  --warn-strong: #fbbf24;
  --info-line: #3a332d;
  --info-text: #c4bcb4;
  --hover: #221e1b;
  --skeleton: #262220;
  --skeleton-hi: #2e2926;
  --disabled-bg: #211d1a;
  --readonly-bg: #262220;
  --chip-line: #4a423b;
  --mask: rgba(0, 0, 0, .66);
  --focus-ring: rgba(249, 115, 22, .28);

  --b-neutral-bg: #262220;  --b-neutral-fg: #d6cfc8;  --b-neutral-fg-2: #a39b94;
  --b-neutral-bg-2: #221e1b;
  --b-amber-bg: #3a2f14;
  --b-blue-bg: #262b31;     --b-blue-fg: #b9c4d0;
  --b-blue-bg-2: #2b323a;   --b-blue-fg-2: #cbd5e1;
  --b-red-bg: #3a1e1e;      --b-red-fg: #fca5a5;
  --b-orange-bg: #3d2113;   --b-orange-fg: #fdba74;
  --b-orange-bg-2: #33200f;
  --b-green-bg: #17301f;
  --b-slate-bg: #2a2523;    --b-slate-fg: #b8afa8;
  --b-purple-bg: #2a2340;   --b-purple-fg: #c4b5fd;
  --b-teal-bg: #142f2a;     --b-teal-line: #235246;  --b-teal-fg: #6ee7d0;

  /* 阴影也随主题覆盖：深底上必须加重，否则卡片/弹窗会"飘"起来 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .55);
}


/* ---------------------------------------------------------------- ② 基础元素 */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;   /* 精致感：字体渲染更细腻 */
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); }

/* 统一的按钮体系：默认（次级）/ primary（主操作）/ danger（危险）/ link（行内）
   / ghost（无边框浅色）/ mini（紧凑，表格行内）
   简约取向：默认按钮去掉边框改用浅底，只有主操作才用实色，减少页面"描边噪音" */
button {
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
button:hover { background: var(--hover); border-color: var(--line); color: var(--text); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 500; }
button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--on-primary); }
button.danger { color: var(--danger); border-color: var(--line); background: var(--surface); }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger-line-2); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
button.link { border: none; background: none; color: var(--primary); padding: 2px 6px; }
button.link:hover { background: none; text-decoration: underline; }
button.mini { padding: 3px 10px; font-size: var(--fs-xs); min-height: 26px; }
button:disabled { opacity: .45; cursor: not-allowed; background: var(--disabled-bg); border-color: transparent; }
button.primary:disabled { background: var(--primary); }

input, select, textarea {
  font-family: inherit;
  font-size: var(--fs-sm);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--line-hover); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring);
}
input[readonly] { background: var(--readonly-bg); color: var(--muted); border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
label { font-size: var(--fs-sm); color: var(--text-2); }

/* 屏幕阅读器专用（无障碍标签） */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- ③ 布局外壳 */
/* 登录 / 初始化 —— 进门第一印象：去掉卡片描边，用柔和阴影 + 更宽的留白 */
.auth-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background:
    radial-gradient(1000px 520px at 50% -12%, var(--primary-soft), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 372px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px;
  box-shadow: var(--shadow-2);
}
.auth-card h1 { margin: 0 0 6px; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.auth-card .sub { color: var(--muted); margin-bottom: 24px; font-size: var(--fs-sm); }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.auth-card button.primary { width: 100%; padding: 10px; margin-top: 8px; }
.hint { margin-top: 16px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }

/* 顶栏：品牌 + 主导航（窄屏时导航换行并横向滚动）+ 当前账号
   简约取向：去掉分割线，改用极轻的阴影；品牌字重收敛为 600，导航用下划线指示当前位置 */
.topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 22px; min-height: 58px; position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; white-space: nowrap; letter-spacing: .2px; }
.brand svg { flex: 0 0 auto; display: block; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: none; background: none; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 400; position: relative;
}
.tabs button:hover { background: transparent; color: var(--text); }
/* 当前位置：主色文字 + 底部细指示条（比"填充色块"更克制） */
.tabs button.active { background: transparent; color: var(--primary); font-weight: 600; }
.tabs button.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--primary);
}
/* 页面内子标签（合并页的页签）—— 浅底胶囊，选中项用主色实心 */
.tabs.sub { flex: none; width: max-content; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs.sub button { padding: 5px 16px; font-size: var(--fs-sm); color: var(--muted); border-radius: 7px; }
.tabs.sub button:hover { background: var(--card); color: var(--text); }
.tabs.sub button.active { background: var(--primary); color: var(--on-primary); font-weight: 500; }
.tabs.sub button.active:hover { background: var(--primary-dark); color: var(--on-primary); }
.tabs.sub button.active::after { content: none; }   /* 子页签不需要下划线 */
.me { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-left: auto; font-size: var(--fs-sm); }

/* 主题切换按钮：图标随模式换（浅色显月、深色显日），仅一个按钮，操作最少 */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm);
  background: transparent; border-color: transparent; color: var(--muted);
}
.theme-btn:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.theme-btn svg { display: block; }

main { max-width: var(--content-max); margin: 24px auto; padding: 0 22px; }

/* 统一页面头部：标题 + 一句话说明 + 右侧主操作 */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head .ph-main { min-width: 0; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.page-head .ph-desc { margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); }
.page-head .ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- ④ 通用组件 */
/* 卡片：精致简约的核心 —— 细描边承担层级，阴影几乎不可见（挪到 hover 才出现） */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--gap-lg); margin-bottom: var(--gap-lg);
  box-shadow: var(--shadow-1);
}
.card h2 { margin: 0 0 16px; font-size: var(--fs-h2); font-weight: 600; letter-spacing: -.1px; }
.card h3 { margin: 0 0 12px; font-size: var(--fs-h3); font-weight: 600; }
/* 卡片头部：标题在左、操作在右（页签标题也用它，形成 窗口 h1 → 页签 h2 → 卡片 的层级） */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.card-head .ph-main { min-width: 0; }
.card-head .ph-desc { margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); }
.card-head .ch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: var(--gap); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.g5 { grid-template-columns: repeat(5, 1fr); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 140px; }

/* 表格：横向可滚动 + 表头在可滚动区域内吸附 + 数字列等宽对齐
   简约取向：去掉外框，只用行分隔线；表头用浅底 + 更小字号，弱化存在感 */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.table-wrap table { min-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th {
  background: var(--surface-2); color: var(--muted); font-weight: 500;
  font-size: var(--fs-xs); letter-spacing: .3px;
  position: sticky; top: 0; z-index: 2;   /* 在设置 max-height 的容器内自动吸附表头 */
}
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 统计卡：数值为主角，去掉边框只留浅底 */
.stats { display: flex; gap: var(--gap); flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 18px; min-width: 120px;
}
.stat .k { font-size: var(--fs-xs); color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }

/* 提示条：默认黄色提醒；.info 中性说明；.ok 绿色 */
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text);
          padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--fs-sm); margin-bottom: 14px; }
.notice.info { background: var(--surface-2); border-color: var(--line); color: var(--info-text); }
.notice.ok { background: var(--success-soft); border-color: var(--success-line); color: var(--success-text); }

/* 空状态：一句话说明 + 一句怎么办 */
.empty { text-align: center; color: var(--muted); padding: 30px 16px; font-size: var(--fs-sm); }
.empty .hint { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted-2); }
.empty .actions { margin-top: 14px; }

/* 加载态：占位动画（避免"白屏/无反馈"） */
.loading { display: flex; align-items: center; justify-content: center; gap: 8px;
           padding: 26px 16px; color: var(--muted); font-size: var(--fs-sm); }
.loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-hi) 37%, var(--skeleton) 63%);
            background-size: 400% 100%; animation: shimmer 1.2s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* 分页条 */
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pager .pager-info { color: var(--muted); font-size: var(--fs-xs); }

/* 筛选条：紧凑一行（字段一多会自动换行），比"卡片 + 大栅格"更省滚动 */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.filter-bar .fitem { display: flex; flex-direction: column; gap: 4px; min-width: 128px; }
.filter-bar .fitem > label { font-size: var(--fs-xs); color: var(--muted); }
.filter-bar .fitem.kw { flex: 1 1 180px; }
.filter-bar .fbtns { display: flex; gap: 8px; align-items: flex-end; }

/* 徽章 —— 弱化底色的存在感：去掉"糖果色"，用低饱和暖色 + 更小的字号 */
.badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--b-neutral-bg); color: var(--b-neutral-fg); font-weight: 500; }
.badge.admin { background: var(--b-amber-bg); color: var(--warn-text); }
.badge.user { background: var(--b-blue-bg); color: var(--b-blue-fg); }

.muted { color: var(--muted); font-size: var(--fs-xs); }
.req { color: var(--danger); }
.err-text { color: var(--danger) !important; font-size: var(--fs-xs); margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); cursor: pointer; }

/* 轻提示 */
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 100; display: none; max-width: 92vw; }
.toast.show { display: block; }
.toast .inner { padding: 10px 20px; border-radius: 999px; color: var(--on-solid); font-weight: 500; font-size: var(--fs-sm); box-shadow: var(--shadow-2); }
.toast .inner.ok { background: var(--success); }
.toast .inner.err { background: var(--danger); }

/* 模态框：内联宽度受限（移动端不溢出）+ 内部可滚动 */
.modal-mask { position: fixed; inset: 0; background: var(--mask); display: flex;
              align-items: center; justify-content: center; z-index: 50; padding: 16px;
              backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 24px; width: 340px;
  max-width: 94vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-2);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal.wide { width: 540px; max-width: calc(100vw - 32px); }
.modal.narrow { width: 340px; }

/* 键值对 */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: var(--fs-sm); margin-bottom: 12px; }
.kv div { display: flex; gap: 6px; }
.kv span { color: var(--muted-2); flex: 0 0 52px; }

/* 时间线 */
.timeline { position: relative; padding-left: 16px; }
.tl-item { position: relative; padding: 0 0 16px 12px; border-left: 2px solid var(--line); }
.tl-item:last-child { border-left-color: transparent; }
.tl-dot { position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.tl-label { font-size: var(--fs-sm); }
.tl-body .muted { font-size: var(--fs-xs); margin-top: 2px; }

/* 进度条 */
.bar { height: 6px; background: var(--line); border-radius: 20px; overflow: hidden; }
.bar-inner { height: 100%; width: 0; background: var(--primary); transition: width .15s linear; }

/* ---------------------------------------------------------------- ⑤ 业务模块 */
/* 支付凭证：表单内网格预览（可逐张删除） */
.vpreview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.vpreview img, .vpreview .vv-pdf {
  width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.vp-meta { min-width: 0; }
.vp-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.vpreview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: stretch; }
.vp-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px;
           border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.vp-item img, .vp-item .vv-pdf { width: 48px; height: 48px; flex: 0 0 48px; object-fit: cover;
                                 border: 1px solid var(--line); border-radius: var(--radius-sm); }
.vp-item .vp-name { max-width: 96px; }
.vp-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--danger);
  font-size: 14px; cursor: pointer;
}
.vp-del:hover { background: var(--danger); color: var(--on-solid); border-color: var(--danger); }
.vp-req { color: var(--danger); font-size: var(--fs-xs); font-weight: 500; }

/* 只读查看凭证 */
.vv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-height: 46vh; overflow-y: auto; }
.vv-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface-2); }
.vv-thumb { width: 54px; height: 54px; flex: 0 0 54px; border: 1px solid var(--line); border-radius: var(--radius-sm);
            overflow: hidden; background: var(--readonly-bg); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.vv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vv-pdf { font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.vv-meta { flex: 1; min-width: 0; }
.vv-name { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vv-ops { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* 基础数据页：输入框统一收敛，行内编辑更紧凑 */
.base-page input:not([type="file"]):not([type="checkbox"]),
.base-page select, .base-page textarea { height: 30px; padding: 3px 8px; font-size: var(--fs-sm); max-width: 240px; }
.base-page textarea { height: auto; min-height: 60px; max-width: 420px; }
.base-page .grid { gap: 10px 14px; }
.base-page label { display: block; font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 4px; }
.base-page td label.pm-req { display: flex; align-items: center; gap: 6px; margin: 0; }

/* 客诉工单状态徽章 */
.badge.p-urgent { background: var(--b-red-bg); color: var(--b-red-fg); }
.badge.p-high   { background: var(--b-orange-bg); color: var(--b-orange-fg); }
.badge.p-medium { background: var(--b-amber-bg); color: var(--warn-text); }
.badge.p-low    { background: var(--b-slate-bg); color: var(--b-slate-fg); }
.badge.s-pending    { background: var(--b-blue-bg); color: var(--b-blue-fg); }
.badge.s-processing { background: var(--b-blue-bg-2); color: var(--b-blue-fg-2); }
.badge.s-resolved   { background: var(--b-green-bg); color: var(--success-text); }
.badge.s-closed     { background: var(--b-slate-bg); color: var(--b-slate-fg); }
.badge.s-archived   { background: var(--b-neutral-bg-2); color: var(--b-neutral-fg-2); }

/* 排班日历 */
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.cal-wrap { min-width: 0; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head div { text-align: center; font-size: var(--fs-xs); color: var(--muted); padding: 4px 0; }
.cal-head div.we { color: var(--warn-strong); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 104px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.cal-cell:hover { border-color: var(--primary); background: var(--hover); box-shadow: var(--shadow-1); }
.cal-cell.other { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.other:hover { border-color: transparent; box-shadow: none; }
.cal-cell.we { background: var(--surface-2); }
/* 今天：主色描边 + 极浅主色底（比"双线内阴影"更干净） */
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-day { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.cal-cell.we .cal-day { color: var(--warn-strong); }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-chip { font-size: 11px; line-height: 1.3; padding: 3px 6px; border-radius: 5px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
/* 跨天班次在"结束日"的承接条：虚线边框 + 略淡，与当日新增的班次区分开 */
.cal-chip.cal-carry { border-style: dashed; opacity: .85; }
.cal-more { font-size: 11px; color: var(--muted); }
.cal-chip.ub { background: var(--b-neutral-bg); color: var(--muted); border: 1px dashed var(--chip-line); }   /* 未绑定账号 */
.st-morning { background: var(--b-blue-bg-2); color: var(--b-blue-fg-2); }
.st-mid     { background: var(--b-purple-bg); color: var(--b-purple-fg); }
.st-night   { background: var(--b-orange-bg-2); color: var(--b-orange-fg); }
.st-off     { background: var(--b-neutral-bg-2); color: var(--b-neutral-fg-2); }

.sched-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sched-form .full { grid-column: 1 / -1; }
.sched-form label { display: block; font-size: var(--fs-xs); color: var(--text-2); margin-bottom: 4px; }
.sched-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 260px; overflow-y: auto; }
.sched-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
              padding: 9px 12px; font-size: var(--fs-sm); background: var(--surface-2); }
.sched-item .grow { flex: 1; min-width: 0; }
.sched-item .bind-sel { width: auto; flex: 0 0 auto; max-width: 200px; padding: 3px 6px; font-size: var(--fs-xs); }
.lock-badge { display: inline-block; margin-top: 2px; padding: 0 7px; border-radius: 999px; font-size: 11px;
              line-height: 18px; background: var(--b-neutral-bg); border: 1px solid var(--line-strong); color: var(--muted); }

/* 客诉问题归总 */
.issue-week { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; background: var(--surface-2); }
.issue-week-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
                   padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: var(--fs-h3); font-weight: 600; flex-wrap: wrap; }
.issue-badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 500;
               border: 1px solid var(--line); background: var(--b-neutral-bg); color: var(--b-neutral-fg); }
.issue-badge.found { background: var(--b-orange-bg-2); border-color: var(--b-orange-bg); color: var(--warn-strong); }
.issue-badge.reported { background: var(--b-teal-bg); border-color: var(--b-teal-line); color: var(--b-teal-fg); }
.issue-badge.archived { background: var(--b-neutral-bg); border-color: var(--line-strong); color: var(--muted); }
.issue-timeline { max-height: 260px; overflow: auto; border: 1px solid var(--line);
                  border-radius: 8px; padding: 8px 10px; background: var(--surface-2); }
.issue-note { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.issue-note:last-child { border-bottom: none; }

/* 查询条件栏（客诉工单等沿用 .qbar 结构；与 .filter-bar 同一视觉语言） */
.qbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 14px; }
.qfield { display: flex; flex-direction: column; gap: 4px; min-width: 128px; position: relative; }
.qlabel { font-size: var(--fs-xs); color: var(--muted); }
.qbar > button { flex: 0 0 auto; }
.qdate { display: flex; align-items: center; gap: 6px; }
.qdate input { width: 122px; }

/* ---------------------------------------------------------------- ⑥ 响应式 */
/* 平板：栅格降列、页面收紧 */
@media (max-width: 1024px) {
  main { padding: 0 16px; margin: 16px auto; }
  .grid.c4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .grid.c4, .grid.c3, .grid.g5 { grid-template-columns: repeat(2, 1fr); }
  .qdate input { width: 104px; }
  .page-head h1 { font-size: 17px; }
}

/* 手机：导航换行 + 横向滚动；栅格单列；模态与卡片内边距收紧 */
@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; min-height: 52px; }
  .tabs { order: 3; width: 100%; flex: 1 1 100%; }
  .brand { font-size: 15px; }
  .me { gap: 6px; }
  main { padding: 0 12px; margin: 12px auto; }
  .card { padding: 14px; margin-bottom: 14px; }
  .modal { padding: 18px; max-width: 96vw; max-height: 92vh; }
  .cal-wrap { min-width: 620px; }        /* 日历保持 7 列可读，横向滚动查看 */
  .cal-cell { min-height: 76px; padding: 4px; }
  .sched-form { grid-template-columns: 1fr; }
  .base-page input:not([type="file"]):not([type="checkbox"]),
  .base-page select, .base-page textarea { max-width: 100%; }
  .kv { grid-template-columns: 1fr; }
  .vv-grid { grid-template-columns: 1fr; }
  .table-wrap { border-radius: var(--radius-sm); }
  .page-head .ph-actions { width: 100%; }
}

/* 窄屏手机：一律单列，触摸目标加大 */
@media (max-width: 560px) {
  .grid.c2, .grid.c3, .grid.c4, .grid.g5 { grid-template-columns: 1fr; }
  .filter-bar .fitem { min-width: 100%; }
  .stats .stat { flex: 1 1 46%; min-width: 0; }
  .page-head h1 { font-size: 16px; }
}
@media (pointer: coarse) {
  button { min-height: var(--tap); }
  button.mini { min-height: 30px; padding: 5px 12px; }
  .tabs button { padding: 10px 12px; }
}

/* ---------------------------------------------------------------- ⑦ 可访问性与降级 */
/* 键盘可见焦点（鼠标点击不显示焦点环） */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }

/* 尊重"减少动效"偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- 组织架构（部门 / 岗位管理弹窗）---- */
.org-tree { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; background: var(--card); }
.org-node { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--radius-sm); }
.org-node + .org-node { border-top: 1px dashed var(--line); }
.org-node:hover { background: var(--hover); }
.org-node > span:first-child { font-weight: 500; }
.org-node .muted { font-size: var(--fs-xs); }
.org-ops { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
.link.mini { font-size: var(--fs-xs); padding: 1px 4px; }
