/* 甄选周报 web 层样式：手写 CSS、无外链。浅色/深色随系统 prefers-color-scheme。 */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1c2027;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #333a45;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

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

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

/* ── 布局 ── */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px 64px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.topnav .brand {
  font-weight: 700;
  font-size: 17px;
  margin-right: 12px;
}
.topnav a {
  display: inline-block;
  min-height: 40px;           /* 可点目标 ≥ 40px */
  line-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
}
.topnav a:hover { background: var(--accent-soft); text-decoration: none; }
.topnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topnav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav .nav-user { padding: 0 8px; font-size: 13px; }
form.inline { display: inline; margin: 0; }
.topnav button.nav-btn {
  background: none;
  border: none;
  color: var(--text);
  min-height: 40px;
  line-height: 40px;
  padding: 0 12px;
  margin-top: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
}
.topnav button.nav-btn:hover { background: var(--accent-soft); }

h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.summary-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.summary-item .num { font-size: 24px; font-weight: 700; }
.summary-item .lbl { color: var(--muted); font-size: 12px; }

/* ── 表单 ── */
label { display: block; margin: 10px 0 4px; font-size: 14px; }
input[type="text"], input[type="number"], input[type="password"], input[type="file"],
input[type="date"], select {
  width: 100%;
  max-width: 420px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}
button, .btn {
  display: inline-block;
  min-height: 44px;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}
button:hover, .btn:hover { opacity: 0.88; text-decoration: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  margin-top: 0;
  font-size: 13px;
  font-weight: 500;
}
button.btn-inline {
  width: auto;
  min-height: 40px;
  padding: 8px 14px;
  margin-top: 0;
  white-space: nowrap;
}
.code-row { display: flex; gap: 8px; max-width: 420px; }
.code-row input { flex: 1; min-width: 0; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── 对账（M6）：已核销行置灰 ── */
tr.row-marked td { opacity: 0.5; }

/* ── 状态徽标 ── */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: var(--accent-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--warn); }
.badge.err { background: var(--accent-soft); color: var(--err); }

/* ── 告警/错误 ── */
.alert {
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  background: var(--card);
}
.alert.err { border-color: var(--err); }

details { margin: 6px 0; }
details summary { cursor: pointer; min-height: 32px; line-height: 32px; color: var(--muted); }
details pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
}

/* ── 图表 ── */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}

/* ── 登录页 ── */
.login-box { max-width: 360px; margin: 12vh auto 0; }

/* ── 上传进度步骤条（M4）── */
.steps { list-style: none; margin: 4px 0; padding: 0; }
.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.steps li:last-child { border-bottom: none; }
.steps li .mark {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.current .mark {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}
.steps li.done { color: var(--text); }
.steps li.done .mark { background: var(--ok); border-color: var(--ok); }
.steps li.done .mark::after { content: '✓'; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 窄屏（≤480px）── */
@media (max-width: 480px) {
  .page { padding: 8px 10px 56px; }
  .topnav a { padding: 0 8px; }
  h1 { font-size: 19px; }
  .summary-item .num { font-size: 20px; }
  input[type="text"], input[type="number"], input[type="password"], input[type="file"],
  input[type="date"], select { max-width: 100%; }
  button, .btn { width: 100%; }
  button.btn-inline, button.btn-sm, .topnav button.nav-btn { width: auto; }
}

/* ── 模板引导模式（M4）── */
.guide-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
}
.guide-section.guide-hidden { opacity: 0.55; }
.guide-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.guide-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.guide-row input[type="number"] { width: 64px; }
.guide-row .guide-title { flex: 1; min-width: 240px; }
.guide-row .guide-title input[type="text"] { flex: 1; width: 100%; }
.guide-badge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1px 8px;
}
.guide-tokens { font-size: 12px; margin: 6px 0 0; }
.guide-tokens code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
