:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e3e8ef;
  --text: #1c2534;
  --muted: #6b7688;
  --faint: #98a2b3;
  --brand: #1f5fd6;
  --brand-dark: #17489f;
  --brand-soft: #e8f0fe;
  --green: #0f8a5f;
  --green-soft: #e6f6ef;
  --amber: #b8710a;
  --amber-soft: #fdf3e2;
  --red: #c0392f;
  --red-soft: #fdedeb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ───────── 登录 ───────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #1f3d73 0%, #2b5fa8 45%, #3f7fd4 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.login-card h1 { margin: 0 0 4px; font-size: 21px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; }

/* ───────── 布局 ───────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 210px;
  flex: 0 0 210px;
  background: #17233a;
  color: #c6d0e0;
  padding: 18px 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  padding: 0 20px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  margin-bottom: 12px;
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: #7d8ba3; margin-top: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 20px; cursor: pointer; font-size: 13.5px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.active { background: rgba(63, 127, 212, .18); border-left-color: var(--brand); color: #fff; font-weight: 500; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  border-radius: 9px; padding: 0 6px; font-size: 11px; line-height: 17px; min-width: 18px; text-align: center;
}
.sidebar .foot { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7d8ba3; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.content { padding: 20px 22px 48px; }

/* ───────── 通用组件 ───────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px; box-shadow: var(--shadow);
  /* 同一行的卡片高度由最高的那张决定（合计应发字大）。
     纵向居中，剩余空间平摊到上下，而不是全堆在下面显得空 */
  display: flex; flex-direction: column; justify-content: center;
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -.4px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--faint); font-size: 11.5px; margin-top: 2px; line-height: 1.5; }
.stat.hero { background: linear-gradient(135deg, #1f5fd6, #2f7ae5); border: none; color: #fff; }
.stat.hero .label, .stat.hero .hint { color: rgba(255, 255, 255, .82); }
.stat.hero .value { font-size: 31px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
tfoot td { font-weight: 600; background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.btn:hover { border-color: #c3cddb; background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red); border-color: #f0c9c5; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field label .req { color: var(--red); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > * { margin-bottom: 0; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.gray { background: #eef1f5; color: var(--muted); }

.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }

.empty { padding: 40px 20px; text-align: center; color: var(--faint); }

/* 工资构成瀑布 */
.breakdown { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 8px; overflow: hidden; }
.bd-row { display: flex; align-items: center; gap: 12px; background: var(--surface); padding: 11px 14px; }
.bd-row .name { flex: 1; min-width: 0; }
.bd-row .name small { display: block; color: var(--faint); font-size: 11.5px; }
.bd-row .amt { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; white-space: nowrap; }
.bd-row.total { background: #f0f5ff; }
.bd-row.total .amt { font-size: 19px; color: var(--brand); }

/* KPI 条 */
.kpi-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.kpi-row:last-child { border-bottom: none; }
.kpi-row .kname { width: 40%; min-width: 150px; }
.kpi-row .kname small { display: block; color: var(--faint); font-size: 11.5px; line-height: 1.4; }
.bar { flex: 1; height: 7px; background: #eef1f5; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar > i.warn { background: var(--amber); }
.bar > i.bad { background: var(--red); }
.kscore { width: 76px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* 提成盘子：已到手 / 本月 / 未提取 的堆叠条 */
.pipe-card { background: linear-gradient(135deg, #1f5fd6, #2f7ae5); color: #fff; border: none; }
.pipe-card .pipe-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pipe-card .pipe-amt { font-size: 34px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pipe-card .pipe-lab { font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.pipe-bar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: rgba(255, 255, 255, .22); margin: 16px 0 12px; }
.pipe-bar > i { display: block; height: 100%; }
.pipe-bar > i.now { background: #6ee7a8; }
.pipe-bar > i.later { background: rgba(255, 255, 255, .55); }
.pipe-legend { display: flex; gap: 22px; flex-wrap: wrap; font-size: 12.5px; }
.pipe-legend .item { display: flex; align-items: baseline; gap: 7px; }
.pipe-legend .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; align-self: center; }
.pipe-legend .dot.now { background: #6ee7a8; }
.pipe-legend .dot.later { background: rgba(255, 255, 255, .55); }
.pipe-legend .dot.done { background: rgba(255, 255, 255, .28); }
.pipe-legend b { font-size: 15px; font-variant-numeric: tabular-nums; }
.pipe-legend small { color: rgba(255, 255, 255, .72); }
.pipe-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .2);
  font-size: 12px; color: rgba(255, 255, 255, .78); line-height: 1.6; }

/* 趋势迷你柱图 */
.spark { display: flex; align-items: flex-end; gap: 5px; height: 96px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.spark .col > i { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; display: block; }
.spark .col > span { font-size: 10px; color: var(--faint); white-space: nowrap; }
.spark .col.now > i { background: var(--green); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.modal.wide { max-width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--faint); font-size: 20px; line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #1c2534; color: #fff; padding: 10px 18px; border-radius: 8px;
  z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.28); font-size: 13.5px;
}
.toast.err { background: var(--red); }

.note {
  background: var(--amber-soft); border: 1px solid #f3dfbc; color: #7a4d05;
  padding: 10px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px;
}
.note.info { background: var(--brand-soft); border-color: #c9dcfa; color: #1a4796; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs .tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13.5px; }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

@media (max-width: 820px) {
  .sidebar { width: 58px; flex: 0 0 58px; }
  .sidebar .brand, .nav-item span, .sidebar .foot { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .content { padding: 14px; }
}

/* ── 花名册导入预览 ────────────────────────────────── */
/* 阻断行整行染色：80 行的表格里，只在最右边一列写小红字是看不见的 */
.row-bad > td { background: var(--red-soft); }
.row-bad > td:first-child { box-shadow: inset 3px 0 0 var(--red); }

.msg-err, .msg-warn { font-size: 11.5px; line-height: 1.55; margin: 1px 0; }
.msg-err  { color: var(--red); }
.msg-warn { color: var(--amber); }

.banner { padding: 10px 13px; border-radius: 6px; font-size: 13px; line-height: 1.6; }
.banner.ok   { background: var(--green-soft); border: 1px solid var(--border); color: var(--green); }
.banner.warn { background: var(--amber-soft); border: 1px solid var(--border); color: var(--amber); }

input.mini, select.mini, select.sm {
  font-size: 12px; padding: 4px 6px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--surface); color: var(--text); max-width: 160px;
}
input.mini:focus, select.mini:focus, select.sm:focus {
  outline: 2px solid var(--brand); outline-offset: -1px;
}

/* 标记为「不导入」的行：压暗但仍可见，方便随时勾回来 */
.row-off > td { opacity: .45; }
.row-off > td:first-child { box-shadow: inset 3px 0 0 var(--faint); }

/* 工资条构成行里的固定说明（如管理费口径）—— 比 hint 更醒目一点，但仍是次要信息 */
.bd-row .bd-note {
  display: block;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  line-height: 1.6;
}

/* ── 我的状态：横向信息栏 ───────────────────────── */
/* 用 flex 不用 grid：字段只有两三个时，grid 会把它们拉开撑满整行，
   右边留一大片白；flex 让它们靠左挨着排，右侧自然收口 */
.profile-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 11px 16px; margin-bottom: 14px;
}
.pb-who { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pb-who b { font-size: 15px; }

/* 每一格整体换行，但格子内部（标签、数值、括注）都不许断 ——
   否则窄屏上「入职」会被拆成「入 / 职」两行 */
.pb-item { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; line-height: 1.5; }
.pb-item > * { white-space: nowrap; }
.pb-k { color: var(--faint); font-size: 12px; }
.pb-v { color: var(--text); font-variant-numeric: tabular-nums; }
.pb-x { color: var(--muted); font-size: 12.5px; }        /* 同一格里的次要数值 */
.pb-h { color: var(--faint); font-size: 11.5px; }        /* 括注 */
.pb-no { margin-left: auto; color: var(--faint); font-size: 12px; }

@media (max-width: 760px) {
  .profile-bar { gap: 6px 18px; }
  .pb-no { margin-left: 0; }
}

/* 需求满足度录入 */
.row-todo > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.row-todo > td { background: var(--amber-soft); }
input.mini.saved { border-color: var(--green); background: var(--green-soft); transition: background .3s; }

/* ── 员工档案 ────────────────────────────────────── */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.form-sec {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin: 14px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border);
}
.form-sec:first-child { margin-top: 0; }

.quick { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.quick a { color: var(--brand); cursor: pointer; margin-left: 8px; }
.quick a:hover { text-decoration: underline; }

.secret-box {
  display: grid; gap: 8px; padding: 14px 16px;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px;
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }

/* 「合计应发」旁的「考勤前」—— 整页最显眼的数字，口径必须同样显眼 */
.pre-att {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  font-size: 11px; line-height: 17px; border-radius: 4px;
  background: rgba(255, 255, 255, .22); color: #fff;
}

/* ── 行为守则 ────────────────────────────────────── */
.conduct .card-body { padding: 18px 22px; }
.cd-sec { padding: 4px 0 14px 14px; margin-bottom: 14px; border-left: 3px solid var(--border); }
.cd-sec:last-child { margin-bottom: 0; }
.cd-sec h4 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cd-no {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.cd-sec.red   { border-left-color: var(--red); }
.cd-sec.red h4 { color: var(--red); }
.cd-sec.amber { border-left-color: var(--amber); }
.cd-sec.amber h4 { color: var(--amber); }
.cd-sec.blue  { border-left-color: var(--brand); }
.cd-lead { margin: 0 0 8px; line-height: 1.8; }
.cd-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cd-items li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; line-height: 1.8; }
.cd-key {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 3px;
  border-radius: 5px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 600;
}
.cd-sec.red .cd-key { background: var(--red-soft); color: var(--red); }
.cd-sec.amber .cd-key { background: var(--amber-soft); color: var(--amber); }
