/* 对账：深色、紧凑表格、金额用等宽粗体（他 11-21 点过头的那一套）。按 1352×861 排，一屏不滚，表格在自己那块里滚。 */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #040A17;
  --card: #0E1A2B;
  --card-2: #122238;
  --line: #22354F;
  --text: #EEF5FC;
  --text-2: #B6C7DA;
  --text-3: #93A8BF;
  --text-4: #6B829D;
  --gold: #F7C948;
  --green: #34D399;
  --amber: #FBBF24;
  --rose: #FB7185;
  --blue: #86D6FC;
  --primary: #6366F5;
  --mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --sans: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
small { font-weight: 400; }

/* ── 开场 / 登录 ─────────────────────────────── */
.boot { height: 100%; display: grid; place-items: center; color: var(--text-4); }
.login { height: 100%; display: grid; place-items: center; }
.login-card {
  width: 360px; padding: 28px 28px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-tip { margin: -6px 0 4px; color: var(--text-3); font-size: 12.5px; }
.login-foot { margin: 2px 0 0; color: var(--text-4); font-size: 12px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.field input, .search, .custom input, .inline-form input {
  height: 36px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); outline: none;
}
.field input:focus, .search:focus, .custom input:focus, .inline-form input:focus { border-color: var(--primary); }
.form-error { margin: 0; color: var(--rose); font-size: 12.5px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 17px; letter-spacing: 1px; }
.brand small { color: var(--text-4); font-size: 12px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}

/* ── 按钮 / 小胶囊 ───────────────────────────── */
.btn {
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--text-4); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.wide { height: 38px; margin-top: 4px; }
.btn.small { height: 28px; padding: 0 12px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; color: var(--text-3); }
.btn.ghost:hover { border-color: var(--line); color: var(--text); }
.btn.danger:hover { border-color: var(--rose); color: var(--rose); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; white-space: nowrap; border: 1px solid transparent;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--green); background: rgba(52, 211, 153, .10); border-color: rgba(52, 211, 153, .25); }
.pill.wait { color: var(--amber); background: rgba(251, 191, 36, .10); border-color: rgba(251, 191, 36, .25); }
.pill.bad { color: var(--rose); background: rgba(251, 113, 133, .10); border-color: rgba(251, 113, 133, .28); }
.pill.mute { color: var(--text-4); background: rgba(107, 130, 157, .10); border-color: rgba(107, 130, 157, .25); }

/* ── 主屏 ────────────────────────────────────── */
.app { height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 14px; }
.top { display: flex; align-items: center; justify-content: space-between; height: 34px; flex: none; }
.top-right { display: flex; align-items: center; gap: 8px; }
.zone { color: var(--text-4); font-size: 12px; margin: 0 4px; }
.who { color: var(--text-2); font-size: 12.5px; margin-right: 2px; }

