/* ==========================================================================
   钉钉智能工资条 · 基础样式
   设计取向：贴近钉钉后台与智能工资条的观感，蓝色主色、卡片化、无花哨装饰
   ========================================================================== */

:root {
  --brand: #1677ff;
  --brand-dark: #0e5fd8;
  --brand-soft: #e8f1ff;
  --slip-a: #2b7bff;
  --slip-b: #1450c8;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e5e6eb;
  --bg: #f5f6f8;
  --white: #fff;
  --ok: #00b578;
  --warn: #ff8f1f;
  --danger: #f5483b;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(31, 35, 41, .06);
  --shadow-lg: 0 8px 32px rgba(31, 35, 41, .14);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--brand-soft); }

/* ------------------------------- 通用控件 ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); cursor: pointer; white-space: nowrap;
  transition: .15s; font-weight: 500;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #ffcfcb; }
.btn.danger:hover { background: #fff2f1; border-color: var(--danger); color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 42px; padding: 0 26px; font-size: 15px; }
.btn.block { width: 100%; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--white); outline: none; transition: .15s;
}
.textarea { height: auto; padding: 8px 12px; resize: vertical; min-height: 76px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 119, 255, .1); }
.input::placeholder { color: var(--text-3); }

.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text-2); }
.field .hint { margin-top: 5px; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.field .req::after { content: ' *'; color: var(--danger); }

.switch { position: relative; display: inline-block; width: 42px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d0d3d9; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch i::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::before { transform: translateX(20px); }

.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; line-height: 20px; background: var(--brand-soft); color: var(--brand); }
.tag.gray { background: #f0f1f3; color: var(--text-2); }
.tag.ok { background: #e5f7ef; color: var(--ok); }
.tag.warn { background: #fff3e5; color: var(--warn); }
.tag.danger { background: #ffefee; color: var(--danger); }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; font-size: 15px; font-weight: 600; }
.card-title small { font-weight: 400; font-size: 12px; color: var(--text-3); }

.row { display: flex; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }

/* --------------------------------- 表格 -------------------------------- */
.tbl { font-size: 13px; }
.tbl th { text-align: left; padding: 10px 12px; background: #fafbfc; color: var(--text-2); font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f2f3f5; vertical-align: middle; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }

/* --------------------------------- 弹窗 -------------------------------- */
.mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 20px; }
.modal { background: var(--white); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; display: flex; align-items: center; }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-x { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; }
.modal-x:hover { color: var(--text); }

/* --------------------------------- 提示 -------------------------------- */
#toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 20px; border-radius: 8px; background: rgba(31, 35, 41, .92); color: #fff;
  font-size: 14px; box-shadow: var(--shadow-lg); max-width: 80vw; animation: pop .2s ease-out;
}
.toast.ok { background: rgba(0, 181, 120, .95); }
.toast.err { background: rgba(245, 72, 59, .95); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.65; margin-bottom: 14px; }
.alert.info { background: var(--brand-soft); color: #0e5fd8; }
.alert.warn { background: #fff7e8; color: #a8620a; }
.alert.err { background: #ffefee; color: #c0281c; }
.alert.ok { background: #e5f7ef; color: #05805a; }

/* -------------------------------- 工资条卡片 ---------------------------- */
.slip-phone { max-width: 420px; margin: 0 auto; background: var(--white); min-height: 100vh; box-shadow: 0 0 40px rgba(0,0,0,.08); }
.slip-hero {
  background: linear-gradient(150deg, var(--slip-a), var(--slip-b));
  color: #fff; padding: 26px 22px 30px; border-radius: 0 0 18px 18px; text-align: center;
}
.slip-hero .month { font-size: 13px; opacity: .85; }
.slip-hero .label { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.slip-hero .amount { font-size: 38px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.slip-hero .unit { font-size: 13px; opacity: .8; margin-left: 3px; }
.slip-body { padding: 16px 18px 40px; }
.slip-tip { background: #fffbe6; border: 1px solid #ffe58f; color: #8a6100; font-size: 12px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; line-height: 1.6; }
.slip-greet { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.slip-group { margin-bottom: 6px; }
.slip-group-h { font-size: 12px; color: var(--text-3); padding: 12px 2px 6px; font-weight: 500; }
.slip-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 2px; border-bottom: 1px solid #f4f5f7; font-size: 14px; }
.slip-row .k { color: var(--text-2); }
.slip-row .v { font-variant-numeric: tabular-nums; font-weight: 500; }
.slip-row.subtotal { background: #fafbfc; margin: 4px -8px; padding: 9px 10px; border-radius: 6px; border-bottom: none; }
.slip-row.subtotal .k, .slip-row.subtotal .v { font-weight: 600; color: var(--text); }
.slip-row.deduct .v { color: var(--danger); }
.slip-total { display: flex; justify-content: space-between; padding: 14px 2px 4px; margin-top: 6px; border-top: 2px solid var(--line); font-weight: 700; font-size: 15px; }
.slip-actions { display: flex; gap: 10px; margin-top: 24px; }
.slip-actions .btn { flex: 1; height: 44px; }
.slip-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 22px; line-height: 1.8; }
.slip-locked { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 10px; }

/* ------------------------------- 登录/引导 ------------------------------ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(150deg, #eef4ff, #f7f9fc 60%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 34px 32px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-logo .mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(140deg, var(--slip-a), var(--slip-b)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-3); margin-bottom: 26px; }

/* -------------------------------- 移动端 -------------------------------- */
@media (max-width: 640px) {
  .row { flex-direction: column; gap: 0; }
  .row .field { width: 100%; }
  .modal { max-width: 100%; }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 8px; }
}
