:root {
  --bg: #f6f7f9;
  --card: #fff;
  --line: #e5e7eb;
  --text: #1f2937;
  --sub: #6b7280;
  --brand: #1f3a5f;
  --gold: #e6b45c;
  --red: #dc2626;
  --green: #16a34a;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: linear-gradient(135deg, #1b3358, #2a4a7a); color: #fff;
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.ver { font-size: 11px; font-weight: 400; opacity: .7; margin-left: 6px; }
.who { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 10px; }
.who a { color: #ffe0a3; text-decoration: none; }
.tabs { display: flex; gap: 4px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: transparent; padding: 12px 16px; font-size: 14px; cursor: pointer;
  color: var(--sub); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--gold); font-weight: 600; }
.panel { display: none; padding: 14px; }
.panel.active { display: block; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
input, select, textarea {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px;
  background: #fff; color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
.bar input, .bar select { min-width: 150px; }
input[type="date"], input[type="month"], input[type="number"] { min-width: 130px; }
.btn {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; font-size: 13.5px; color: var(--text);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: linear-gradient(135deg, var(--gold), #d9a03e); border: none; color: #fff; font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.ghost { border-style: dashed; color: var(--sub); }
/* 带小标题的筛选组（日期容易看不出筛的是什么，所以给每个输入配标题） */
.fld { display: inline-flex; align-items: center; gap: 6px; }
.fld > b { font-size: 12.5px; color: var(--sub); font-weight: 600; white-space: nowrap; }
.fld .to { font-size: 12px; color: var(--sub); }
.row-inline { display: flex; gap: 6px; align-items: center; }
.row-inline input { flex: 1 1 auto; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card h4 { margin: 14px 0 8px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--sub); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f9fafb; color: var(--sub); font-weight: 600; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: #f8fafc; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.tag.signed { background: #e8f7ee; color: var(--green); }
.tag.lost { background: #fdecea; color: var(--red); }
.tag.quote { background: #eef4ff; color: #2563eb; }
.tag.other { background: #f3f4f6; color: var(--sub); }
.amount { font-variant-numeric: tabular-nums; }
.modal-mask {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  z-index: 50; align-items: flex-start; justify-content: center; overflow: auto; padding: 24px 12px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 18px 20px; width: min(940px, 100%);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .28);
}
.modal.small { width: min(620px, 100%); }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--sub); }
label input, label select, label textarea { width: 100%; }
label.full { margin-top: 10px; }
.req { color: var(--red); }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; }
.modal-foot .hint { margin-right: auto; }
.total { margin-left: auto; font-size: 14px; }
.total b { color: var(--red); font-size: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(17, 24, 39, .92); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90;
}
.toast.show { opacity: 1; }
.item-row input, .item-row select { min-width: 0; }
.sync-ok { color: var(--green); font-weight: 600; }
.sync-bad { color: var(--red); font-weight: 600; }
@media (max-width: 700px) {
  .bar input, .bar select { min-width: 120px; flex: 1 1 120px; }
  th, td { padding: 7px 8px; }
}
