/* ================= 通用 ================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #f2f4f8;
  color: #1c1f23;
  font-size: 15px;
  line-height: 1.6;
}
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #f2f4f8; z-index: 50; }
.boot-spinner { width: 30px; height: 30px; border: 3px solid #d6e0ff; border-top-color: #2f6bff; border-radius: 50%; animation: spin .8s linear infinite; }
.boot-text { color: #7a8494; font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(28,31,35,.92); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 14px; max-width: 84vw; z-index: 99; text-align: center;
}
.toast.err { background: rgba(214,56,56,.94); }

/* ================= 员工端 ================= */
.page-employee { padding-bottom: 96px; }

.hero {
  position: relative; color: #fff; padding: 18px 18px 26px;
  background: linear-gradient(135deg, #2f6bff 0%, #4f8dff 55%, #6fa8ff 100%);
  border-radius: 0 0 22px 22px; box-shadow: 0 8px 22px rgba(47,107,255,.24);
}
.hero-top { display: flex; align-items: baseline; justify-content: space-between; }
.hero-month { font-size: 17px; font-weight: 600; }
.hero-name { font-size: 13px; opacity: .9; }
.hero-amount { text-align: center; margin: 14px 0 4px; }
.hero-num { display: block; font-size: 40px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.hero-cap { display: block; font-size: 12px; opacity: .85; margin-top: 2px; }
.hero-badge {
  display: inline-block; margin-top: 10px; padding: 3px 12px; border-radius: 20px;
  background: rgba(255,255,255,.2); font-size: 12px;
}
.hero-badge.is-confirmed { background: rgba(255,255,255,.92); color: #0f9d58; font-weight: 600; }
.hero .hero-badge { position: relative; }
.hero-badge { margin-left: 0; }
.month-switch {
  position: absolute; right: 16px; bottom: 14px;
  max-width: 46%;
  background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 8px; padding: 5px 8px; font-size: 13px; appearance: none; -webkit-appearance: none;
}
.month-switch option { color: #1c1f23; }

.notice {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 12px 12px 0; padding: 10px 12px; border-radius: 10px;
  background: #fff8e1; color: #8a6d1a; font-size: 13px; line-height: 1.5;
}
.notice-icon { flex: none; width: 16px; height: 16px; border-radius: 50%; background: #e6b800; color: #fff; font-size: 11px; text-align: center; line-height: 16px; font-weight: 700; }
.notice-close { margin-left: auto; flex: none; border: 0; background: none; color: #8a6d1a; font-size: 18px; line-height: 1; padding: 0 2px; }

/* 个人提醒（来自工资表「备注」列），如「本月有代扣事项」 */
.remark {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 12px 12px 0; padding: 10px 12px; border-radius: 10px;
  background: #fff4ec; border-left: 3px solid #f0813a; color: #9a4a12;
  font-size: 14px; line-height: 1.6;
}
.remark-tag {
  flex: none; font-size: 11px; background: #f0813a; color: #fff;
  border-radius: 4px; padding: 1px 6px; margin-top: 2px;
}

.group-title {
  margin: 18px 16px 6px; font-size: 13px; color: #8a93a2; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.group-title::after { content: ""; flex: 1; height: 1px; background: #e3e7ee; }

.rows { background: #fff; margin: 0 12px; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #f0f2f6; font-size: 15px;
}
.row:last-child { border-bottom: 0; }
.row .k { color: #4b5563; }
.row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .v.neg { color: #d63838; }
.row .v.zero { color: #a3abb8; font-weight: 400; }
.row.sub { background: #fafbfd; }
.row.sub .k, .row.sub .v { color: #1c1f23; font-weight: 700; }

.summary { margin: 14px 12px 0; padding: 12px 14px; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.summary-line { display: flex; justify-content: space-between; font-size: 13px; color: #6b7280; padding: 3px 0; }
.summary-line.total { font-size: 16px; color: #1c1f23; font-weight: 700; border-top: 1px dashed #e3e7ee; margin-top: 6px; padding-top: 8px; }
.summary-line .v { font-variant-numeric: tabular-nums; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); border-top: 1px solid #e8ebf1; backdrop-filter: blur(6px);
}
.btn-primary {
  width: 100%; border: 0; border-radius: 24px; padding: 13px 0; font-size: 16px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, #2f6bff, #4f8dff); box-shadow: 0 4px 14px rgba(47,107,255,.3);
}
.btn-primary:disabled { opacity: .55; }
.btn-ghost {
  border: 1px solid #d7dce5; background: #fff; color: #4b5563; border-radius: 8px; padding: 7px 12px; font-size: 13px;
}
.confirmed-tip { text-align: center; color: #0f9d58; font-size: 14px; padding: 6px 0; }
.confirmed-tip small { display: block; color: #8a93a2; font-size: 12px; margin-top: 2px; }

.empty { padding: 60px 24px; text-align: center; color: #8a93a2; }
.empty h3 { color: #4b5563; font-size: 16px; margin: 0 0 6px; }

.fallback { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: #f2f4f8; }
.fallback-card { background: #fff; border-radius: 14px; padding: 24px 20px; max-width: 420px; box-shadow: 0 4px 20px rgba(16,24,40,.08); }
.fallback-card h2 { font-size: 18px; margin: 0 0 8px; }
.fallback-card p { color: #6b7280; font-size: 14px; }
.fallback-alt { display: flex; gap: 8px; margin-top: 16px; }
.fallback-alt input { flex: 1; border: 1px solid #d7dce5; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.fallback-alt button { border: 0; border-radius: 8px; padding: 8px 14px; background: #2f6bff; color: #fff; font-size: 13px; }

/* ================= 管理端 ================= */
.page-admin { background: #eef1f6; }
.admin-top { background: #fff; border-bottom: 1px solid #e3e7ee; position: sticky; top: 0; z-index: 10; }
.admin-top-inner { width: 100%; max-width: 1180px; margin: 0 auto; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.admin-top h1 { font-size: 17px; margin: 0; }
.admin-top .who { margin-left: auto; font-size: 13px; color: #6b7280; }
.admin-top .who a { color: #2f6bff; text-decoration: none; margin-left: 10px; }

.tabs { background: #fff; border-bottom: 1px solid #e3e7ee; }
.tabs-inner { display: flex; gap: 4px; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 12px 14px; font-size: 14px; color: #6b7280; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: #2f6bff; border-bottom-color: #2f6bff; font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 14px 60px; }
.card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .sub { font-size: 12px; color: #8a93a2; font-weight: 400; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: #fafbfd; border: 1px solid #eef1f6; border-radius: 10px; padding: 12px 14px; }
.kpi .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: #8a93a2; }
.kpi.ok .n { color: #0f9d58; }
.kpi.warn .n { color: #e0821c; }
.kpi.bad .n { color: #d63838; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid #f0f2f6; text-align: left; white-space: nowrap; }
table.grid th { color: #6b7280; font-weight: 600; background: #fafbfd; position: sticky; top: 0; }
table.grid td.r, table.grid th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr:hover td { background: #f8faff; }
.table-scroll { overflow: auto; max-height: 62vh; border: 1px solid #eef1f6; border-radius: 10px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.pill.pending { background: #eef1f6; color: #6b7280; }
.pill.sent { background: #fff4e0; color: #b26a00; }
.pill.confirmed { background: #e6f6ec; color: #0f7a43; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: #6b7280; }
input[type=text], input[type=password], input[type=month], select {
  border: 1px solid #d7dce5; border-radius: 8px; padding: 8px 10px; font-size: 14px; background: #fff; color: #1c1f23;
}
input:focus, select:focus { outline: none; border-color: #2f6bff; }
.page-admin .form-row select {
  -webkit-appearance: none;
  appearance: none;
  height: 40px;
  min-width: 140px;
  max-width: 100%;
  padding: 8px 36px 8px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  transition: border-color .15s, box-shadow .15s;
}
.page-admin .form-row select:hover { border-color: #9baac0; }
.page-admin .form-row select:focus { border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
#sMonth, #qMonth, #impMonth { min-width: 160px; }
#sDept, #qDept { width: 220px; }

.btn { border: 1px solid #d7dce5; background: #fff; color: #374151; border-radius: 8px; padding: 8px 14px; font-size: 14px; }
.btn.primary { background: #2f6bff; border-color: #2f6bff; color: #fff; }
.btn.danger { background: #fff; border-color: #f0b4b4; color: #d63838; }
.btn:disabled { opacity: .5; }
.selbar { background: #f7f9ff; border: 1px solid #e3eaff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.selbar .btn { padding: 6px 11px; font-size: 13px; }
.selcount { font-size: 13px; color: #4b5563; margin-left: auto; }
.selcount b { color: #2f6bff; font-size: 15px; }
#listTable input[type=checkbox] { width: 16px; height: 16px; accent-color: #2f6bff; vertical-align: middle; }

.file-drop { border: 1.5px dashed #c8d2e2; border-radius: 10px; padding: 22px; text-align: center; color: #6b7280; background: #fafbfd; }
.file-drop.on { border-color: #2f6bff; background: #f2f7ff; }
.file-drop b { color: #2f6bff; }

.problems { margin-top: 10px; }
.problem { display: flex; gap: 8px; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: #fff5f5; color: #a32020; margin-bottom: 6px; }
.problem .t { flex: none; font-weight: 600; }
.warn { display: flex; gap: 8px; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: #fffbe8; color: #8a6d1a; margin-bottom: 6px; }
.warn .t { flex: none; font-weight: 600; }
.ok-line { font-size: 13px; color: #0f7a43; background: #eefaf2; padding: 8px 10px; border-radius: 8px; }
.hint { font-size: 12px; color: #8a93a2; line-height: 1.7; }
.hint code { background: #f2f4f8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
@media (max-width: 640px) { .admin-top .who { display: none; } }

.upload-file { display: flex; align-items: center; gap: 14px; padding: 16px; margin-top: 12px; background: #f5f9ff; border: 1px solid #dce6f5; border-radius: 10px; }
.upload-file-icon { flex: none; padding: 12px 8px; border-radius: 8px; background: #e0f3e9; color: #15804b; font-size: 12px; font-weight: 600; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-info strong { display: block; color: #263449; font-size: 14px; overflow-wrap: anywhere; }
.upload-file-info .hint { display: block; margin-top: 4px; }
.upload-file-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) { .upload-file { flex-wrap: wrap; } .upload-file-actions { width: 100%; justify-content: flex-end; } }
