:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e6e8eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶栏 ---------------- */
.topbar { background: #0f172a; color: #fff; }
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.brand { color: #fff; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; display: inline-block; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a, .nav .linkbtn {
  color: #cbd5e1; font-size: 13px; padding: 6px 10px; border-radius: 7px;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav .linkbtn:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.nav form { margin: 0; }

/* ---------------- 下拉菜单 ---------------- */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: #f3f4f6; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px -14px rgba(16, 24, 40, .35); padding: 6px; min-width: 170px;
}
.menu-body a, .menu-body button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px;
  font-size: 13px; color: var(--ink); background: none; border: 0; cursor: pointer;
  text-decoration: none; font-family: inherit; white-space: nowrap;
}
.menu-body a:hover, .menu-body button:hover { background: #f3f4f6; text-decoration: none; }
.menu-body .danger { color: var(--red); }
.menu-body form { margin: 0; }
.menu.sm > summary {
  height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center;
}
.menu.sm > summary:hover { background: #f9fafb; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------------- 通用块 ---------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.card > h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; }
.card > h2 .hint { font-weight: 400; }

.flash {
  border-radius: 9px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
  background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
}
.flash:empty { display: none; }
.flash.err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 10px;
  border: 1px solid #e3e7ec; background: #fff; color: #1f2937;
  font-size: 13.5px; font-weight: 500; font-family: inherit; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .06s ease;
}
.btn:hover {
  background: #f7f9fc; border-color: #d3d9e2;
  box-shadow: 0 2px 6px -2px rgba(16, 24, 40, .16);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary {
  background: linear-gradient(180deg, #3b76f6 0%, #2563eb 100%);
  border-color: #2563eb; color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .3), 0 4px 12px -6px rgba(37, 99, 235, .6);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #2f6bef 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  box-shadow: 0 2px 4px rgba(37, 99, 235, .35), 0 8px 18px -8px rgba(37, 99, 235, .7);
}
.btn.danger { color: #c0392b; border-color: #f0d3d0; background: #fff; }
.btn.danger:hover { background: #fdf3f2; border-color: #e9b7b2; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

.badge {
  display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: #f2f4f7; color: #4b5563; line-height: 1.6; font-weight: 500;
  border: 1px solid transparent;
}
.badge.green { background: #e8f7ee; color: #157347; border-color: #d3efdf; }
.badge.blue { background: #eaf1fe; color: #1d4ed8; border-color: #dbe7fd; }
.badge.amber { background: #fdf3e2; color: #a16207; border-color: #f8e6c4; }
.badge.red { background: #fdeceb; color: #b42318; border-color: #f7d7d4; }
.badge.gray { background: #f2f4f7; color: #4b5563; border-color: #e9ecf1; }

/* ---------------- 统计 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent .v { color: var(--brand); }
.stat.ok .v { color: var(--green); }

.bar { height: 6px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
/* 隔行斑马纹 + 悬停高亮（hover 写在后面，优先于斑马纹） */
table.tbl tbody tr:nth-child(even) { background: #fafafa; }
table.tbl tbody tr:hover { background: #f5f7ff; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td { font-variant-numeric: tabular-nums; }
table.tbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
table.tbl .row-actions { white-space: nowrap; text-align: right; }
table.tbl .row-actions .act { margin-left: 4px; }
.act {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 11px; border-radius: 8px;
  border: 1px solid #dfe4ec; background: #fff; color: #374151;
  font-size: 12.5px; font-weight: 500; font-family: inherit; cursor: pointer;
  text-decoration: none; box-shadow: 0 1px 1px rgba(16, 24, 40, .03);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.act:hover { background: #f6f8fb; border-color: #cbd3df; color: #111827; text-decoration: none; }
.act.danger { color: #c0392b; border-color: #f0d3d0; background: #fff; }
.act.danger:hover { background: #fdf3f2; border-color: #e8b9b4; }
.inline-form { display: inline; }
td.bad, .bad { color: var(--red); font-size: 12px; }

.tbl-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tbl-tools input[type=text] { width: 240px; height: 34px; }
.tbl-tools select { width: 150px; height: 34px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
/* 空状态图标（替换 emoji） */
.empty svg.ico-empty { display: block; margin: 0 auto 6px; color: #9ca3af; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #374151; margin-bottom: 6px; }
.field .hint { margin-top: 4px; }
input[type=text], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink); min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea { min-height: 88px; line-height: 1.6; resize: vertical; }
input[type=file] {
  width: 100%; font-size: 13px; font-family: inherit; color: var(--muted);
  border: 1px dashed #cbd5e1; border-radius: 9px; background: #fafbfc; padding: 9px 10px; cursor: pointer;
}
input[type=file]:hover { border-color: #93c5fd; background: #f8fbff; }
input[type=file]::file-selector-button {
  font-family: inherit; font-size: 13px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; padding: 5px 12px; margin-right: 10px; cursor: pointer; color: var(--ink);
}
input[type=file]::file-selector-button:hover { background: #f3f4f6; }
.hint { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.inline-form { display: inline; margin: 0; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 45%, #f1f5f9 100%);
}
.login-card { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 26px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card .hint { margin-bottom: 22px; }

/* ---------------- 进度条块 ---------------- */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.note-box {
  background: #f8f9fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  font-size: 12.5px; color: #4b5563; white-space: pre-wrap; line-height: 1.7; max-height: 220px; overflow: auto;
}

/* ================= 员工端（手机） ================= */
body.h5 { background: #eff1f4; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
body.h5 input, body.h5 textarea { -webkit-user-select: auto; user-select: auto; }
/* iOS 在字号 <16px 的输入框聚焦时会自动放大页面，这里统一抬到 16px */
.h5-wrap input[type=text], .h5-wrap input[type=tel] { font-size: 16px; }
.h5-wrap input.code { font-size: 22px; }
body.h5 img { -webkit-user-drag: none; user-select: none; }

/* 平铺水印：姓名 + 手机尾号 + 日期，截图外传可溯源 */
.wm {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: .075; background-repeat: repeat;
}
.h5-wrap { max-width: 520px; margin: 0 auto; padding: 14px 12px 24px; }
.h5-wrap.has-fixed { padding-bottom: 96px; }

.h5-top { text-align: center; padding: 10px 0 14px; color: var(--muted); font-size: 12px; }
.h5-top .co { color: var(--ink); font-size: 14px; font-weight: 600; }

.h5-card {
  background: #fff; border-radius: 16px; padding: 18px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .2);
}
.h5-card h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }

.hero { text-align: center; padding: 6px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.hero .name { font-size: 18px; font-weight: 600; }
.hero .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.hero .amount-label { color: var(--muted); font-size: 12px; margin-top: 14px; }
.hero .amount { font-size: 34px; font-weight: 700; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.hero .amount small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }

.items { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.items td { padding: 8px 0; border-bottom: 1px dashed #eef0f3; }
.items tr:last-child td { border-bottom: 0; }
.items td.v { text-align: right; font-variant-numeric: tabular-nums; }
.items td.v.strong { font-weight: 600; }
.items tr.folded { display: none; }
.items tr.folded.show { display: table-row; }

.sum { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; }
.sum .row { display: flex; justify-content: space-between; padding: 3px 0; color: #374151; }
.sum .row.total { font-size: 15px; font-weight: 600; color: var(--ink); padding-top: 8px; }

.notice-wrap { position: relative; }
.notice { font-size: 12.5px; color: #4b5563; line-height: 1.75; max-height: 108px; overflow: hidden; white-space: pre-wrap; }
.notice-wrap.open .notice { max-height: none; }
.notice-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(rgba(255,255,255,0), #fff); pointer-events: none; }
.notice-wrap.open .notice-fade { display: none; }
.notice-toggle {
  font-size: 12.5px; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 4px;
  width: 100%; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fafbfc; color: var(--brand);
}
.notice-toggle:hover { background: #f2f6ff; border-color: #bfdbfe; text-decoration: none; }

.sign-area { position: relative; background: #fff; border-radius: 12px; }
.sign-canvas {
  width: 100%; height: 190px; display: block; background: transparent;
  border: 1px dashed #cbd5e1; border-radius: 12px; touch-action: none; cursor: crosshair;
  position: relative; z-index: 2;
}
.sign-tip {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 12px;
  color: #c3c9d2; font-size: 13px; pointer-events: none;
}
.sign-tip.hide { display: none; }
.sign-err { display: none; margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: var(--red); }
/* 楷体对照：浅灰显示本人姓名，给员工做正楷参考；只是 DOM 层，不会进签名图 */
.sign-guide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: KaiTi, STKaiti, "楷体", "Kaiti SC", serif;
  font-size: 52px; letter-spacing: 18px; text-indent: 18px;
  color: #e4e9f1; pointer-events: none; user-select: none;
}
.sign-bar { display: flex; gap: 8px; margin-top: 10px; }
.sign-bar .btn { flex: 1; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #374151; padding: 12px 0 2px; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }

.fixed-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.fixed-bottom .inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; }
.fixed-bottom .btn { flex: 1; height: 44px; font-size: 15px; border-radius: 11px; }

input.code {
  text-align: center; letter-spacing: 12px; font-size: 22px; height: 52px;
  font-variant-numeric: tabular-nums; padding-left: 12px;
}
.err-text { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; text-align: center; }

.done-icon {
  width: 64px; height: 64px; border-radius: 50%; background: #dcfce7; color: #16a34a;
  display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 6px auto 14px;
}

/* 已签收印章 */
.stamp-card { position: relative; overflow: hidden; }
.stamp {
  position: absolute; right: 16px; bottom: 14px;
  border: 3px solid #d64545; color: #d64545; border-radius: 10px;
  padding: 6px 10px 5px; font-weight: 700; font-size: 17px; line-height: 1.1;
  letter-spacing: 3px; transform: rotate(-14deg); opacity: .72; text-align: center;
}
.stamp small { display: block; font-size: 9px; letter-spacing: .6px; font-weight: 500; margin-top: 3px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 520px) {
  .wrap { padding: 16px 12px 48px; }
  .card { padding: 16px; }
  .topbar-in { padding: 0 12px; gap: 12px; }
  .nav a, .nav .linkbtn { padding: 6px 8px; }
}

/* ---------------- 上传拖拽区 ---------------- */
.drop {
  position: relative; border: 1.5px dashed #d8dee8; border-radius: 12px;
  padding: 22px 18px; background: #fcfdff; text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.drop.over { border-color: #3b82f6; background: #eff6ff; }
.drop input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
}
/* 文字层不挡点击，整个虚线框都能唤起文件选择 */
.drop .pick-row, .drop .hint { position: relative; z-index: 1; pointer-events: none; }
.drop .pick-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.drop .filename { font-size: 13px; color: var(--muted); }
.drop .filename.has { color: var(--ink); }

/* ---------------- 设置页目录 ---------------- */
.settings-layout { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  display: block; padding: 7px 10px; border-radius: 8px; font-size: 13px;
  color: #4b5563; text-decoration: none; border-left: 2px solid transparent;
}
.settings-nav a:hover { background: #f3f4f6; color: var(--ink); text-decoration: none; }
.settings-nav a.active { background: #eff6ff; color: var(--brand-dark); font-weight: 500; border-left-color: var(--brand); }
.settings-main { min-width: 0; }
.settings-main .card + .card { margin-top: 20px; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .settings-nav { display: none; }
}

/* ---------------- 员工端：核对页垂直居中 ---------------- */
.h5-wrap.h5-center { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

