:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --border: #e4e7eb;
  --text: #1d2329;
  --text-2: #5c6670;
  --text-3: #8d96a0;
  --red: #c0271b;
  --red-bg: #fdf2f1;
  --yellow: #a85a06;
  --yellow-bg: #fff8e8;
  --green: #12784a;
  --green-bg: #eefaf3;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--text-2); font-size: 13px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 28px 24px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .muted { margin: 0 0 20px; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.login-card input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #cfd5dc; border-radius: 6px; font-size: 15px; }
.login-card .btn { margin-top: 16px; height: 38px; }
.form-error { color: var(--red); font-size: 13px; margin: 10px 0 0; }

/* 按钮 */
.btn { height: 32px; padding: 0 14px; border-radius: 6px; border: 1px solid #cfd5dc; background: #fff; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #333b44; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.block { width: 100%; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.segmented { display: inline-flex; border: 1px solid #cfd5dc; border-radius: 6px; overflow: hidden; }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--text); color: #fff; }

/* 页面 */
.page { max-width: 960px; margin: 0 auto; padding: 24px 20px 56px; display: flex; flex-direction: column; gap: 16px; }

/* 结论 */
.verdict { border-radius: var(--radius); padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); }
.verdict-title { font-size: 22px; font-weight: 600; }
.verdict-sub { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.verdict.red { background: var(--red-bg); border-color: #f3c9c4; }
.verdict.red .verdict-title { color: var(--red); }
.verdict.yellow { background: var(--yellow-bg); border-color: #efd9a6; }
.verdict.yellow .verdict-title { color: var(--yellow); }
.verdict.green { background: var(--green-bg); border-color: #bfe6cf; }
.verdict.green .verdict-title { color: var(--green); }
.alert { margin: 0; padding: 10px 14px; border-radius: 6px; background: var(--red-bg); color: var(--red); font-size: 13px; }

/* 三个数 */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.total { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.total-label { color: var(--text-2); font-size: 13px; }
.total-value { margin-top: 4px; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.total-value.neg { color: var(--red); }
.note { margin: -6px 2px 0; color: var(--text-3); font-size: 12px; }

/* 面板 */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.count { color: var(--text-3); font-weight: 400; font-size: 13px; margin-left: 4px; }
.checkbox { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; cursor: pointer; }

/* 列表 */
.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 10px 18px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.list th { color: var(--text-3); font-weight: 400; font-size: 12px; white-space: nowrap; }
.list tbody tr:last-child td { border-bottom: 0; }
.list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .c-time { width: 92px; white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.list .c-done { width: 64px; text-align: center; }
.list td.c-done input { width: 16px; height: 16px; cursor: pointer; }
.neg { color: var(--red); }
.pos { color: var(--yellow); }

tr.issue { cursor: pointer; }
tr.issue:hover td { background: #fafbfc; }
tr.issue.done td { color: var(--text-3); }
.what { display: flex; flex-direction: column; gap: 2px; }
.what-main { display: flex; align-items: center; gap: 8px; }
.what-model { color: var(--text-3); font-size: 12px; }
.tag { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow); }
tr.detail td { background: #fafbfc; padding-top: 4px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.kv .v { font-family: ui-monospace, Menlo, monospace; word-break: break-all; color: var(--text); }
.note-input { margin-top: 8px; width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; }

/* 余额 */
.balance { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.balance:last-child { border-bottom: 0; }
.balance-name { font-weight: 600; }
.balance-desc { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.balance-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.balance-value small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); }
.balance-error { color: var(--red); font-size: 12px; }

/* 折叠 */
.fold > summary { padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--text-3); }
.fold[open] > summary::before { content: "▾"; }
.fold[open] > summary { border-bottom: 1px solid var(--border); }
.fold-hint { margin: 0; padding: 10px 18px 0; color: var(--text-3); font-size: 12px; }
.plain { margin: 0; padding: 10px 18px 14px 36px; color: var(--text-2); font-size: 13px; }
.plain li { line-height: 1.9; }

.empty { margin: 0; padding: 28px 18px; text-align: center; color: var(--text-3); }
.footer { color: var(--text-3); font-size: 12px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: #fff; padding: 9px 14px; border-radius: 6px; font-size: 13px; z-index: 50; }
.toast.error { background: var(--red); }

@media (max-width: 720px) {
  .totals { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .list th, .list td { padding: 8px 10px; }
}

/* 按模型、按时段对账 */
.head-actions { display: flex; align-items: center; gap: 12px; }
.segmented.small button { height: 26px; padding: 0 10px; font-size: 12px; }
.total-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.tag.gray { background: #f1f3f5; color: var(--text-2); }
.tag.green { background: var(--green-bg); color: var(--green); }
.checkbox.inline { display: inline-flex; margin-left: 10px; }
.list.inner { margin: 4px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.list.inner th, .list.inner td { padding: 6px 10px; font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
@media (max-width: 720px) {
  .head-actions { flex-wrap: wrap; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
}
