/* ============================================================
   业绩津贴分配系统 · 设计系统 v2（响应式 / 移动优先）
   ============================================================ */
:root {
  --brand: #14335c;
  --brand-2: #1d4f8f;
  --brand-3: #2b6cb0;
  --brand-grad: linear-gradient(160deg, #14335c 0%, #1d4f8f 100%);
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7686;
  --border: #e2e8f0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --success: #1e7e34;
  --success-bg: #e8f5e9;
  --warning: #b7791f;
  --warning-bg: #fff8e1;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16, 36, 64, .07), 0 4px 14px rgba(16, 36, 64, .05);
  --shadow-lg: 0 8px 28px rgba(16, 36, 64, .14);
  --sidebar-w: 232px;
  --touch: 42px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* ---------- 布局骨架 ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 25, 50, .25);
}
.topbar-inner {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 14px;
  max-width: 1400px; margin: 0 auto;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: .5px; white-space: nowrap; }
.brand small { display: block; font-weight: 400; font-size: 11px; opacity: .75; letter-spacing: 2px; }
.year-badge {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; white-space: nowrap;
}
.userbox { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.userbox > span { font-weight: 500; margin-right: 4px; }
.userbox a {
  color: rgba(255, 255, 255, .85); text-decoration: none;
  padding: 6px 8px; border-radius: var(--radius-sm); transition: background .15s;
}
.userbox a:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* 汉堡按钮（仅移动端显示） */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch);
  background: none; border: none; cursor: pointer; padding: 0;
}
.nav-toggle svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2; fill: none; }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: fixed; left: 0; top: 52px; bottom: 0;
  width: var(--sidebar-w);
  background: #0f2a4d;
  overflow-y: auto;
  padding: 14px 10px 30px;
  z-index: 40;
}
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 11px; color: rgba(255, 255, 255, .45);
  padding: 12px 10px 4px; letter-spacing: 1px;
}
.sidebar a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255, 255, 255, .82); text-decoration: none;
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px;
  margin: 1px 0; transition: background .15s, color .15s;
  min-height: 38px;
}
.sidebar a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar a.active {
  background: var(--brand-3); color: #fff; font-weight: 500;
  box-shadow: inset 3px 0 0 #9cc3ee;
}
.nav-mask { display: none; }

/* 主内容 */
.main-wrap {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: calc(100vh - 52px);
}
.container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 22px 20px; flex: 1; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.page-head h2::after { content: ""; display: block; width: 34px; height: 3px; background: var(--brand-3); border-radius: 2px; margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card > h3 { margin: 0 0 12px; font-size: 15px; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.card > h3::before { content: ""; width: 4px; height: 15px; background: var(--brand-3); border-radius: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* 统计卡 */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--brand-2); line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand-2); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 14px; line-height: 1.3;
  cursor: pointer; text-decoration: none;
  min-height: 38px;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--brand); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 2px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-ghost { background: transparent; color: var(--brand-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: #edf2f8; color: var(--brand); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; min-height: 30px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
label { display: block; font-weight: 500; font-size: 13px; color: var(--text); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; margin-top: 5px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff; transition: border-color .15s, box-shadow .15s;
  min-height: 40px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-3);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, .15);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline label { display: inline-flex; align-items: center; gap: 6px; }
.inline input, .inline select { width: auto; min-width: 120px; margin-top: 0; }
.inline input[type=checkbox] { width: auto; min-width: 0; margin: 0; }

/* ---------- 表格 ---------- */
.table { width: 100%; background: var(--card); border-collapse: collapse; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--border); }
.table thead th { background: #eef3f9; color: var(--brand); font-weight: 600; font-size: 13px; white-space: nowrap; }
.table tbody tr:hover { background: #f6f9fd; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; line-height: 1.6; background: #eef2f7; color: var(--muted); white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-primary { background: #e3edf9; color: var(--brand-2); }

/* ---------- 消息条 ---------- */
.messages { margin-bottom: 14px; }
.msg { border-radius: var(--radius-sm); padding: 11px 14px; margin: 8px 0; font-size: 13.5px; display: flex; align-items: flex-start; gap: 8px; }
.msg::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; }
.msg-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6cb; }
.msg-error::before { background: var(--danger); }
.msg-success { background: var(--success-bg); color: var(--success); border: 1px solid #c3e6cb; }
.msg-success::before { background: var(--success); }
.msg-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #ffe08a; }
.msg-warning::before { background: var(--warning); }

/* ---------- 空状态 / 其他 ---------- */
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 13.5px; }
.empty::before { content: "○"; display: block; font-size: 30px; color: #c3cdd9; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 12.5px; }
.qr { text-align: center; }
.qr svg { width: 190px; height: 190px; }
code { background: #eef2f7; padding: 2px 7px; border-radius: 4px; word-break: break-all; font-size: 12.5px; }
.footer {
  text-align: center; color: var(--muted);
  padding: 18px 12px 22px; font-size: 12px;
  border-top: 1px solid var(--border); background: #fff;
}
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
a { color: var(--brand-2); }
a:hover { color: var(--brand); }

/* ---------- 登录页 ---------- */
.login-page-bg {
  min-height: 100vh;
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  max-width: 420px; width: 100%;
  margin: 48px auto;
  background: var(--card); border-radius: 16px;
  padding: 34px 30px 30px; box-shadow: var(--shadow-lg);
}
.login-card h2 { margin: 0 0 4px; font-size: 19px; color: var(--brand); }
.login-card form label { display: block; margin: 16px 0 0; }
.login-card .btn { width: 100%; margin-top: 22px; min-height: 44px; font-size: 15px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ============================================================
   响应式
   ============================================================ */
@media (min-width: 1024px) {
  .nav-toggle { display: none; }
}
@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
  .nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .nav-open .nav-mask {
    display: block; position: fixed; inset: 52px 0 0 0;
    background: rgba(10, 20, 35, .45); z-index: 35;
  }
  .main-wrap { margin-left: 0; }
  .brand small { display: none; }
}
@media (max-width: 768px) {
  .container { padding: 14px 12px; }
  .topbar-inner { height: 50px; padding: 0 8px; gap: 8px; }
  .brand { font-size: 13.5px; }
  .userbox > span { display: none; }
  .userbox a { padding: 8px 7px; }
  /* 表格横向滚动 */
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .card { padding: 14px; border-radius: 8px; }
  .page-head h2 { font-size: 17px; }
  .btn { padding: 10px 16px; }
  .btn-sm { min-height: 34px; padding: 6px 12px; }
  .stat .num { font-size: 22px; }
  .footer { padding: 14px 10px 18px; }
}
@media (max-width: 400px) {
  .userbox a:nth-child(2), .userbox a:nth-child(3) { display: none; } /* 收起"个人信息/改密"，保留退出 */
}