.stats { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr 1fr; gap: 12px; flex: none; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px 11px; min-width: 0; }
.stat.balance { background: linear-gradient(135deg, #14233a 0%, var(--card) 70%); }
.stat-title { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-title small { color: var(--text-4); margin-left: 6px; font-size: 11.5px; }
.stat-num {
  font-family: var(--mono); font-weight: 700; font-size: 27px; line-height: 1.25; margin-top: 4px; letter-spacing: -.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat.balance .stat-num { font-size: 31px; }
.stat-num.gold { color: var(--gold); }
.stat-num.green { color: var(--green); }
.stat-num.rose { color: var(--rose); }
.stat-num.dim { color: var(--text-3); }
.stat-note { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note b { font-family: var(--mono); color: var(--text-2); }
.stat-note .warn { color: var(--rose); }

.bar { display: flex; align-items: center; gap: 12px; flex: none; height: 32px; }
.chips { display: flex; gap: 6px; }
.chip {
  height: 30px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--text-3); cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.custom { display: flex; align-items: center; gap: 6px; color: var(--text-4); }
.custom input { height: 30px; padding: 0 8px; font-family: var(--mono); font-size: 12px; color-scheme: dark; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); cursor: pointer; user-select: none; }
.check input { accent-color: var(--primary); width: 14px; height: 14px; }
.search { width: 300px; height: 30px; border-radius: 999px; font-size: 12.5px; }

.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 12px; }
.panel {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.panel-head { display: flex; align-items: baseline; gap: 10px; padding: 11px 16px 9px; flex: none; }
.panel-head b { font-size: 14.5px; }
.panel-head small { color: var(--text-4); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.scroll { flex: 1; min-height: 0; overflow: auto; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: #1d2f47; border-radius: 6px; border: 2px solid var(--card); }
.scroll::-webkit-scrollbar-corner { background: transparent; }

.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--card); text-align: left; font-weight: 400; font-size: 12px;
  color: var(--text-4); height: 28px; padding: 0 8px; border-bottom: 1px solid var(--line);
}
.grid td {
  height: 34px; padding: 0 8px; border-bottom: 1px solid rgba(34, 53, 79, .55); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 12.5px; color: var(--text-2);
}
.grid th:first-child, .grid td:first-child { padding-left: 16px; }
.grid th:last-child, .grid td:last-child { padding-right: 16px; }
.grid .num { text-align: right; }
.grid tbody tr { cursor: default; }
.sales .grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--card-2); }
.c-time { width: 136px; }
.c-money { width: 110px; }
.c-status { width: 86px; }
.c-payer { width: 144px; }
.c-email { width: 144px; }
.c-card { width: 168px; }
.c-balance { width: 104px; }
.acct .c-time { width: 108px; }
.acct .c-money { width: 108px; }
.acct .money { font-size: 13px; }

.t { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.t b { color: var(--text-2); font-weight: 500; }
.money { font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: -.2px; }
.money.gold { color: var(--gold); }
.money.green { color: var(--green); }
.money.rose { color: var(--rose); }
.money.dim { color: var(--text-4); font-weight: 500; }
.money.fee { color: var(--text-3); font-weight: 500; }
.bal { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.payer { color: var(--text); font-weight: 500; }
.none { color: var(--text-4); }
.card-last { font-family: var(--mono); color: var(--blue); font-weight: 600; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: 11px; line-height: 17px;
  color: var(--text-3); border: 1px solid var(--line); }
.sub { color: var(--text-4); margin-left: 6px; }
tr.off td { opacity: .55; }
tr.off:hover td { opacity: .85; }
tr.fresh td { animation: fresh 8s ease-out 1; }
@keyframes fresh { 0%, 35% { background: rgba(99, 102, 245, .30); } 100% { background: transparent; } }
.empty { padding: 44px 16px; text-align: center; color: var(--text-4); }
.more { padding: 10px 16px; color: var(--amber); font-size: 12px; }

/* ── 抽屉（一笔的全部信息）/ 弹层 ─────────────── */
.shade { position: fixed; inset: 0; background: rgba(2, 6, 14, .55); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; z-index: 11; background: var(--card);
  border-left: 1px solid var(--line); display: flex; flex-direction: column;
}
.drawer-head, .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; flex: none; }
.drawer-head b, .modal-head b { font-size: 15px; }
.drawer-body { flex: 1; overflow: auto; padding: 0 18px 18px; }
.big-money { font-family: var(--mono); font-weight: 700; font-size: 30px; margin: 2px 0 2px; }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0; margin-top: 12px; border-top: 1px solid var(--line); }
.kv > div { padding: 8px 0; border-bottom: 1px solid rgba(34, 53, 79, .55); font-size: 12.5px; min-width: 0; }
.kv .k { color: var(--text-4); }
.kv .v { color: var(--text); overflow-wrap: anywhere; user-select: text; }
.kv .v.mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.copy { margin-left: 8px; height: 20px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--text-3); font-size: 11px; cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--text-4); }

.modal { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(2, 6, 14, .6); }
.modal-card { width: 780px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.modal-card.narrow { width: 400px; }
.modal-body { padding: 4px 18px 18px; overflow: auto; }
.modal-body h4 { margin: 16px 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.modal-body h4 small { color: var(--text-4); margin-left: 8px; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input { height: 32px; width: 170px; }
.stack { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.secret {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(247, 201, 72, .35);
  background: rgba(247, 201, 72, .07); font-size: 12.5px; color: var(--text-2);
}
.secret code { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--gold); margin: 0 8px; user-select: all; }
.mini { width: 100%; border-collapse: collapse; table-layout: auto; }
.mini th { text-align: left; font-weight: 400; font-size: 12px; color: var(--text-4); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mini td { padding: 6px 8px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid rgba(34, 53, 79, .55); white-space: nowrap; }
.mini td.mono { font-family: var(--mono); font-size: 12px; }
.mini td.acts { text-align: right; }
.mini .btn { margin-left: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 20; padding: 9px 16px; border-radius: 999px;
  background: #1b2c45; border: 1px solid var(--line); color: var(--text); font-size: 12.5px;
}

/* 窗口窄的时候（笔记本放大 150% 后只有 1280 宽很常见）：两块表不并排挤着，改成一次看一块，上面多一个切换。 */
.tabs { display: none; }
.tab {
  height: 26px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
}
.tab.on { background: #1b2c45; color: var(--text); font-weight: 600; }
@media (max-width: 1320px) {
  .tabs { display: flex; padding: 1px; border: 1px solid var(--line); border-radius: 999px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split[data-tab="sales"] .acct, .split[data-tab="acct"] .sales { display: none; }
  .c-payer { width: 190px; }
  .c-email { width: 230px; }
  .c-card { width: 250px; }
  .acct .c-time { width: 136px; }
  .search { width: 240px; }
  .stat-title small { display: none; }
}
@media (max-width: 1180px) {
  .stat-num { font-size: 23px; }
  .stat.balance .stat-num { font-size: 26px; }
  .zone { display: none; }
  .search { width: 180px; }
  .c-payer { width: 160px; }
  .c-email { width: 190px; }
  .c-card { width: 200px; }
}
