/* ============================================================
   计薪系统 · 设计系统
   改颜色只需要动这一段变量
   ============================================================ */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --ink: #16202e;
  --ink-2: #46536a;
  --muted: #7b8798;
  --line: #e6ebf3;
  --line-strong: #d5dcea;

  --primary: #2f6fed;
  --primary-dark: #1f52c4;
  --primary-soft: #ecf2ff;
  --success: #14934f;
  --success-soft: #e7f6ee;
  --danger: #d93a30;
  --danger-soft: #fdecea;
  --warn: #a35b00;
  --warn-soft: #fff6e5;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; height: 58px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; }
.nav::-webkit-scrollbar { height: 0; }
.nav-link { padding: 7px 12px; border-radius: 9px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.who-link { color: var(--ink); font-weight: 500; }
.badge {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark); line-height: 1.6;
}
.badge-admin { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-bad { background: var(--danger-soft); color: var(--danger); }
.badge-lock { background: var(--warn-soft); color: var(--warn); margin-left: 8px; }
.inline { display: inline; margin: 0; }
.link { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--danger); }

/* ---------------- 布局 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 26px 22px 70px; }
.guest .container { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.3px; }
.page-head .muted { margin: 0; color: var(--muted); font-size: 14px; }
.row-between { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .4px; margin: 26px 0 10px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 20px 22px; margin-bottom: 16px;
}
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card.module { transition: box-shadow .18s, transform .18s, border-color .18s; }
a.card.module:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); text-decoration: none; }
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.module-head h3 { margin: 0; font-size: 16px; }
.module p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ---------------- 标签 ---------------- */
.tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.tag-open { background: var(--success-soft); color: var(--success); border-color: #c6ecd7; }

/* ---------------- 提示条 ---------------- */
.alert, .alert-ok, .alert-note {
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px;
  margin-bottom: 14px; border: 1px solid transparent;
}
.alert { background: var(--danger-soft); color: var(--danger); border-color: #f6cdc9; }
.alert-ok { background: var(--success-soft); color: var(--success); border-color: #c6ecd7; }
.alert-note { background: var(--warn-soft); color: var(--warn); border-color: #ffe3b0; margin-top: 12px; }

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.field input, .field select, select, input[type="month"], input[type="date"] {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 15px; color: var(--ink); background: #fff; outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, select:focus, input[type="month"]:focus, input[type="date"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, .14);
}
.field-check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.field-check input { width: 16px; height: 16px; flex: none; }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font-size: 14.5px; font-family: inherit;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, transform .06s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #3d7bf5 0%, var(--primary) 100%);
  border-color: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(31, 82, 196, .25);
}
.btn-primary:hover { background: linear-gradient(180deg, #2f6fed 0%, var(--primary-dark) 100%); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { color: var(--danger); border-color: #f0bdb8; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
a.btn { text-decoration: none; }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: right; font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th:first-child { text-align: left; border-top-left-radius: 10px; }
.table th:last-child { border-top-right-radius: 10px; }
.table td { text-align: right; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
.table td:first-child { text-align: left; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfe; }
.table .empty { text-align: center; color: var(--muted); padding: 26px 0; }
.row-disabled td { color: #a2aab8; }
.cell-action { text-align: right; }
.note-cell { color: var(--muted); font-size: 12.5px; text-align: left; white-space: normal; }
.total-row td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line-strong); }

.money { font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.pos { color: var(--success); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }

/* ---------------- 登录 ---------------- */
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 30px 26px 24px; }
.title { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* ---------------- 统计卡 ---------------- */
.stat { margin: 0 0 16px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.total-card { text-align: center; padding: 28px 20px; background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%); }
.total-label { color: var(--muted); font-size: 13px; letter-spacing: .3px; }
.total-value { font-size: 40px; font-weight: 800; color: #1f3864; margin: 4px 0 2px; letter-spacing: -1px; }
.total-sub { color: var(--muted); font-size: 12px; }

/* ---------------- 其他 ---------------- */
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 999px; font-size: 13.5px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2); }
.tab:hover { text-decoration: none; background: var(--surface-2); }
.tab-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.row-link { color: var(--ink); font-weight: 600; }
.row-link:hover { color: var(--primary); }

.note-card { background: var(--warn-soft); border-color: #ffe3b0; color: #7a5b00; font-size: 14px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

.lock-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--warn-soft); border: 1px solid #ffe3b0; color: var(--warn);
  border-radius: var(--radius-sm); padding: 11px 14px; margin: 14px 0 18px; font-size: 13.5px;
}
.lock-bar.locked { background: var(--success-soft); border-color: #c6ecd7; color: var(--success); }

.cell-input {
  width: 82px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; font-family: inherit;
}
.check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-right: 8px; white-space: nowrap; }
.check-inline input { width: 15px; height: 15px; }

.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.footer { text-align: center; color: #9aa4b2; font-size: 12px; padding: 24px 0 32px; }

/* ---------------- 滑块验证 ---------------- */
.captcha { margin: 2px 0 4px; }
.cap-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
}
.cap-modal.hidden { display: none; }
.cap-dialog {
  background: #fff; border-radius: 16px; padding: 24px 22px 16px;
  width: 348px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); text-align: center;
}
.cap-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.cap-sub { color: var(--muted); font-size: 13px; margin: 6px 0 16px; }
.cap-actions { margin-top: 8px; display: flex; justify-content: center; }

.cap-stage {
  position: relative; width: 300px; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  user-select: none; background: #e9eef6;
}
.cap-bg { display: block; width: 300px; height: 120px; object-fit: cover; }
.cap-hole {
  position: absolute; border: 2px dashed rgba(255, 255, 255, .92); border-radius: 6px;
  background: rgba(0, 0, 0, .14); box-shadow: inset 0 0 14px rgba(0, 0, 0, .45);
}
.cap-piece {
  position: absolute; left: 0; background-repeat: no-repeat; border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, .95); box-sizing: border-box;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); cursor: grab;
}
.cap-piece.ok { border-color: var(--success); }
.cap-track {
  position: relative; width: 300px; height: 44px; margin: 12px auto 0;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.cap-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--primary-soft); border-radius: 999px; }
