/* ============================================================
 * finance-reconcile · style.css
 * ============================================================ */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --line2: #d5dce6;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #1a56db;
  --brand-d: #12409f;
  --teal: #0f766e;
  --amber-bg: #fef3c7; --amber-fg: #92400e;
  --red-bg: #fee2e2; --red-fg: #b91c1c;
  --teal-bg: #d1fae5; --teal-fg: #065f46;
  --blue-bg: #dbeafe; --blue-fg: #1e40af;
  --gray-bg: #eef1f4; --gray-fg: #4b5563;
  --green-bg: #d1fae5; --green-fg: #065f46;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
button { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 8px 20px; position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand);
  color: #fff; font-weight: 600; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px;
  cursor: pointer; font-size: 14px; color: var(--muted);
}
.tabs button:hover { background: #f0f3f8; color: var(--text); }
.tabs button.active { background: var(--brand); color: #fff; font-weight: 500; }

.top-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 主体 ---------- */
.view { padding: 18px 20px 60px; max-width: 1280px; margin: 0 auto; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 2px 0 12px;
}
.card-h h2, .card-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card-h .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.card + .card { margin-top: 16px; }

/* ---------- 统计块 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; position: relative; overflow: hidden;
}
.stat .num { font-size: 24px; font-weight: 600; line-height: 1.3; }
.stat .lbl { color: var(--muted); font-size: 12px; }
.stat.red .num { color: var(--red-fg); }
.stat.amber .num { color: var(--amber-fg); }
.stat.teal .num { color: var(--teal-fg); }
.stat.blue .num { color: var(--blue-fg); }
.stat .bar {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--amber-bg);
}
.stat.red .bar { background: var(--red-bg); }
.stat.teal .bar { background: var(--teal-bg); }
.stat.blue .bar { background: var(--blue-bg); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line2); background: #fff; color: var(--text);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: #b9c4d2; background: #f8fafc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-danger { background: #fff; border-color: #f5b3b3; color: var(--red-fg); }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { border-color: transparent; background: #f0f3f8; }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
input[type=text], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line2); border-radius: 8px; padding: 6px 9px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c3d4fb; border-color: var(--brand); }
label.fld { display: block; margin-bottom: 10px; font-size: 13px; }
label.fld > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; vertical-align: middle;
}
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbfd; }
.tbl tbody tr:hover { background: #f7fafd; }
.tbl .num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sum-row td { border-top: 2px solid var(--line2); font-weight: 600; background: #f7f9fc; }
.tbl .row-warn td { background: #fffbeb; }
.tbl .row-danger td { background: #fef2f2; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.7; white-space: nowrap;
}
.b-red { background: var(--red-bg); color: var(--red-fg); }
.b-amber { background: var(--amber-bg); color: var(--amber-fg); }
.b-teal { background: var(--teal-bg); color: var(--teal-fg); }
.b-blue { background: var(--blue-bg); color: var(--blue-fg); }
.b-gray { background: var(--gray-bg); color: var(--gray-fg); }

/* ---------- 工具栏/筛选 ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=text], .toolbar input[type=date], .toolbar select { width: auto; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; color: var(--muted); padding: 42px 10px; font-size: 13px;
}
.empty .big { font-size: 30px; margin-bottom: 6px; }

/* ---------- 弹层 ---------- */
.dlg-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto;
}
.dlg {
  background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.dlg.wide { max-width: 720px; }
.dlg-title { font-size: 15px; font-weight: 600; padding: 14px 18px 6px; }
.dlg-body { padding: 6px 18px 8px; font-size: 13px; color: var(--text); overflow-wrap: break-word; }
.dlg-foot { padding: 10px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 4px;
}
.dlg-head .t { font-size: 15px; font-weight: 600; }
.dlg-close { border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1f2937; color: #fff; padding: 8px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; transform: translateY(-6px); transition: all .25s;
  box-shadow: 0 6px 18px rgba(0,0,0,.16); max-width: 80vw;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #0f766e; }
.toast.error { background: #b91c1c; }

/* ---------- 页内小部件 ---------- */
.help { color: var(--muted); font-size: 12px; line-height: 1.7; }
.help code { background: #eef2f7; padding: 0 5px; border-radius: 4px; }
.hint-box {
  background: #f0f7ff; border: 1px solid #cfe0fb; border-radius: 10px;
  padding: 10px 14px; color: #1e40af; font-size: 13px; margin-bottom: 14px;
}
.alert-line { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; flex-wrap: wrap; }
.alert-line:last-child { border-bottom: 0; }
.alert-line .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.alert-line .why { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.red { background: #dc2626; }
.dot.amber { background: #d97706; }
.dot.teal { background: #059669; }
.dot.blue { background: #2563eb; }
.mono { font-family: Consolas, Menlo, monospace; }
.link { color: var(--brand); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.foot { text-align: center; color: #9aa3af; font-size: 12px; padding: 10px 0 26px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
