:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1f2430; --muted: #6b6f7a; --line: #e2dccf;
  --accent: #9a6b16; --accent-ink: #ffffff; --ok: #1f7a4a; --bad: #b3261e; --warn: #9a5b00; --soft: #f1e7d2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171c; --card: #1e2128; --ink: #ece8df; --muted: #9a9ca3; --line: #2f333c;
    --accent: #d6a94a; --accent-ink: #1b1406; --ok: #5cc28d; --bad: #f08a80; --warn: #e2a64b; --soft: #2a2620; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
[hidden] { display: none !important; }
.screen { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
h2 { font-size: 20px; margin: 18px 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
label input, label select { margin-top: 4px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost { background: transparent; }
button.small { padding: 5px 10px; font-size: 13px; }
button.wide { width: 100%; margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.row > input { flex: 1; }
.row > select { width: auto; flex: none; }
.unit { color: var(--muted); }
.msg { min-height: 1.2em; margin: 6px 0; font-size: 14px; }
.msg.bad { color: var(--bad); } .msg.ok { color: var(--ok); }
.muted { color: var(--muted); font-size: 13px; }
.login-card { margin: 12vh auto 0; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.brand { font-size: 22px; font-weight: 700; margin-bottom: 8px; display: flex; flex-direction: column; }
.brand span { font-size: 14px; color: var(--accent); font-weight: 600; letter-spacing: .1em; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 2; }
.who { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.who b { font-size: 16px; } .tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--accent); white-space: nowrap; }
.bal b { white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; }
.bal { text-align: right; } .bal span { display: block; font-size: 12px; color: var(--muted); } .bal b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: none; background: transparent; color: var(--muted); padding: 8px 12px; }
.tabs button.on { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.roles { display: grid; gap: 8px; }
.role { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.role.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.item.on { border-color: var(--accent); }
.role .meta { color: var(--muted); font-size: 13px; }
.online { color: var(--ok); font-size: 12px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 6px; margin: 2px 6px 0 0; background: var(--soft); }
.badge.bad { color: var(--bad); } .badge.warn { color: var(--warn); }
.bind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }
.bind .bad { color: var(--bad); font-weight: 600; }
.sheet-card label select, .sheet-card label input { margin-top: 4px; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiers button { display: flex; flex-direction: column; padding: 10px 6px; }
.tiers button b { font-size: 16px; } .tiers button span { font-size: 12px; color: var(--muted); }
.tiers button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.confirm { margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--soft); }
.confirm p { margin: 0; font-size: 15px; }
.result { margin-top: 16px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.result.ok { border-color: var(--ok); } .result.bad { border-color: var(--bad); } .result.warn { border-color: var(--warn); }
.result b { display: block; font-size: 17px; margin-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.card .k { font-size: 12px; color: var(--muted); } .card .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card .s { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 4px; }
.seg button { border: none; border-radius: 0; background: var(--card); color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.big { display: grid; gap: 6px; }
.big .ln { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big .ln span { font-size: 13px; color: var(--muted); }
.big .ln b { font-size: 19px; font-variant-numeric: tabular-nums; }
.big .rm { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.big .k { font-weight: 700; color: var(--ink); font-size: 14px; }
.notice { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--warn); }
.range input { flex: 1; } .range span { color: var(--muted); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; }
.list { display: grid; gap: 8px; margin-top: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.item .l1 { display: flex; justify-content: space-between; gap: 8px; }
.item .l1 b { font-variant-numeric: tabular-nums; }
.item .l2 { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.item .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.st-succeeded { color: var(--ok); } .st-refunded { color: var(--bad); } .st-uncertain, .st-pending { color: var(--warn); }
.sub { margin-left: 16px; border-left: 3px solid var(--soft); }
.off { opacity: .55; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.box summary { cursor: pointer; font-weight: 600; }
.secret { font: 600 20px/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; background: var(--soft); padding: 12px; border-radius: 8px;
  text-align: center; user-select: all; overflow-wrap: anywhere; }
.steps { padding-left: 20px; font-size: 14px; line-height: 1.7; }
.button-link { color: var(--accent); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); } .check input { width: auto; margin: 0; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.sheet-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 14px; padding: 18px 18px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  border-top: 4px solid var(--accent); }
.sheet-card.ok { border-top-color: var(--ok); } .sheet-card.ok h3 { color: var(--ok); }
.sheet-card.bad { border-top-color: var(--bad); } .sheet-card.bad h3 { color: var(--bad); }
.sheet-card.warn { border-top-color: var(--warn); } .sheet-card.warn h3 { color: var(--warn); }
#sh-text { font-size: 14px; color: var(--ink); line-height: 1.7; overflow-wrap: anywhere; }
.sheet-card h3 { color: var(--ink); font-size: 17px; margin: 0 0 6px; }
#sh-text { white-space: pre-line; }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .tiers { grid-template-columns: repeat(2, 1fr); } .bal b { font-size: 15px; } .top-right { gap: 8px; } #logout-top { padding: 5px 8px; font-size: 12px; } }
