/* 村级资金管理系统 - light theme, no external deps */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #1f2329;
  --dim: #8a919f;
  --brand: #2f6bff;
  --brand-dark: #1f4fd8;
  --ok-bg: #e8f7ee; --ok-tx: #0a8a4a;
  --err-bg: #fdecec; --err-tx: #c0392b;
  --pool: #2f6bff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 28px; height: 56px; position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 16px; font-weight: 700; white-space: nowrap; flex: none; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--dim); text-decoration: none; padding: 6px 14px; border-radius: 8px;
}
.topbar nav a:hover { color: var(--text); background: #f2f3f5; }
.topbar nav a.on { color: var(--brand); background: #eef3ff; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.link { color: var(--dim); text-decoration: none; font-size: 13px; }
.link:hover, .link.on { color: var(--brand); }

.wrap { max-width: 1080px; margin: 24px auto 40px; padding: 0 20px; }

/* flash */
.flash {
  max-width: 1080px; margin: 14px auto -8px; padding: 10px 16px; border-radius: 8px;
  background: var(--ok-bg); color: var(--ok-tx); font-size: 13px;
}
.flash-err { background: var(--err-bg); color: var(--err-tx); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px;
}
.card-pool { background: #eef3ff; border-color: #d6e2ff; }
.card-label { color: var(--dim); font-size: 13px; }
.card-num { font-size: 26px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.card-pool .card-num { color: var(--brand-dark); }
.card-sub { color: var(--dim); font-size: 12px; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin-bottom: 20px; }
.panel h2 { font-size: 15px; margin-bottom: 14px; }
.panel-narrow { max-width: 460px; }
.empty { color: var(--dim); padding: 18px 0; text-align: center; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
code { background: #f2f3f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--dim); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.amt-in { color: #0a8a4a; font-weight: 600; }
.amt-out { color: #c0392b; font-weight: 600; }
.amt-move { color: #6b3fd8; font-weight: 600; }
.row-archived { opacity: .45; }

.badge {
  display: inline-block; padding: 1px 9px; border-radius: 20px;
  font-size: 12px; background: #eef3ff; color: var(--brand-dark);
}
.badge-off { background: #f2f3f5; color: var(--dim); }
.badge-deposit { background: #e8f7ee; color: #0a8a4a; }
.badge-allocate { background: #eef3ff; color: var(--brand-dark); }
.badge-recycle { background: #f0eaff; color: #6b3fd8; }
.badge-spend { background: #fdecec; color: #c0392b; }
.badge-transfer { background: #fff4e5; color: #b25e00; }
.badge-reclassify { background: #f0eaff; color: #6b3fd8; }
.badge-cat { background: #eef7f3; color: #17795e; font-weight: 400; }
/* 科目类型：应收款科目（不计入账户余额） */
.badge-recv { background: #eef0f6; color: #4a5262; border: 1px solid #dde2ec; font-weight: 400; }
.badge-bal  { background: #f7f8fa; color: #8a919f; border: 1px solid #eceef2; font-weight: 400; }
.recv-sub { display: block; font-size: 11.5px; font-weight: 400; color: #a45b00; margin-top: 2px; }
.card-recv { background: #fffaf1; border-color: #f3e2c7; }
.card-recv .card-num { color: #a45b00; }
.arrow-mini { display: inline-block; margin: 0 5px; color: #b6bcc7; font-size: 12px; }

/* balance bar */
.bar { height: 8px; background: #f2f3f5; border-radius: 4px; min-width: 120px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* forms */
label { display: block; margin-bottom: 10px; color: var(--dim); font-size: 13px; }
input[type=text], input[type=password], input[type=number], select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row input[type=text] { display: inline-block; width: 220px; margin-top: 0; }
.form-row select { display: inline-block; width: auto; margin-top: 0; }
.inline { display: inline; }
.inline-edit { display: flex; gap: 6px; }
.inline-edit input[type=text] { width: 140px; margin-top: 0; padding: 5px 8px; font-size: 13px; }
.inline-edit input[type=text]:first-child { width: 130px; font-weight: 600; }

.btn {
  display: inline-block; padding: 8px 18px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-ghost { background: transparent; color: var(--dim); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f2f3f5; color: var(--text); }

/* ops grid */
.ops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* ops module grid */
.panel-intro { margin: 4px 0 16px; }
.panel-intro h1 { font-size: 20px; }
.panel-intro p { font-size: 13px; margin-top: 4px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.module {
  display: block; text-decoration: none; color: inherit; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 16px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.module:hover { border-color: #c7d5ff; box-shadow: 0 8px 24px rgba(47,107,255,.09); transform: translateY(-2px); }
.m-head { display: flex; align-items: center; gap: 9px; }
.m-idx { font-size: 12px; color: #b6bcc7; font-variant-numeric: tabular-nums; }
.m-name { font-size: 16px; font-weight: 600; flex: 1; }
.m-arrow { color: #c4c9d4; font-size: 18px; line-height: 1; }
.module:hover .m-arrow { color: var(--brand); }
.m-desc { color: var(--dim); font-size: 13px; margin-top: 8px; min-height: 20px; }
.m-metric {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12px; color: #5a6373; font-variant-numeric: tabular-nums;
}
.tip-line { margin-top: 14px; }

/* op detail page */
.crumb { margin: 0 0 12px; font-size: 13px; }
.crumb a { color: var(--dim); text-decoration: none; }
.crumb a:hover { color: var(--brand); }
.op-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.op-form { max-width: 520px; }
.op-desc { font-size: 13px; margin: -6px 0 18px; }
.amount-input { font-size: 20px; font-weight: 600; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.quick {
  display: inline-block; margin: -4px 0 12px; padding: 3px 10px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 6px; background: #fafbfc;
  color: #5a6373; cursor: pointer;
}
.quick:hover { border-color: #c7d5ff; color: var(--brand); background: #f5f8ff; }
/* account category breakdown */
.detail-row > td { padding: 0; background: #fbfcfe; border-bottom: 1px solid var(--line); }
.cat-detail { padding: 14px 18px 12px; border-left: 3px solid #d6e2ff; }
.cat-detail-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
.cat-detail-head .dim { font-weight: 400; }
.mini-table { width: 100%; }
.mini-table th, .mini-table td { padding: 5px 8px; font-size: 12px; border-bottom: 1px dashed var(--line); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table th { color: var(--dim); font-weight: 500; }
.share-cell { width: 28%; min-width: 110px; }
.share-cell .bar { min-width: 0; height: 7px; }
.cat-foot { margin-top: 8px; }

/* multi-select accounts (allocate / recycle) */
.pick-field { margin-bottom: 14px; }
.pick-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pick-title { font-size: 13px; color: var(--dim); }
.pick-acts { display: flex; gap: 6px; }
.pick-acts .quick { margin: 0; }
.pick-list {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
  max-height: 300px; overflow-y: auto;
}
.pick-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 118px;
  gap: 10px; align-items: center; margin: 0; padding: 8px 12px;
  border-bottom: 1px dashed var(--line); color: var(--text); font-size: 13px; cursor: pointer;
}
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: #fafbfc; }
.pick-row.on { background: #f6f9ff; }
.pick-row input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.pick-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-bal { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick-bal b { color: var(--text); font-weight: 600; }
.pick-cats {
  display: block; font-weight: 400; font-size: 11.5px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pick-row.over { background: #fff6f6; }
.pick-row.over .pick-bal b { color: var(--err-tx); }
.pick-hint { font-size: 12px; color: var(--dim); margin-top: 6px; line-height: 1.5; }
.pick-hint b { color: var(--text); font-weight: 600; }
.pick-hint.pick-warn { color: var(--err-tx); }
.pick-hint.pick-warn b { color: var(--err-tx); }
.pick-row input[type=number] {
  margin-top: 0; padding: 5px 8px; font-size: 13px; text-align: right;
  font-variant-numeric: tabular-nums; width: 118px;
}
.pick-row input[type=number]:disabled { background: #f6f7f9; color: #c2c8d2; border-color: #eceef1; }
.pick-sum { font-size: 12px; color: var(--dim); margin-top: 8px; }
.pick-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.pick-sum b.over { color: var(--err-tx); }
.pick-cap { color: var(--dim); }
.pick-err { display: none; font-size: 12px; color: var(--err-tx); margin-top: 8px; }
.pick-err.show { display: block; }

.ctx-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.ctx-row:last-of-type { border-bottom: none; }
.ctx-row b { font-variant-numeric: tabular-nums; }
.ctx-hint { font-size: 12px; color: var(--dim); margin-top: 10px; line-height: 1.7; }
.mini-list { list-style: none; }
.mini-list li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.mini-list li:last-child { border-bottom: none; }
.mini-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-who { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { color: #b6bcc7; font-size: 12px; font-variant-numeric: tabular-nums; }
.mini-payee { display: block; color: #b6bcc7; font-size: 11.5px; }

/* 支出：收款方（户名 + 账号） */
.payee-field { margin: 2px 0 14px; padding: 12px 14px; border: 1px solid #e3ebff; background: #f7f9ff; border-radius: 10px; }
.payee-field label { margin-bottom: 10px; }
.payee-field label:last-of-type { margin-bottom: 8px; }
.payee-field .pick-hint { margin-top: 2px; }
.payee-name { display: block; font-weight: 600; }
.payee-acct {
  display: block; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums;
  word-break: break-all; letter-spacing: .2px;
}

@media (max-width: 860px) {
  .op-layout { grid-template-columns: 1fr; }
  .op-form { max-width: none; }
}

/* auth page */
.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px 40px; width: 360px; box-shadow: 0 6px 30px rgba(0,0,0,.05);
}
.auth-card h1 { font-size: 19px; margin-bottom: 8px; }
.auth-card .flash { max-width: none; margin: 0 0 12px; }
.auth-back {
  display: inline-block; margin: -4px 0 12px; font-size: 12px;
  color: var(--dim); text-decoration: none;
}
.auth-back:hover { color: var(--brand); text-decoration: underline; }

/* confirm modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 33, .38);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: var(--panel); border-radius: 14px; padding: 24px 26px;
  width: 360px; max-width: calc(100vw - 32px); box-shadow: 0 18px 48px rgba(20,24,33,.18);
}
.modal-msg { font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.modal-acts { display: flex; justify-content: flex-end; gap: 10px; }

.foot { text-align: center; color: var(--dim); font-size: 12px; padding: 10px 0 30px; }

@media (max-width: 720px) {
  .topbar { padding: 0 14px; gap: 10px; overflow-x: auto; }
  .wrap { padding: 0 12px; }
  .inline-edit { flex-direction: column; }
  .inline-edit input[type=text] { width: 100%; }
  .pick-row { grid-template-columns: 18px minmax(0, 1fr) 100px; padding: 8px 10px; }
  .pick-bal { display: none; }
  .pick-row input[type=number] { width: 100px; }
}
