/* ==========================================================================
   基础样式：变量、排版、通用组件（按钮/表单/卡片/表格/标签/提示）
   桌面端与手机端共用的部分都在这里，页面级布局见 admin.css / mobile.css
   ========================================================================== */

:root {
  --primary: #1f4e79;
  --primary-light: #2e6da4;
  --accent: #e8a33d;
  --danger: #c0392b;
  --ok: #1e8449;
  --bg: #f2f4f7;
  --card: #ffffff;
  --border: #dfe3e8;
  --border-light: #eef1f5;
  --text: #23303d;
  --muted: #6b7785;
  --shadow-sm: 0 1px 3px rgba(20, 40, 70, .07);
  --shadow-md: 0 6px 24px rgba(20, 40, 70, .10);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------- 通用工具 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 720px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card > h2 {
  font-size: 16px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card > h2 .spacer { flex: 1; }
.card h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 20px 12px; margin: 0; }
.card.flush .table-wrap { border-top: 1px solid var(--border-light); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--primary-light); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--primary); border-color: #c9d6e3; }
.btn.ghost:hover { background: #eef4fa; border-color: var(--primary-light); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a93226; }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #176b3a; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 6px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel],
input[type=file], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d5dbe2;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46, 109, 164, .14);
}
input:disabled, select:disabled, textarea:disabled { background: #f4f6f8; color: #8c98a5; }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox], input[type=radio] { width: auto; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 780px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; background: #fff; }
table.data th, table.data td {
  border-bottom: 1px solid var(--border-light);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
table.data thead th {
  background: #eef2f6;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}
table.data tbody tr:nth-child(even) td { background: #fafbfc; }
table.data tbody tr:hover td { background: #f2f7fc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.act { white-space: nowrap; }
table.data .rowform { display: inline; }

/* ---------- 状态标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 12px; white-space: nowrap; line-height: 1.7; }
.tag.submitted { background: #e3f0fb; color: #1b5e91; }
.tag.verified { background: #e1f6e8; color: #1e8449; }
.tag.discrepancy { background: #fde8e6; color: #b3261e; }
.tag.returned { background: #f0f1f3; color: #6b7785; }
.tag.draft { background: #fff6e5; color: #a06b00; }
.tag.diff { background: #fde8e6; color: #b3261e; }
.tag.plain { background: #eef1f5; color: #5b6876; }

/* ---------- 提示条 ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert.err { background: #fde8e6; color: #9c1f16; border-color: #f5c6c2; }
.alert.ok { background: #e1f6e8; color: #1e8449; border-color: #bfe5cd; }
.alert.info { background: #e8f1fa; color: #1b5e91; border-color: #c6dcf0; }
.alert.warn { background: #fff6e5; color: #8a5a00; border-color: #f0dcb0; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.stat .v { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat.warn .v { color: var(--danger); }
.stat.ok .v { color: var(--ok); }

/* ---------- 照片墙（桌面核对页） ---------- */
.photo-wall { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-wall figure { margin: 0; width: 136px; }
.photo-wall img {
  width: 136px; height: 136px; object-fit: cover; border: 1px solid var(--border);
  border-radius: 8px; display: block; background: #f4f6f8;
}
.photo-wall figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; word-break: break-all; line-height: 1.45; }
.photo-empty { color: var(--danger); font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #1f4e79 0%, #2e6da4 55%, #4a90c4 100%); }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 30px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.login-box h1 { font-size: 20px; margin: 0 0 4px; color: var(--primary); }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ---------- 加载中 ---------- */
.loading { display: inline-block; width: 15px; height: 15px; border: 2px solid #cdd6e0;
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
