/* ============================================================
 * 外勤管家 · 管理后台（PC）基础样式
 * 变量 / 重置 / 通用组件：按钮、表单、表格、卡片、徽标、分页、弹窗、抽屉、toast
 * ============================================================ */

:root {
  /* 主色沿用 App 端，保持两端同一个视觉语言 */
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --success: #12a150;
  --success-light: #e6f6ec;
  --warning: #f5a623;
  --warning-light: #fef3e6;
  --danger: #d93026;
  --danger-light: #fdecea;
  --purple: #7c4dff;
  --purple-light: #f2ecff;

  --text: #1b1f24;
  --text-2: #55606d;
  --text-3: #8a939e;
  --line: #e8ecf0;
  --line-2: #d9e0e6;
  --bg: #f5f7fa;
  --card: #ffffff;
  --hover: #f7f9fc;

  --radius: 10px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

  --sidebar-w: 224px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* 特殊表单控件与普通输入统一观感 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
::placeholder { color: var(--text-3); }

.num { font-variant-numeric: tabular-nums; }
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex: none;
}
.ico svg { fill: currentColor; display: block; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }

.btn-danger { color: var(--danger); border-color: #f5c6c2; background: #fff; }
.btn-danger:hover { background: var(--danger-light); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.link-btn:hover { background: var(--primary-light); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-light); }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }

