/*!
 * 工资管理系统 - 主样式表
 * 色调：Indigo (#6366f1)
 */

:root {
  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --indigo-light: #818cf8;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-bg: rgba(99,102,241,.08);
  --bg: #f1f5f9;
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: #312e81;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system,"Segoe UI",Roboto,"Noto Sans SC","PingFang SC",sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ========= 侧边栏 ========= */
.sidebar {
  position: fixed; left: 0; top: 0;
  width: 250px; height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 100;
  display: flex; flex-direction: column;
  transition: .3s;
}
.sidebar .logo {
  padding: 24px 20px;
  font-size: 20px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .logo .icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg,var(--primary),var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 14px;
  transition: .2s;
  border-left: 3px solid transparent;
  margin: 2px 0;
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--primary-light);
}
.sidebar nav a .nav-icon { font-size: 17px; width: 24px; text-align: center; }

.sidebar .user-info {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .user-info .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--primary),var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.sidebar .user-info .name { font-size: 13px; font-weight: 600; }
.sidebar .user-info .role { font-size: 11px; color: rgba(255,255,255,.45); }

/* ========= 主内容区 ========= */
.main-wrap { margin-left: 250px; min-height: 100vh; }

.topbar {
  background: #fff;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .topbar-actions { display: flex; align-items: center; gap: 16px; }

.content { padding: 28px; }

/* ========= 卡片 ========= */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 20px;
}

/* ========= 统计卡片 ========= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: 1px solid var(--border);
  transition: .2s;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.stat-value-mini {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========= 查询行（紧凑一行） ========= */
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
.filter-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.filter-fields select,
.filter-fields input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  background: var(--bg);
  transition: .15s;
  height: 36px;
}
.filter-fields select:focus,
.filter-fields input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.filter-fields select { width: 130px; }
.filter-fields input[type="text"] { width: 120px; }
.filter-action { flex-shrink: 0; }

/* ========= 订单列表表格区域 ========= */
.card-table {
  padding: 16px;
  margin-bottom: 0;
}
.table-scroll {
  max-height: calc(100vh - 340px);
  overflow-y: auto;
}
.td-amount { font-weight: 700; }
.td-sys-amount { font-size: 13px; }
.match-yes { color: var(--success); font-weight: 600; }
.match-no  { color: var(--danger); font-weight: 600; }

/* ========= 自定义弹窗 ========= */
.custom-modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.custom-modal-backdrop.show { display: flex; }
.custom-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0,0,0,.18);
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.custom-modal .cm-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.custom-modal .cm-title { font-size: 16px; font-weight: 700; }
.custom-modal .cm-close {
  width: 32px; height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-modal .cm-close:hover { background: #e2e8f0; }
.custom-modal .cm-body { padding: 20px 24px; }
.custom-modal .cm-footer {
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.required { color: var(--danger); }

/* ========= 按钮 ========= */
.btn {
  padding: 9px 20px;
  border-radius: 12px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg,var(--primary),var(--primary-dark));
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg,var(--primary-dark),#4338ca);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ========= 表单 ========= */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  background: var(--bg);
  transition: .15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  background: var(--bg);
  transition: .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  background: var(--bg);
  transition: .15s;
}
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* ========= 表格 ========= */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  background: var(--bg);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(99,102,241,.03); }

/* ========= Badge ========= */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-warning { background: rgba(245,158,11,.12); color: #d97706; }
.badge-success { background: rgba(16,185,129,.12); color: #059669; }
.badge-tech {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(99,102,241,.1);
  color: var(--primary);
}

/* ========= 登录页 ========= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#4338ca 100%);
}
.qrcode-login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#4338ca 100%);
}
.qr-crop {
  width: 340px;
  height: 450px;
  overflow: hidden;
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
.qr-crop iframe {
  position: absolute;
  top: 40px; left: 0;
  width: 340px;
  height: 520px;
  border: none;
}
.alt-link { margin-top: 20px; }
.alt-link a {
  color: #999;
  font-size: 12.5px;
  text-decoration: none;
  transition: .15s;
}
.alt-link a:hover { color: var(--primary); }

/* ========= Flash 消息 ========= */
.flash-msg {
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-err  { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ========= 空状态 ========= */
.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========= 数据表格（兼容 admin 页面） ========= */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  background: var(--bg);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: rgba(99,102,241,.03); }

.admin-orders-table th:nth-child(1) { min-width: 90px; }
.admin-orders-table th:nth-child(2) { min-width: 160px; }
.admin-orders-table th:nth-child(3) { min-width: 80px; }
.admin-orders-table th:nth-child(4) { min-width: 110px; }
.admin-orders-table th:nth-child(5) { min-width: 140px; }
.admin-orders-table th:nth-child(6) { min-width: 90px; }
.admin-orders-table th:nth-child(7) { min-width: 90px; }
.admin-orders-table th:nth-child(8) { min-width: 80px; }
.admin-orders-table th:nth-child(9) { min-width: 80px; }
.admin-orders-table th:nth-child(10) { min-width: 80px; }
.admin-orders-table td { white-space: nowrap; }
.table-scroll-x { overflow-x: auto; }
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

/* ========= 响应式 ========= */
@media (max-width: 900px) {
  .stats-row    { grid-template-columns: 1fr; }
  .filter-row   { flex-wrap: wrap; }
  .filter-fields { flex-wrap: wrap; }
}
