/* ============================================================
   WMS Web 管理端 — 全局样式
   沿用微信小程序风格：白底卡片 + 微信绿 #07c160 + 浅灰背景
   ============================================================ */

:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e8e8e8;
  --text: #191919;
  --text-2: #666666;
  --text-3: #999999;
  --green: #07c160;
  --green-bg: rgba(7, 193, 96, 0.08);
  --green-dark: #06ad56;
  --red: #fa5151;
  --orange: #ff9800;
  --blue: #576b95;
  --radius: 8px;
  --font: -apple-system, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 布局：左侧导航 + 右侧内容 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px;
  background: var(--card);
  border-right: 0.5px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 16px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
  color: #fff;
}

.sidebar-brand-name { font-size: 15px; font-weight: 600; color: var(--text); }
.sidebar-brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.sidebar-nav { flex: 1; }

.nav-section-title {
  font-size: 11px;
  color: var(--text-3);
  padding: 10px 12px 6px;
  font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background 0.15s;
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font);
}

.nav-item:hover { background: #f7f8fa; color: var(--text); }
.nav-item.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.nav-item .nav-ico { width: 20px; text-align: center; display: inline-flex; }
.nav-item .nav-ico svg { width: 18px; height: 18px; }

.sidebar-user {
  border-top: 0.5px solid var(--border);
  padding-top: 12px;
  display: flex; align-items: center; gap: 10px;
}

.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}

.sidebar-user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.sidebar-user-role { font-size: 11px; color: var(--text-3); }

/* ---------- 主内容 ---------- */
.main { flex: 1; margin-left: 200px; padding: 24px; max-width: 1080px; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
}

.page-title { font-size: 22px; font-weight: 600; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- 项目选择条（顶部） ---------- */
.project-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.project-bar-label { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.project-bar-select {
  font-family: var(--font);
  font-size: 14px; font-weight: 500;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--card);
  min-width: 220px;
  outline: none;
}
.project-bar-select:focus { border-color: var(--green); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
}

.card-title .card-hint { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 8px; }

/* 统计卡片（微信风格：白底 + 大数字） */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-extra { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card .stat-icon { position: absolute; right: 14px; top: 14px; width: 22px; height: 22px; opacity: 0.25; }
.stat-card .stat-icon svg { width: 22px; height: 22px; }

/* 绿色强调统计（收入/出勤等正向指标） */
.stat-card.green .stat-value { color: var(--green); }
.stat-card.green::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--green);
}
.stat-card.red .stat-value { color: var(--red); }
.stat-card.red::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
  background: #fafafa;
}

td {
  padding: 11px 12px;
  border-bottom: 0.5px solid #f0f0f0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

tr:hover td { background: #fafafa; }

td .mono { font-family: var(--mono); font-size: 12px; color: var(--text-3); }

/* 金额正负色 */
.amount-pos { color: var(--green); font-weight: 600; }
.amount-neg { color: var(--red); font-weight: 600; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: rgba(7, 193, 96, 0.1); color: var(--green); }
.badge-warn { background: rgba(250, 81, 81, 0.1); color: var(--red); }
.badge-info { background: rgba(87, 107, 149, 0.1); color: var(--blue); }
.badge-gray { background: #f0f0f0; color: var(--text-3); }
.badge-gold { background: rgba(255, 152, 0, 0.12); color: var(--orange); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  font-weight: 500;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }

.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 0.5px solid var(--border);
}
.btn-ghost:hover { background: #f7f8fa; }

.btn-danger { background: transparent; color: var(--red); border: 0.5px solid rgba(250, 81, 81, 0.3); }
.btn-danger:hover { background: rgba(250, 81, 81, 0.06); }

.btn-sm { padding: 5px 12px; font-size: 13px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.modal-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- 提示 toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }

.toast {
  background: rgba(25, 25, 25, 0.9);
  color: #fff;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.2s ease;
  max-width: 360px;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- 空状态 / 加载 ---------- */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 40px 0;
  font-size: 14px;
}

.loading {
  text-align: center;
  color: var(--text-3);
  padding: 30px 0;
  font-size: 13px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录页（微信风格） ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px 32px;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border: 0.5px solid var(--border);
}

.login-logo {
  width: 56px; height: 56px;
  background: var(--green);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 20px;
}

.login-title { font-size: 20px; font-weight: 600; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text-3); margin: 6px 0 24px; }

.login-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.login-tab {
  flex: 1;
  padding: 9px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
  border-radius: 6px;
  cursor: pointer;
  border: 0.5px solid var(--border);
  background: var(--card);
  font-family: var(--font);
  font-weight: 500;
}
.login-tab.active {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-bg);
}

.login-btn { width: 100%; height: 44px; margin-top: 8px; font-size: 15px; justify-content: center; }

.login-foot {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 20px;
}

/* ---------- 考勤日历 ---------- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-head {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding: 6px 0;
  font-weight: 500;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
  border: 0.5px solid var(--border);
  background: var(--card);
}

.calendar-day.work {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}

.calendar-day.empty { border: none; background: transparent; }

/* ---------- 工人选择列表（考勤打卡，微信风格） ---------- */
.worker-list { border-top: 0.5px solid var(--border); }

/* ---------- 快捷操作（小程序同款） ---------- */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.action-item:hover { background: #f7f8fa; }

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-icon svg { width: 22px; height: 22px; }

.action-label {
  font-size: 12px;
  color: var(--text-2);
}

/* ---------- 我的页：头像 + 菜单列表 ---------- */
.profile-avatar {
  width: 64px;
  height: 64px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  flex-shrink: 0;
}

.menu-list { border-top: 0.5px solid var(--border); }

.menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 4px;
  border-bottom: 0.5px solid #f0f0f0;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.menu-row:hover { background: #fafafa; }

.menu-row:last-child { border-bottom: none; }

.menu-label { flex: 1; font-size: 15px; }

.menu-val { font-size: 13px; color: var(--text-3); }

.menu-arrow { color: var(--text-3); font-size: 15px; }

.menu-ico { width: 20px; display: inline-flex; }
.menu-ico svg { width: 18px; height: 18px; }

.worker-item {
  display: flex;
  align-items: center;
  padding: 13px 0;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
}

.worker-check {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  margin-right: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  font-size: 13px;
  color: #fff;
}

.worker-check.checked {
  background: var(--green);
  border-color: var(--green);
}

.worker-info { flex: 1; }
.worker-name { font-size: 15px; color: var(--text); font-weight: 500; display: block; }
.worker-meta { display: flex; gap: 10px; margin-top: 2px; }
.worker-meta span { font-size: 12px; color: var(--text-3); }
.worker-meta .wage { color: var(--text-2); }

/* ---------- 其他 ---------- */
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-3); }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }

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

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 12px 8px; }
  .sidebar-brand-name, .sidebar-brand-sub, .nav-item span:not(.nav-ico), .sidebar-user-name, .sidebar-user-role, .nav-section-title { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-user { justify-content: center; }
  .main { margin-left: 60px; padding: 14px; }
  .form-row { flex-direction: column; }
}