.input,
.select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
}
.input:disabled, .select:disabled { background: #f4f6f8; color: var(--text-3); cursor: not-allowed; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%238a939e' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .ico { position: absolute; left: 10px; color: var(--text-3); }
.search-box .input { padding-left: 32px; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.checkbox input { width: 14px; height: 14px; accent-color: var(--primary); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
.table { font-size: 13px; }
.table th {
  height: 42px;
  padding: 0 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--hover); }
.table .col-name { font-weight: 600; }
.table .col-ops { text-align: right; }
.table .col-ops .link-btn + .link-btn { margin-left: 4px; }
.table thead th.col-ops { text-align: right; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
}

/* 头像首字：与 App 端 store-badge 同一视觉 */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex: none;
}
.avatar.blue { background: linear-gradient(135deg, #4a90f7, #1a73e8); }
.avatar.green { background: linear-gradient(135deg, #4ecb8d, #12a150); }
.avatar.orange { background: linear-gradient(135deg, #ffbe5c, #f5a623); }
.avatar.purple { background: linear-gradient(135deg, #a98bff, #7c4dff); }
.avatar.gray { background: linear-gradient(135deg, #aab4bf, #8a939e); }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; border-radius: 7px; }

.confirm-text { font-size: 14px; line-height: 1.85; color: var(--text); }

/* 表格补充：滚动容器、单元格主副行、列宽 */
.table-wrap { overflow-x: auto; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.w-64 { width: 64px; }
.w-80 { width: 80px; }
.w-96 { width: 96px; }
.w-100 { width: 100px; }
.w-120 { width: 120px; }
.w-140 { width: 140px; }
.w-160 { width: 160px; }
.w-180 { width: 180px; }
.w-200 { width: 200px; }
.w-220 { width: 220px; }
.t-right { text-align: right; }
.t-center { text-align: center; }

/* 照片占位 */
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-ph {
  width: 88px; height: 88px; border-radius: 8px;
  background: var(--bg-2); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4); flex-direction: column; gap: 4px; font-size: 11px;
}
.photo-ph .ico { width: 20px; height: 20px; }

/* 文本省略 / 引用块 / 提示条 */
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-box {
  background: var(--bg); border-radius: 8px; padding: 10px 12px;
  font-size: 13px; color: var(--text-2); line-height: 1.8;
}
.tip-warn {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 14px;
  padding: 10px 12px; background: var(--warning-light); color: #8a5a00;
  border-radius: 8px; font-size: 12.5px; line-height: 1.65;
}
.tip-info {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; background: var(--primary-light); color: #10529e;
  border-radius: 8px; font-size: 12.5px; line-height: 1.65;
}

/* 字段 / 门店徽标 / 小间距 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-2); }
.field.span-2 { grid-column: 1 / -1; }
.store-cell { display: flex; align-items: center; gap: 8px; }
.store-badge {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.ml-6 { margin-left: 6px; }
.code-tag {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; background: #f3f5f8; color: var(--text-2);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.link-btn.danger { color: var(--danger); }

/* 排行榜三甲 */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.podium-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
}
.podium-card.first { border-color: #f3c96b; background: linear-gradient(135deg, #fffdf5, #fff); }
.podium-card.second { border-color: #d8dee6; background: linear-gradient(135deg, #fafbfc, #fff); }
.podium-card.third { border-color: #e3c4a8; background: linear-gradient(135deg, #fffbf7, #fff); }
.podium-rank {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #b9c3cd, #97a2ad);
}
.podium-card.first .podium-rank { background: linear-gradient(135deg, #ffd76e, #efa321); }
.podium-card.third .podium-rank { background: linear-gradient(135deg, #e0b18a, #bf8355); }
.podium-meta { flex: 1; min-width: 0; }
.podium-name { font-size: 15px; font-weight: 600; }
.podium-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.podium-score { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.podium-score small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }

/* 名次与评分条 */
.rank-no {
  display: inline-flex; width: 22px; height: 22px; border-radius: 6px;
  align-items: center; justify-content: center; font-weight: 600;
  background: var(--bg); color: var(--text-2); font-size: 12px;
}
.rank-no.hot { background: var(--primary-light); color: var(--primary); }
.score-bar {
  width: 110px; height: 6px; border-radius: 3px; background: #eef1f5;
  display: inline-block; overflow: hidden;
}
.score-bar i {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, #4a90f7, #1a73e8);
  transition: width .45s ease;
}
.score-num { font-weight: 600; min-width: 42px; }
.gap-10 { gap: 10px; }

/* 汇总条 */
.sum-strip { display: flex; gap: 12px; margin-bottom: 16px; }
.sum-item {
  flex: 1; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.sum-item .si-label { font-size: 12px; color: var(--text-3); }
.sum-item .si-value { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.sum-item .si-value small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.sum-item .si-icon {
  width: 32px; height: 32px; border-radius: 9px; display: flex;
  align-items: center; justify-content: center; flex: none;
}
.sum-item .si-icon .ico { width: 16px; height: 16px; }

.person { display: flex; align-items: center; gap: 8px; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #eef1f5;
  color: var(--text-2);
}
.badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.badge.green { background: var(--success-light); color: #0b7a3b; }
.badge.orange { background: var(--warning-light); color: #b67409; }
.badge.red { background: var(--danger-light); color: #a5221a; }
.badge.purple { background: var(--purple-light); color: #5b32d6; }
.badge.dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 6px; }
.pager .pg {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.pager .pg:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 空态 / 加载 ---------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 0;
  color: var(--text-3);
  font-size: 13px;
}
.empty svg { width: 56px; height: 56px; opacity: .5; }

/* ---------------- toast ---------------- */
#toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 460px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(27, 31, 36, .92);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease;
}
.toast.success { background: rgba(18, 161, 80, .95); }
.toast.error { background: rgba(217, 48, 38, .95); }
.toast.warn { background: rgba(245, 166, 35, .96); color: #4a3200; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------------- 模态 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: maskIn .18s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 520px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal.wide { width: 720px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

/* ---------------- 抽屉 ---------------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .4);
  z-index: 880;
  animation: maskIn .18s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  background: #fff;
  box-shadow: -8px 0 32px rgba(16, 24, 40, .14);
  z-index: 890;
  display: flex;
  flex-direction: column;
  animation: drawerIn .24s cubic-bezier(.2, .8, .2, 1);
}
/* 宽抽屉：模块配置里要放字段表 / 字典 / 品牌列表，460 放不下 */
.drawer.wide { width: 760px; }
@keyframes drawerIn {
  from { transform: translateX(24px); opacity: .4; }
  to { transform: none; opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 详情键值行 */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); word-break: break-all; }
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin: 20px 0 12px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--primary);
}

/* ---------------- 工具类 ---------------- */
.row { display: flex; align-items: center; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row-dim { opacity: .55; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.suffix { color: var(--text-3); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
