/* Luna v3 样式：原型 docs/design/luna-v3-prototypes/luna-v3.html 的 <style> 整体搬来（去掉只属于原型的 .proto-note），
   后面补外壳用到的几块：旧抽屉 / 审计 diff 的类名、第 2 档弹窗、登录页、骨架与错误态。 */
:root {
  --bg: #f4f5f7; --panel: #fff; --text: #111518; --muted: #6b7380; --faint: #9aa3b0;
  --line: #dfe3e9; --line2: #eceff3; --ink: #0f1720;
  --accent: #166c52; --accent2: #1b7f62; --accent-bg: #e6f3ee;
  --ok: #1b7f62; --ok-bg: #e6f3ee;
  --warn: #9a6200; --warn-bg: #fbf1dc;
  --crit: #c0352e; --crit-bg: #fbe8e6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,32,.04), 0 2px 10px rgba(16,24,32,.05);
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; padding: 7px 12px; border-radius: 8px; line-height: 1.2; }
button:hover { border-color: #aeb8c5; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--crit); border-color: var(--crit); color: #fff; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--line2); color: var(--text); }
button.sm { padding: 4px 9px; font-size: 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--line2); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid #2b6cb0; outline-offset: 2px; }

/* shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0,1fr); }
.side { border-right: 1px solid var(--line); background: #fff; padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; padding: 2px 6px; }
.brand .mark { width: 26px; height: 26px; background: var(--ink); color: #fff; display: grid; place-items: center; border-radius: 7px; font-size: 14px; }
.env { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; }
.who { color: var(--muted); font-size: 12px; padding: 0 6px 6px; border-bottom: 1px solid var(--line2); }
.who strong { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px; }
.nav a:hover { background: var(--line2); text-decoration: none; }
.nav a.active { background: var(--ink); color: #fff; }
.nav a .pill { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--crit); color: #fff; }
.nav a .pill.warn { background: var(--warn); }
.nav a.active .pill { background: #fff; color: var(--ink); }
.nav-sep { border: 0; border-top: 1px solid var(--line2); margin: 6px 0 2px; }
details.v1 summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 10px; display: flex; justify-content: space-between; border-radius: 8px; }
details.v1 summary::-webkit-details-marker { display: none; }
details.v1 summary:hover { background: var(--line2); }
details.v1 .nav a { font-size: 13px; color: var(--muted); padding: 5px 10px; }
.side .spacer { flex: 1; }
.main { min-width: 0; padding: 18px 28px 56px; max-width: 1320px; }
.main.users-main { max-width: none; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.top .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.stale { background: var(--faint); }

/* layout */
.row-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 18px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.row-label span { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; }
.kv-list { display: grid; gap: 3px; font-size: 12px; }
.kv-list div { display: flex; justify-content: space-between; gap: 8px; }
.kv-list .k { color: var(--muted); }
.sw { display: inline-flex; align-items: center; gap: 6px; }
.sw i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sw.nd i { background: var(--warn); }
.sw.hot i { background: var(--crit); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.card h2 .n { background: var(--line2); color: var(--text); font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.card h2 .n.warn { background: var(--warn-bg); color: var(--warn); }
.card h2 .n.crit { background: var(--crit-bg); color: var(--crit); }
.card h2 .right { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
.section { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.crit { background: var(--crit-bg); color: var(--crit); }
.badge.muted { background: var(--line2); color: var(--muted); }

/* alerts */
.alerts { display: grid; gap: 6px; }
.alert { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--text); }
.alert.crit { border-left-color: var(--crit); }
.alert.warn { border-left-color: var(--warn); }
.alert .k { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.alert .go { color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; background: #fff; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line2); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--line2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .act { white-space: nowrap; text-align: right; }
.tbl-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 260px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .7; margin-left: 4px; }
.pager { display: flex; justify-content: flex-end; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); padding-top: 8px; }
.tablewrap { overflow: auto; }

/* forms / switches */
.toggle { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px; background: #fff; cursor: pointer; font-size: 13px; }
.toggle .knob { width: 30px; height: 18px; border-radius: 999px; background: #c9d0da; position: relative; }
.toggle .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle.on .knob { background: var(--ok); }
.toggle.on .knob::after { left: 14px; }
.toggle.hot.on .knob { background: var(--crit); }
.gate { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px 16px; }
.gate .g { display: grid; gap: 4px; }
.gate .g .l { font-size: 12px; color: var(--muted); }
.gate .g .m { font-size: 11px; color: var(--faint); }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); font-size: 14px; background: #fff; }
.field .reveal { display: flex; gap: 6px; }
.field .reveal input { flex: 1; min-width: 0; }
.field .tail { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.field .tail.warn { color: var(--crit); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.addr { font-family: var(--mono); font-size: 12px; }
.copy { font-size: 11px; color: var(--accent); cursor: pointer; margin-left: 6px; }
.note { font-size: 12px; color: var(--muted); }
.receipt { border: 1px solid var(--ok); background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 9px 12px; font-size: 13px; display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.receipt b { font-weight: 700; }
.receipt .x { cursor: pointer; color: var(--ok); opacity: .7; }
.blockna { border: 1px solid var(--crit); background: var(--crit-bg); color: var(--crit); border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-bottom: 10px; }

/* switch cards */
.switches { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.swcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.swcard .t { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.swcard .s { font-size: 12px; color: var(--muted); min-height: 32px; }
.swcard .meta { font-size: 11px; color: var(--faint); }
.swcard.nd { border-color: #e6c98a; background: #fffdf7; }
.swcard.hot { border-color: #e9b1ad; background: #fff8f7; }

/* drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(15,23,32,.35); z-index: 50; display: none; }
.overlay.open { display: flex; justify-content: flex-end; }
.drawer { background: #fff; width: min(520px, 94vw); height: 100%; overflow: auto; box-shadow: -4px 0 24px rgba(16,24,32,.12); }
.drawer .head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: #fff; }
.drawer .head h3 { margin: 0; font-size: 16px; }
.drawer .body { padding: 16px 18px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.modal-wrap { position: fixed; inset: 0; background: rgba(15,23,32,.4); z-index: 60; display: none; place-items: center; }
.modal-wrap.open { display: grid; }
.modal-wrap { overflow-y: auto; }
.modal { background: #fff; width: min(520px, 94vw); border-radius: 12px; border: 2px solid var(--crit); box-shadow: 0 12px 40px rgba(0,0,0,.2); padding: 18px 20px; display: grid; gap: 12px; }
.modal h3 { margin: 0; color: var(--crit); font-size: 16px; }
.modal .diff { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 13px; background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.modal .diff .k { color: var(--muted); }
.modal .check { font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.modal .check .no { color: var(--crit); }
.modal .check .yes { color: var(--ok); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; display: none; z-index: 70; }
.toast.show { display: block; }

/* home v2 */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--ink); color: #fff; border-radius: 12px; padding: 18px 22px; }
.hero-n { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-n small { font-size: 16px; font-weight: 600; margin-left: 8px; color: #cfd6e0; }
.hero-s { color: #aab3c0; font-size: 13px; margin-top: 8px; }
.hero-gates { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 46%; }
.gchip { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #dfe5ec; white-space: nowrap; }
.gchip.on { border-color: rgba(61,220,151,.45); }
.gchip.nd { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 600; }
.gchip.hot { background: var(--crit); border-color: var(--crit); color: #fff; font-weight: 600; }
.todo { display: grid; gap: 8px; }
.todo .item { display: grid; grid-template-columns: 84px 1fr auto auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--warn); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.todo .item.crit { border-left-color: var(--crit); }
.todo .item.warn { border-left-color: var(--warn); }
.todo .item.info { border-left-color: var(--faint); background: #fafbfc; box-shadow: none; }
.todo .sev { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.todo .item.crit .sev { color: var(--crit); } .todo .item.warn .sev { color: var(--warn); } .todo .item.info .sev { color: var(--muted); }
.todo .t { font-size: 15px; font-weight: 600; }
.todo .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.todo .age { font-size: 12px; color: var(--faint); white-space: nowrap; }
.btn { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--text); background: #fff; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #aeb8c5; }
.glance { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 16px 10px; box-shadow: var(--shadow); }
.glance .g-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 10px 0 4px; }
.glance .g-row { display: grid; grid-template-columns: 10px 1fr auto 44px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line2); color: var(--text); font-size: 13px; }
.glance .g-row:hover { background: var(--line2); text-decoration: none; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.glance .g-row .n { color: var(--text); }
.glance .g-row .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.glance .g-row .v.zero { color: var(--faint); font-weight: 500; }
.glance .g-row .t { font-size: 11px; color: var(--faint); text-align: right; }
.glance i.d { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); }
.glance i.d.warn { background: var(--warn); } .glance i.d.crit { background: var(--crit); } .glance i.d.muted { background: #c9d0da; }
@media (max-width: 1100px) { .glance { grid-template-columns: 1fr; } .hero { flex-direction: column; align-items: flex-start; } .hero-gates { max-width: 100%; justify-content: flex-start; } }
@media (max-width: 760px) { .todo .item { grid-template-columns: 1fr; } }

/* sub-page verdict */
.verdict { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--ok); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.verdict.warn { border-left-color: var(--warn); } .verdict.crit { border-left-color: var(--crit); }
.verdict .vt { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.verdict .vs { font-size: 12.5px; color: var(--muted); text-align: right; }
.glance.one { grid-template-columns: 1fr; }
.glance.one .g-row { grid-template-columns: 10px 1fr auto 90px; }
.glance .g-row .t button { margin-left: auto; }
td.zero, .zero { color: var(--faint); }
tr.dim td { background: #fafbfc; }
@media (max-width: 760px) { .verdict { flex-direction: column; } .verdict .vs { text-align: left; } }

.view { display: none; }
.view.active { display: block; }
@media (max-width: 1100px) { .switches { grid-template-columns: repeat(3, minmax(0,1fr)); } .gate { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 16px; } .grid2, .grid3, .switches { grid-template-columns: 1fr; } }

/* ---------- 以下为 v3 外壳补充（原型里没有画的几块） ---------- */
/* V1 组展开后侧栏可能高过一屏：侧栏自己滚，退出登录不会掉出屏幕。 */
.side { overflow-y: auto; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); }
button.primary:disabled:hover { border-color: var(--accent); }
.status .readout { display: inline-flex; white-space: nowrap; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px 6px; font-size: 12px; color: var(--muted); }
.status .readout:hover { background: var(--line2); color: var(--text); }
.chip .n { pointer-events: none; }
.nowrap { white-space: nowrap; }
.pager button { min-width: 28px; }
.page-error { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--crit); background: var(--crit-bg); color: var(--crit); border-radius: 10px; padding: 12px 16px; font-size: 13px; }
.skeleton { height: 52px; border-radius: 10px; background: linear-gradient(90deg, var(--line2), #f7f8fa, var(--line2)); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; margin-bottom: 10px; }
.skeleton.short { width: 60%; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.receipt-err { display: flex; justify-content: space-between; gap: 12px; }
.receipt-err .x { cursor: pointer; opacity: .7; }

/* 第 2 档（写配置）弹窗：中性外观；红色只给第 3 档（资金 · 密钥 · 实盘）。 */
.modal.t2 { border-color: var(--line); }
.modal.t2 h3 { color: var(--text); }
.modal .err { color: var(--crit); background: var(--crit-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.modal .err[hidden] { display: none; }

/* 旧 components/drawer.js 的 markup（.drawer-overlay / .drawer-head / .drawer-body）与 views/audit.js 的 diff。 */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,32,.35); z-index: 50; display: flex; justify-content: flex-end; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: #fff; }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.drawer-body { padding: 16px 18px; display: grid; gap: 14px; }
.drawer-section-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff-label { font-size: 11px; color: var(--faint); margin-bottom: 4px; }
.diff-block { margin: 0; font-family: var(--mono); font-size: 11.5px; background: var(--bg); border-radius: 8px; padding: 8px 10px; overflow: auto; max-height: 360px; white-space: pre-wrap; word-break: break-all; }

/* 登录页 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; display: grid; gap: 14px; }
.login-card form { display: grid; gap: 8px; }
.login-msg { font-size: 13px; color: var(--muted); min-height: 18px; }
.login-msg.err { color: var(--crit); }
@media (max-width: 760px) { .diff-grid { grid-template-columns: 1fr; } .search { min-width: 0; width: 100%; } .top { flex-wrap: wrap; } }

/* ---------- 收入总览 / 包赔报表（LUNA-INCOME-PAGE-01，真值 docs/design/luna-income/report.css）---------- */
/* ---------- INCOME：收入总览 / 包赔报表共用 ---------- */
.income-module { min-width: 0; }
.income-module .filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; }
.income-module .filters .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.income-module .filters .custom { display: flex; gap: 6px; align-items: center; padding-left: 12px; border-left: 1px solid var(--line2); font-size: 12px; color: var(--muted); }
.income-module .filters input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 13px; color: var(--text); background: #fff; }
.income-module .filters select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 13px; color: var(--text); background: #fff; max-width: 360px; }
.income-module .filters .grow { flex: 1; }
.income-module .filters .tz { font-size: 12px; color: var(--faint); white-space: nowrap; }
.income-module .period { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; margin: 8px 2px 0; }
.income-module .period b { color: var(--text); font-weight: 600; }
.income-module .stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
/* LUNA-INCOME-TERMS-01 修订 A：收入总览页首四格；包赔报表、Antfun 结算页仍用上面的三列 */
.income-module .stats3.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.income-module .stat { background: var(--panel); padding: 16px 18px; min-width: 0; }
.income-module .stat .label { color: var(--muted); font-size: 12px; }
.income-module .stat strong { display: block; font-size: 28px; line-height: 1.15; margin: 4px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.income-module .stat strong small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.income-module .stat .help { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.income-module .delta { font-weight: 600; white-space: nowrap; }
.income-module .delta.up { color: var(--ok); }
.income-module .delta.down { color: var(--crit); }
.income-module .delta.more { color: var(--warn); }
.income-module .delta.none { color: var(--faint); font-weight: 500; }
.income-module .admincards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.income-module .admincards > .card { min-width: 0; }
.income-module .card h2 .right { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
/* 报表式行：运算符 / 科目 / 金额 */
.income-module .stmt { display: grid; }
.income-module .stmt .r { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 13px; }
.income-module .stmt .r .op { color: var(--faint); font-family: var(--mono); font-size: 12px; text-align: center; }
.income-module .stmt .r .n .help { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.income-module .stmt .r .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.income-module .stmt .r .v .help { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.income-module .stmt .r.sum { border-bottom: 0; border-top: 2px solid var(--line); margin-top: 2px; padding-top: 10px; }
.income-module .stmt .r.sum .n { font-weight: 700; }
.income-module .stmt .r.sum .v { font-size: 17px; font-weight: 700; }
.income-module .stmt .r.head { padding: 12px 0 2px; border-bottom: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.income-module .stmt .r.head + .r { border-top: 0; }
.income-module .stmt .r.sub { padding: 4px 0 8px; border-bottom: 0; font-size: 12px; color: var(--muted); }
.income-module .stmt .r.sub .v { font-weight: 500; color: var(--muted); }
.income-module .neg { color: var(--crit); }
.income-module .na { color: var(--crit); }
.income-module .info { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 12.5px; }
.income-module .tbl-tools { justify-content: space-between; }
.income-module .tbl-tools .auto { font-size: 12px; color: var(--faint); }
.income-module th, .income-module td { white-space: nowrap; }
.income-module td.num { font-variant-numeric: tabular-nums; }
.income-module tr.sumrow td { font-weight: 700; background: #fafbfc; border-top: 2px solid var(--line); }
.income-module tr.pending td { color: var(--muted); font-style: normal; }
.income-module .empty { margin-top: 14px; }
.income-module .partial { display: flex; justify-content: space-between; gap: 12px; border: 1px solid #e6c98a; background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-top: 10px; }
/* One Pager 抽屉里的邮件预览：服务端渲染的整份邮件放在隔离的 iframe.mail 里（LUNA-INCOME-ONEPAGER-WYSIWYG-01），
   邮件样式和 Luna 样式互不影响；收件人看到的就是框里的样子，内容在框内滚动。 */
.income-module .mail { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 18px 20px; font-size: 13px; color: var(--text); }
.income-module iframe.mail { display: block; width: 100%; height: 70vh; padding: 0; }
.income-module .mail .mh { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.income-module .mail .mp { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.income-module .mail .mk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.income-module .mail .mk div { background: var(--bg); border-radius: 6px; padding: 10px; }
.income-module .mail .mk .l { font-size: 11px; color: var(--muted); }
.income-module .mail .mk .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.income-module .mail .mk .d { font-size: 11px; margin-top: 2px; }
.income-module .mail .mt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-top: 8px; }
.income-module .mail .mf { font-size: 11px; color: var(--faint); border-top: 1px solid var(--line2); padding-top: 10px; margin-top: 4px; }
.income-module .recips { display: flex; flex-wrap: wrap; gap: 6px; }
.income-module .drawer-foot { display: flex; justify-content: flex-end; gap: 8px; }
/* 包赔报表：结论条沿用 .verdict，只补样本不足的灰态和预算进度条 */
.income-module .verdict { margin-top: 14px; }
.income-module .verdict.muted { border-left-color: var(--faint); }
.income-module .verdict.muted .vt { color: var(--muted); }
.income-module .verdict .vt b { font-variant-numeric: tabular-nums; }
.income-module .bar { height: 6px; border-radius: 999px; background: var(--line2); overflow: hidden; margin: 6px 0 2px; }
.income-module .bar i { display: block; height: 100%; background: var(--accent); }
.income-module .bar i.warn { background: var(--warn); }
.income-module .bar i.crit { background: var(--crit); }
.income-module .stmt .r .v .tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.income-module td .badge { vertical-align: middle; }
@media (max-width: 1100px) { .income-module .admincards { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .income-module .stats3, .income-module .stats3.c4 { grid-template-columns: 1fr; } .income-module .filters .custom { border-left: 0; padding-left: 0; } }
.bwin-market-module .big { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 8px 0 4px; }

/* ---------- 用户交易页（LUNA-TRADING-PRESENT-01）：只用上面的 token，不写色值 ---------- */
.gate.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gate.c4 .g { grid-template-columns: minmax(0, 1fr); }
.gate.c4 .g .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate.c4 .g .m.warn { color: var(--warn); }
.gate select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }
.gate-foot { margin-top: 10px; }
.submit-line { margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.submit-line.ok { color: var(--ok); }
.submit-line.no { color: var(--warn); }
details.more { margin-top: 12px; }
.row-label + details.more { margin-top: 0; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after, .glance button.g-row .n::after { content: " ▸"; color: var(--faint); }
details.more[open] > summary::after, .glance button.g-row[aria-expanded="true"] .n::after { content: " ▾"; }
details.more > .tablewrap, details.more > .card { margin-top: 8px; }
.glance button.g-row { width: 100%; border: 0; border-top: 1px solid var(--line2); border-radius: 0; background: none; text-align: left; line-height: inherit; color: var(--text); }
.glance button.g-row:hover { border-color: var(--line2); width: calc(100% + 16px); }
.glance.exp div.g-row:hover { background: none; margin: 0; padding-left: 0; padding-right: 0; }
.glance i.d.none { visibility: hidden; }
.g-body { margin: 2px 0 10px; }
.g-sub { margin: 6px 0 2px; }
.field .err { color: var(--crit); }
.clip { display: inline-block; max-width: 24em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.todo .age .crit { color: var(--crit); font-weight: 600; }
.gate .g > button.toggle { line-height: inherit; justify-self: stretch; }
@media (max-width: 1100px) { .gate.c4 { grid-template-columns: 1fr 1fr; } }
.glance.exp[data-section="house-book"] .g-row { grid-template-columns: 10px minmax(7em, auto) minmax(0, 1fr) 90px; }
.glance[data-section="house-book"] .g-row .v { white-space: normal; text-align: right; }

/* VIP-4：原型的表单/收入网格，只作用于新增VIP页面。 */
.vip-module { min-width: 0; }
.vip-module .formgrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.vip-module .admincards { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.vip-module .admincards > .section { margin-top:0; }
.vip-module .stats3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.vip-module .stat { background:var(--panel); padding:16px; min-width:0; }
.vip-module .stat strong { display:block; font-size:24px; overflow-wrap:anywhere; }
.vip-module .stat .label,.vip-module .help { color:var(--muted); font-size:12px; }
.vip-module .info { margin-top:14px; padding:12px; border-radius:8px; background:var(--bg); color:var(--muted); font-size:13px; }
.vip-module .listrow { display:flex; justify-content:space-between; gap:16px; padding:16px 0; border-bottom:1px solid var(--line2); }
.vip-module .row,.vip-module .split { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.vip-module .split { justify-content:space-between; }
.vip-module .field { min-width:0; }
.vip-module input { min-width:0; max-width:100%; }
.vip-module td input { width:150px; }
.vip-module th,.vip-module td { white-space:nowrap; }
.vip-module input:disabled { background:var(--bg); color:var(--muted); cursor:not-allowed; }
.vip-module .vip-error { color:var(--crit); }
@media(max-width:720px) { .vip-module .formgrid,.vip-module .admincards { grid-template-columns:1fr; } .vip-module .stats3 { grid-template-columns:1fr 1fr; } .vip-module .stats3 .stat:last-child { grid-column:1/-1; } .vip-module .listrow { flex-wrap:wrap; } }
.boxes-module .boxes-figure { font-size:25px; color:var(--text); margin:12px 0 0; overflow-wrap:anywhere; }
.boxes-module .boxes-dist { width:min(600px,94vw); max-height:90vh; overflow:auto; }
.boxes-module .boxes-dist td input { width:100%; min-width:64px; }
.boxes-module .boxes-dist th,.boxes-module .boxes-dist td { padding-left:4px; padding-right:4px; }
/* STREAM-4：用户列里的完整钱包要换行，否则把金额列挤出抽屉。 */
.vip-module td.streamer-user { white-space:normal; overflow-wrap:anywhere; min-width:150px; }
/* PROMO-2：热钱包低于 7 日发放量时整张卡变警示色；新建活动弹窗。 */
.promotions-module .stat.warn { background:var(--warn-bg); }
.promotions-module .stat.warn strong,.promotions-module .stat.warn .help { color:var(--warn); }
.promotions-module .promotions-create { width:min(640px,94vw); max-height:90vh; overflow:auto; }
.promotions-module .promotions-create .field { display:grid; gap:4px; margin-bottom:10px; }
/* SHARE-MICRO-01：分成和奖励金额不足 $0.01 时 0 的个数写成 sub 下标（share-amount.js），默认的下标会把抽屉表格行和徽章撑高约 2.5–3.5px。 */
sub { line-height:0; }
/* SHARE-MICRO-A11Y-01：$0.0₄52 的页面文字是展开值 $0.000052（读屏、复制都拿到它）：隐藏的 0 只做视觉隐藏，下标数字由 ::before 读 data-zeros 生成（sub 带 aria-hidden，生成内容不进复制）；外层 relative 让隐藏的 0 留在横滚表格里，不撑宽整页。 */
.share-micro { position:relative; }
.share-micro > span { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.share-micro > sub::before { content:attr(data-zeros); }
/* LUNA-USERS-WATCH-PROMO-01：用户列名字前的「重点关注」星标（点了只切换标记，不开抽屉）；标记后用警示色。 */
button.star { padding:0 4px; margin-right:4px; border-color:transparent; background:transparent; color:var(--faint); font-size:15px; line-height:1; }
button.star:hover { border-color:var(--line); }
button.star[aria-pressed="true"] { color:var(--warn); }
button.star:disabled { cursor:default; border-color:transparent; }
/* 星标与名字之间不折行（邮箱、user_id 本身没有断行点，加了星标才多出一个）。 */
td:has(> button.star) { white-space:nowrap; }
/* ===== 新增（包赔设置、包赔报表）：只补 Luna 没有的几处，类名前缀 cb- ===== */
.cb-dist svg.chart{display:block;width:100%}
.cb-axis{position:relative;display:flex;justify-content:space-between;font-size:11px;color:var(--faint);margin-top:4px;min-height:18px}
.cb-axis .cb-avgmark{position:absolute;top:0;transform:translateX(-50%);white-space:nowrap;color:var(--text)}
.cb-figs{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:12px 0}
.cb-figs .boxes-figure{font-size:22px;color:var(--text);margin:6px 0 0}
.cb-cap{font-size:11px;color:var(--warn)}
@media (min-width:1101px){.income-module .admincards.cb-three{grid-template-columns:repeat(3,minmax(0,1fr))}}
