* { box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; margin: 0; color: #222; background: #f6f7f9; }
header { display: flex; align-items: center; gap: 18px; background: #1f3a5f; color: #fff; padding: 10px 18px; flex-wrap: wrap; }
header .brand { font-weight: 700; font-size: 17px; }
header nav a { color: #cfdceE; text-decoration: none; margin-right: 6px; padding: 6px 12px; border-radius: 6px; }
header nav a.active { background: #fff; color: #1f3a5f; font-weight: 600; }
header .lock { margin-left: auto; color: #ffd9a0; text-decoration: none; font-size: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 18px; }
.flash { background: #e6f4ea; color: #137333; padding: 10px 18px; }
.err { color: #b3261e; }
.muted { color: #778; font-size: 13px; }
.hint { background: #fff7e0; border: 1px solid #f0dfa0; padding: 8px 12px; border-radius: 6px; }
.authbox { max-width: 420px; margin: 60px auto; background: #fff; padding: 28px; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.authbox h1 { font-size: 20px; margin: 0 0 4px; }
.authbox h2 { font-size: 16px; color: #555; margin: 0 0 16px; }
.authbox label, .form label { display: block; margin: 10px 0; font-size: 14px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #ccd; border-radius: 6px; font-size: 14px; margin-top: 4px; background: #fff; }
.btn { display: inline-block; background: #eef1f5; color: #1f3a5f; border: 1px solid #c8d2e0; padding: 7px 14px; border-radius: 6px; text-decoration: none; font-size: 14px; cursor: pointer; }
.btn.primary { background: #1f6f43; border-color: #1f6f43; color: #fff; }
.btn.danger { background: #fdecea; border-color: #e0b4b0; color: #b3261e; }
.btn.ghost { background: transparent; }
.btn.active { background: #1f3a5f; color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar form.inline { display: inline; }
.toolbar select { width: auto; margin: 0; }
.viewswitch { display: inline-flex; gap: 6px; }
.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: #fff; border: 1px solid #e2e6ec; border-radius: 10px; padding: 12px 18px; min-width: 130px; }
.card span { display: block; color: #778; font-size: 13px; }
.card b { font-size: 20px; }
.card.big { flex: 1 1 300px; }
table.list, table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td, table.grid th, table.grid td { border-bottom: 1px solid #e8ebef; padding: 8px 10px; text-align: left; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid #e8ebef; white-space: nowrap; }
table.grid thead th { position: sticky; top: 0; background: #eef2f8; z-index: 2; }
table.grid tfoot td { background: #f4f7fb; }
table.grid th a { color: #1f3a5f; text-decoration: none; }
td.num, th.num { text-align: right !important; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f2f6fc; }
.tablewrap { overflow-x: auto; border: 1px solid #e2e6ec; border-radius: 8px; max-height: 75vh; overflow-y: auto; }
table.detail { border-collapse: collapse; background: #fff; min-width: 480px; }
table.detail th, table.detail td { border-bottom: 1px solid #e8ebef; padding: 8px 12px; text-align: left; font-size: 14px; }
table.detail th { color: #667; width: 170px; font-weight: 500; }
.tag { background: #e8eefc; color: #33507e; border-radius: 4px; padding: 1px 7px; font-size: 12px; }
.tag.warn { background: #fdeec9; color: #7a5b00; }
.tag.pending { background: #fdecea; color: #b3261e; font-weight: 600; }
tr.row-pending { background: #fdf1f0; }
tr.row-pending.clickable:hover { background: #fbe0de; }
.pending-text { color: #b3261e; font-weight: 600; }
td.pending-net { color: #b3261e; font-weight: 700; }
.pending-banner { background: #fdecea; border: 1px solid #e5a19c; color: #8c1d18; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.card.pending b { color: #b3261e; }
a.card { text-decoration: none; color: inherit; }
.paytag { border-radius: 4px; padding: 1px 7px; font-size: 12px; white-space: nowrap; }
.pay-paid { background: #e0f2e4; color: #137333; }
.pay-partial { background: #fdeec9; color: #7a5b00; }
.pay-unpaid { background: #fdecea; color: #b3261e; }
.pay-unmarked { background: #eceef1; color: #778; }
.form { max-width: 640px; }
.form fieldset { border: 1px solid #dde3ea; border-radius: 8px; margin: 14px 0; background: #fff; }
.form legend { font-weight: 600; padding: 0 6px; }
.filterbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; background: #fff; border: 1px solid #e2e6ec; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.filterbar label { font-size: 13px; color: #556; }
.filterbar input, .filterbar select { width: auto; margin-top: 2px; }
form.inline { display: inline; }
.mergebox { background: #fff; border: 1px dashed #c8d2e0; border-radius: 8px; padding: 10px 12px; margin: 14px 0; }
.mergebox select { width: auto; }
.atts li { margin: 6px 0; }
h2 { font-size: 19px; }
h3 { margin-top: 22px; }
.tag.multi { background: #e6f4ea; color: #137333; font-weight: 600; }
table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: 13px; color: #556; padding: 4px 6px; }
table.items td { padding: 4px 6px; }
table.items input, table.items select { margin-top: 0; }