.cap-thumb {
  position: absolute; left: 0; top: -1px; width: 44px; height: 44px;
  border-radius: 999px; background: #fff; border: 1px solid var(--line-strong);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 700; cursor: grab;
}
.cap-thumb.ok { background: var(--success-soft); border-color: #c6ecd7; color: var(--success); }
.cap-hint {
  position: absolute; left: 0; right: 0; top: 12px; text-align: center;
  color: #9aa4b2; font-size: 13px; pointer-events: none; transition: opacity .15s;
}
.cap-status { text-align: center; font-size: 13px; margin: 8px 0 0; min-height: 18px; color: var(--muted); }
.cap-status.ok { color: var(--success); }
.cap-status.bad { color: var(--danger); }

/* ---------------- 手机 ---------------- */
@media (max-width: 720px) {
  .topbar { padding: 0 14px; height: 54px; gap: 10px; }
  .brand-sub { display: none; }
  .container { padding: 18px 14px 60px; }
  .page-head h1 { font-size: 20px; }
  .card { padding: 16px; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 9px 7px; }
  .total-value { font-size: 32px; }
  .grid { grid-template-columns: 1fr; }
  .who { font-size: 12px; }
}

/* ---------- 工作台：顶部概览 ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #1e3a8a 0%, #2f6fed 58%, #4f8bff 100%);
  color: #fff; border-radius: 18px; padding: 26px 28px; margin-bottom: 24px;
  box-shadow: 0 14px 34px rgba(31, 82, 196, .28);
}
.hero::after {
  content: ''; position: absolute; right: -70px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero::before {
  content: ''; position: absolute; left: -50px; bottom: -110px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero-hello { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.hero-sub { opacity: .88; font-size: 13.5px; margin-top: 4px; }
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.hero-stat {
  background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px; padding: 8px 14px; min-width: 118px;
}
.hero-stat span { display: block; font-size: 12px; opacity: .82; }
.hero-stat b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- 模块卡片（带图标） ---------- */
.card.module {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 17px;
}
.module-icon {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--c1, #3b82f6), var(--c2, #60a5fa));
  box-shadow: 0 6px 14px rgba(16, 24, 40, .18);
}
.module-body { flex: 1; min-width: 0; }
.module-body h3 { margin: 0; font-size: 15.5px; }
.module-body p { margin: 3px 0 0; font-size: 12.8px; color: var(--muted); }
.module-go { color: #b6bfcc; font-size: 17px; transition: transform .15s, color .15s; }
a.card.module:hover .module-go { transform: translateX(3px); color: var(--primary); }

/* ========== 配色增强 ========== */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 380px at 12% -80px, #e4edff 0%, rgba(228, 237, 255, 0) 65%),
    radial-gradient(760px 340px at 92% -60px, #e9f7f1 0%, rgba(233, 247, 241, 0) 62%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* 小标题：加一条彩色竖线 */
.section-title {
  display: flex; align-items: center;
}
.section-title::before {
  content: ''; width: 4px; height: 15px; border-radius: 2px; margin-right: 8px;
  background: linear-gradient(180deg, #3b82f6, #60a5fa);
}

/* 表头淡蓝底 */
.table th { background: #f1f6fd; color: #526483; }
.table tbody tr:hover td { background: #f7faff; }

/* 统计卡：顶部彩色条 */
.grid-4 > .card:nth-child(1) { border-top: 3px solid #3b82f6; }
.grid-4 > .card:nth-child(2) { border-top: 3px solid #10b981; }
.grid-4 > .card:nth-child(3) { border-top: 3px solid #f59e0b; }
.grid-4 > .card:nth-child(4) { border-top: 3px solid #ef4444; }
.grid-4 > .card .stat-value { letter-spacing: -.3px; }

/* 页面标题：左侧色块 */
.page-head h1 { position: relative; padding-left: 12px; }
.page-head h1::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px;
  border-radius: 2px; background: linear-gradient(180deg, #2f6fed, #7aa7ff);
}

/* 按钮组里的次要按钮淡灰 */
.btn:not(.btn-primary):not(.btn-danger):hover { background: #f2f6fd; border-color: #c9d7ee; }

/* 表格行首列加粗 */
.table tbody td:first-child { font-weight: 500; }

/* 提示条配色更柔和 */
.alert-note { background: linear-gradient(180deg, #fff8ea, #fff5e2); }
.alert-ok { background: linear-gradient(180deg, #eafaf1, #e3f7ec); }

/* ========== 手机端：底部标签栏（App 风格） ========== */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav { display: none; }
  .badge-admin, .who .badge { display: none; }
  body { padding-bottom: 72px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--muted); padding: 5px 0; text-decoration: none;
    border-radius: 10px;
  }
  .tab-item:active { background: var(--surface-2); }
  .tab-item.active { color: var(--primary); font-weight: 600; }
  .tab-ico { font-size: 19px; line-height: 1.1; }

  /* 触控友好 */
  .btn { min-height: 42px; }
  .field input, .field select, select { min-height: 44px; }
  .table { font-size: 12.5px; }
  .page-head h1 { padding-left: 10px; }
  .container { padding-bottom: 30px; }
}

/* ---------- 安装页 ---------- */
.steps { margin: 0 0 0 18px; padding: 0; color: var(--ink-2); font-size: 14px; }
.steps li { margin: 6px 0; line-height: 1.7; }

/* 声明只支持浅色，避免被浏览器强制反色 */
html { color-scheme: light only; }

/* ========== 安卓套壳 App（WebView）里降级重特效 ========== */
.webview .topbar { backdrop-filter: none; background: #fff; }
.webview .hero { box-shadow: none; }
.webview .card { box-shadow: none; }
.webview .tabbar { backdrop-filter: none; background: #fff; box-shadow: none; }
