:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e222b;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --exp: #ff6b6b;
  --inc: #4ade80;
  --accent: #6ea8fe;
  --border: #2a2f3a;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 980px; margin: 0 auto; padding: 12px 14px 40px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
}
.tab.active { background: var(--panel2); color: var(--text); border-color: var(--border); }

.view { display: none; }
.view.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.card-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.card-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card.exp .card-value { color: var(--exp); }
.card.inc .card-value { color: var(--inc); }

.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 10px; font-size: 14px; outline: none;
}
.filters input[type="date"] { flex: 1 1 130px; min-width: 0; }
.filters input[type="search"] { flex: 2 1 160px; min-width: 0; }
.filters select { flex: 1 1 110px; min-width: 0; }

.btn {
  border: 1px solid var(--border); background: var(--panel2); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #0b1220; border-color: transparent; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { background: #3a1520; border-color: #6b2333; color: #ff9aa8; }

.list-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.sort-select { background: transparent; color: var(--muted); border: none; font-size: 13px; }

.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 12px;
}
.tx-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--panel2); }
.tx-main { min-width: 0; }
.tx-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tx-party { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.tx-sub { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tx-amt.exp { color: var(--exp); }
.tx-amt.inc { color: var(--inc); }
.tx-amt.neutral { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.more { width: 100%; margin-top: 12px; }

.chart { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 42px; gap: 8px; align-items: center; font-size: 13px; }
.bar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--panel2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-fill.exp { background: var(--exp); }
.bar-fill.inc { background: var(--inc); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }

h3 { font-size: 14px; color: var(--muted); margin: 18px 0 10px; font-weight: 600; }

.import-box {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px 18px; text-align: center; margin: 16px 0;
  transition: border-color .2s, background .2s;
}
.import-box.drag { border-color: var(--accent); background: rgba(110,168,254,.06); }
.import-icon { font-size: 40px; margin-bottom: 8px; }
.import-box p { margin: 6px 0; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.import-result { margin: 14px 0; }
.import-result .ok { color: var(--inc); }
.import-result .dup { color: #fbbf24; }
.import-result .err { color: var(--exp); }
.import-result .item { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }

.howto { margin: 22px 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.howto summary { cursor: pointer; color: var(--accent); }
.howto p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.danger-zone { margin-top: 30px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #262b36; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 99;
}

@media (max-width: 620px) {
  .cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card-value { font-size: 17px; }
  .tx { grid-template-columns: 36px 1fr auto; padding: 10px; }
  .tx-icon { width: 34px; height: 34px; font-size: 16px; }
  .bar-row { grid-template-columns: 84px 1fr 38px; }
  main { padding: 10px 10px 30px; }
  .topbar { padding: 10px 12px; }
}
