:root {
  color-scheme: light;
  --page: #f7f7f6;
  --surface: #fff;
  --surface-soft: #f5f5f6;
  --border: #e6e6e9;
  --border-strong: #d5d5db;
  --text: #232329;
  --secondary: #5f606b;
  --muted: #70717b;
  --accent: #72548e;
  --accent-soft: #f0ebf5;
  --success: #29765c;
  --warning: #876327;
  --danger: #b34350;
  --radius: 6px;
  --sidebar: 216px;
  --page-pad: 40px;
  --section-gap: 28px;
}
* { box-sizing: border-box; }
html { scroll-padding-block: 24px 100px; }
body { margin: 0; background: var(--surface); color: var(--text); font: 14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; letter-spacing: 0; }
button,input,select,textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button,.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 15px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 13px; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s,border-color .12s; }
button:hover,.button:hover { background: #62457d; text-decoration: none; }
.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--secondary); }
.secondary:hover { background: var(--surface-soft); border-color: #bdbdc7; }
.text-button,.button.text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 5px 8px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--accent); font-weight: 500; }
.text-button:hover { background: var(--accent-soft); text-decoration: none; }
.danger { background: transparent; color: var(--danger); border-color: #e7cdd2; }
.danger:hover { background: #fbf0f2; border-color: #d8a9b1; }
.mini { min-height: 32px; padding: 5px 9px; font-size: 12px; }
button:disabled,input:disabled,select:disabled { background: #f1f1f3; border-color: var(--border); color: #8a8a94; cursor: not-allowed; }
button:focus-visible,a:focus-visible,summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 12px; background: var(--surface); padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius); }
.skip-link:not(:focus) { width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30; background: var(--page); border-right: 1px solid var(--border); padding: 27px 16px 20px; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 16px; font-weight: 650; line-height: 1.35; padding: 0 7px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 30px; width: 30px; height: 32px; border-radius: 7px; background: #eae3f1; color: #6c4b87; font-family: Georgia,serif; font-size: 22px; font-style: italic; font-weight: 500; }
.brand small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.workspace-sidebar nav { flex: 1; }
.nav-group { margin-top: 25px; }
.nav-group > span { display: block; margin: 0 10px 6px; font-size: 10px; color: var(--muted); }
.nav-group a { display: flex; align-items: center; min-height: 36px; padding: 7px 11px; margin: 2px 0; border-radius: 5px; border-left: 2px solid transparent; color: var(--secondary); font-size: 13px; }
.nav-group a:hover { background: #eeedf0; text-decoration: none; }
.nav-group a[aria-current=page] { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.logout-form { padding-top: 24px; margin: 0; }
.logout-form button { color: var(--muted); font-size: 12px; }
.mobile-header,.mobile-close,.nav-backdrop { display: none; }
main { margin-left: var(--sidebar); padding: 34px var(--page-pad) 60px; min-width: 0; max-width: 1740px; }
main:focus { outline: none; }
h1 { margin: 0; font-size: 25px; line-height: 1.35; font-weight: 650; overflow-wrap: anywhere; }
h2 { margin: 28px 0 16px; font-size: 16px; line-height: 1.45; font-weight: 600; }
h3 { margin: 18px 0 12px; font-size: 14px; font-weight: 600; }
p { margin: 9px 0; overflow-wrap: anywhere; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-width: 0; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.page-header > div:first-child { min-width: 0; }
.page-subtitle { color: var(--muted); margin: 7px 0 0; font-size: 12px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel { background: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 24px; box-shadow: none; }
.info-panel { color: var(--secondary); font-size: 12px; max-width: 920px; }
.narrow-form { max-width: 760px; }
.section-block { margin-top: 32px; scroll-margin-top: 24px; }
.section-heading,.split-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 26px 0 14px; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: 4px 0 0; }
.muted,.field-help,.section-help,.export-help { font-size: 12px; line-height: 1.6; color: var(--muted); }
.field-help { margin: 7px 0; }
.money,.numeric-cell,.amount-column,output,.stat strong,dd { font-variant-numeric: tabular-nums lining-nums; }
.money { white-space: nowrap; }
.numeric-cell,.amount-column { text-align: right; }
.money-income,.stat-income strong { color: var(--success); }
.money-expense,.stat-expense strong { color: var(--danger); }
.grid,.metric-strip { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 0; padding: 22px 0; margin: 20px 0 28px; border-block: 1px solid var(--border); }
.stat { min-width: 0; padding: 0 22px; border-right: 1px solid var(--border); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat > span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { display: block; margin-top: 6px; font-size: 23px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.stat-primary strong { font-size: 28px; }
.compact-info .stat strong { font-size: 15px; }
.dashboard-periods { margin: 0 0 36px; }
.metrics-band { display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 24px; padding: 25px 0; border-bottom: 1px solid var(--border); }
.period-label { display: flex; flex-direction: column; justify-content: center; }
.period-label h2 { margin: 0 0 5px; font-size: 14px; }
.period-label > span { color: var(--muted); font-size: 11px; }
.metrics-band .grid { grid-template-columns: repeat(3,minmax(0,1fr)); padding: 0; margin: 0; border: 0; }
.metrics-band .stat strong { font-size: 29px; font-weight: 600; }
.metrics-band.monthly .stat strong { font-size: 23px; }
.metrics-band.monthly { padding-bottom: 28px; }
.account-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 28px 38px; margin: 22px 0 30px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.account-primary { min-width: 200px; }
.account-primary > span,.account-meta dt { display: block; color: var(--muted); font-size: 12px; }
.account-primary strong { display: block; font-size: 30px; line-height: 1.4; font-variant-numeric: tabular-nums; font-weight: 600; margin-top: 6px; }
.account-meta { display: flex; flex: 1; flex-wrap: wrap; gap: 20px 32px; margin: 0; }
.account-meta dd { margin-top: 5px; font-weight: 550; }
.section-tabs { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin: 20px 0; }
.section-tabs a { color: var(--secondary); font-size: 13px; padding: 7px 0; }
.section-tabs a:hover,.section-tabs a[aria-current] { color: var(--accent); text-decoration: none; box-shadow: 0 2px var(--accent); }
.table-wrap { max-width: 100%; overflow-x: auto; margin: 14px 0 28px; border-top: 1px solid var(--border); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { padding: 11px 14px; text-align: left; background: var(--page); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 15px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; max-width: 300px; }
th:first-child,td:first-child { padding-left: 12px; }
tbody tr:hover { background: #faf9fc; }
td strong { font-weight: 550; }
.cell-value { min-width: 0; }
td small,.cell-secondary { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.row-actions { white-space: nowrap; }
.row-actions .button,.row-actions button { margin: 0 4px 0 0; }
.row-actions details { white-space: normal; }
table details > summary { padding: 7px 0; }
.badge,.vip-badge { display: inline-block; font-size: 11px; font-weight: 500; line-height: 1.5; padding: 2px 6px; border-radius: 4px; background: #f0f0f2; color: var(--secondary); white-space: normal; }
.badge-income,.badge-yes,.status-active,.status-unused { background: #edf5f0; color: var(--success); }
.badge-expense,.status-void { background: #faf0f1; color: var(--danger); }
.status-expired { color: var(--warning); background: #f8f4ed; }
.status-used,.badge-no { color: var(--muted); background: #f0f0f2; }
.vip-badge { color: var(--accent); background: var(--accent-soft); }
.void-row { color: var(--muted); background: #f8f8f8; }
.void-row .money { color: var(--muted); }
.void-row > td:first-child { border-left: 2px solid #b7b7c0; }
.progress { height: 4px; min-width: 80px; max-width: 420px; background: #eeedf1; border-radius: 2px; overflow: hidden; margin: 10px 0; }
.progress > span { display: block; height: 100%; background: #9e87b3; }
.progress-cell { min-width: 95px; }
.actions,.filter-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.filter-bar { padding-bottom: 18px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.filter-bar > div { min-width: 120px; }
.filter-bar > div:has([name=q]) { flex: 1; order: -1; }
.filter-bar input[name=q] { min-width: 220px; }
.filter-bar button[type=submit] { background: var(--surface); color: var(--secondary); border-color: var(--border-strong); }
.local-search { display: flex; gap: 8px; max-width: 440px; margin: 18px 0; }
.local-search input { flex: 1; }
label { display: block; color: var(--secondary); font-size: 12px; font-weight: 500; margin-bottom: 7px; }
input,select,textarea { width: 100%; min-width: 0; min-height: 40px; display: block; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 9px 11px; line-height: 1.4; }
input:hover,select:hover,textarea:hover { border-color: #bdbbc6; }
input:focus,select:focus,textarea:focus { outline: 2px solid #72548e25; outline-offset: 1px; border-color: var(--accent); }
input::placeholder,textarea::placeholder { color: #9a9aa4; }
input[inputmode=decimal] { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { display: inline-block; width: 16px; min-height: 16px; accent-color: var(--accent); margin: 0 7px 0 0; flex: 0 0 16px; }
textarea { min-height: 94px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 18px; }
.form-grid > div { min-width: 0; }
.form-section { padding: 26px 0; border-top: 1px solid var(--border); margin: 0; }
.form-section:first-child { padding-top: 0; border-top: 0; }
.form-section h2 { margin: 0 0 19px; font-size: 15px; }
.section-number { color: #aaa2b3; font-size: 11px; margin-right: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.form-section .form-section { margin-top: 14px; }
.check-line { display: flex; align-items: flex-start; gap: 5px; margin: 15px 0; }
.check-line input { margin-top: 2px; }
.hint,.preview-box { font-size: 12px; color: var(--secondary); padding: 8px 0; margin: 6px 0; background: none; border: 0; }
.hint p { margin: 0; }
.preview-box { font-variant-numeric: tabular-nums; }
.error { color: var(--danger); background: #fcf4f5; border-left: 2px solid var(--danger); padding: 10px 12px; margin: 12px 0; font-size: 12px; }
.error:empty { display: none; }
.success { padding: 10px 12px; color: var(--success); background: #f0f6f2; border-left: 2px solid var(--success); font-size: 13px; }
.empty-state,.empty-cell { padding: 36px 18px; text-align: center; color: var(--muted); font-size: 13px; }
input[aria-invalid=true],select[aria-invalid=true],textarea[aria-invalid=true] { border-color: var(--danger); }
details { min-width: 0; }
details > summary { padding: 12px 0; list-style-position: inside; cursor: pointer; color: var(--secondary); font-size: 12px; }
details[open] > summary,details > summary:hover { color: var(--accent); }
.disclosure { border-top: 1px solid var(--border); margin: 14px 0; }
.disclosure .form-grid { margin: 10px 0 16px; }
.disclosure > textarea { margin-bottom: 18px; }
.detail-list { display: grid; grid-template-columns: minmax(80px,1fr) minmax(0,2fr); gap: 10px 20px; margin: 14px 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; overflow-wrap: anywhere; }
.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 32px; padding: 22px 0; margin: 0; }
.info-grid dd { margin-top: 6px; font-size: 14px; }
.info-grid > dl { margin: 0; }
.inline { display: inline-block; margin: 0; }
.income-workflow { max-width: none; }
.income-columns { display: grid; grid-template-columns: minmax(0,1fr) 278px; gap: 38px; align-items: start; }
.income-main { min-width: 0; }
.save-summary { position: sticky; top: 24px; min-width: 0; padding: 20px; background: var(--page); border-top: 2px solid #c5b6d2; }
.save-summary h2 { margin: 0 0 18px; font-size: 14px; }
.save-summary dl { margin: 0; }
.save-summary dl > div { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 9px 0; }
.save-summary dt { font-size: 12px; }
.save-summary dd { font-size: 14px; text-align: right; }
.save-summary [data-key="最终消费 USD"] { padding: 6px 0 15px; margin-bottom: 7px; border-bottom: 1px solid var(--border); }
.save-summary [data-key="最终消费 USD"] dd { font-size: 25px; font-weight: 600; color: var(--text); }
.save-summary [data-key="最终消费 USD"] dt { max-width: 90px; }
.summary-footnote { font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 15px; padding-top: 12px; }
.service-row { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) minmax(65px,.6fr) 32px; gap: 12px; align-items: end; padding: 12px 0 15px; border-bottom: 1px solid var(--border); }
.service-row label { margin: 0; }
.service-row input,.service-row select { margin-top: 7px; }
.service-row [data-unit-price] { grid-column: 1/4; grid-row: 2; color: var(--muted); font-size: 12px; }
.service-row [data-remove] { grid-column: 4; grid-row: 1; min-width: 32px; min-height: 40px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 21px; }
.service-row [data-remove]:hover { background: #f7edef; color: var(--danger); }
#add-service,#add-player { margin-top: 10px; }
.quote-equation { color: var(--secondary); font-size: 12px; line-height: 1.7; margin: 14px 0 4px; }
.quote-equation p { margin: 4px 0; }
.result-value { display: block; min-height: 36px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; font-weight: 600; text-align: right; font-size: 17px; line-height: 1.5; }
.result-hidden { display: none!important; }
[data-field]:has(> .result-value:not([hidden])) { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--border); }
[data-field]:has(> .result-value:not([hidden])) > label { color: var(--secondary); margin: 0; }
[data-field="original_amount_usd"] { margin-top: 14px; }
[data-field="final_amount_usd"]:has(> .result-value:not([hidden])) { background: #f5f3f7; padding: 14px 16px; margin: 8px 0 0; border: 0; }
[data-field="final_amount_usd"] .result-value { font-size: 24px; color: var(--accent); }
.customer-context { color: var(--secondary); font-size: 12px; min-height: 23px; line-height: 1.8; }
.customer-context a { white-space: nowrap; }
.customer-association { grid-column: 1/-1; }
.customer-association .customer-context { margin-top: 9px; }
[data-balance-preview] { min-height: 0; margin: 7px 0 0; }
[data-balance-preview]:empty { display: none; }
.full-width { grid-column: 1/-1; }
.player-roster { margin-top: 22px; }
.roster-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.roster-heading label { margin: 0; }
.player-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; min-width: 0; }
.player-row select { flex: 1; min-width: 0; }
.player-row button { flex: 0 0 32px; padding: 0; min-height: 40px; font-size: 21px; color: var(--muted); }
.player-row button:hover { background: #f7edef; color: var(--danger); }
.allocation-preview { display: flex; flex-wrap: wrap; gap: 3px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; margin: 0; }
.allocation-preview strong { font-weight: 550; margin-right: auto; }
.allocation-preview span { font-variant-numeric: tabular-nums; color: var(--secondary); }
.save-summary .allocation-preview { display: block; }
.save-summary .allocation-preview strong { display: block; margin-bottom: 4px; }
.save-summary .allocation-preview span { font-size: 11px; margin-right: 8px; }
.discount-heading { margin-top: 25px!important; }
.discount-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.discount-choices button { min-height: 36px; background: transparent; color: var(--secondary); border-color: var(--border); font-size: 12px; padding: 7px 12px; }
.discount-choices button[aria-pressed=true] { color: var(--accent); border-color: #c5b5d7; background: var(--accent-soft); }
.discount-region { min-height: 88px; }
.discount-region:has([data-compensation][hidden]):has([data-existing-coupon][hidden]) { min-height: 0; }
.discount-region [data-compensation-help] { font-size: 12px; color: var(--secondary); }
.rmb-results { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 14px 0 20px; padding: 14px 0; border-block: 1px solid var(--border); }
.rmb-results dt { font-size: 11px; }
.rmb-results dd { margin-top: 5px; font-size: 14px; font-weight: 550; }
.rmb-results + .field-help { margin-top: -8px; }
.balance-deduction-summary { margin: 0; }
.balance-deduction-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.balance-deduction-summary dd { margin: 0; font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; }
.balance-deduction-summary > div:nth-child(3) dd { color: var(--text); font-weight: 650; }
.action-bar { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: flex-end; gap: 10px; background: var(--surface); border-top: 1px solid var(--border); padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); margin-top: 28px; }
.action-total { margin-right: auto; color: var(--muted); font-size: 12px; }
.action-total strong { color: var(--text); font-size: 20px; margin-left: 7px; font-weight: 600; font-variant-numeric: tabular-nums; }
.entry-detail-row > td { padding: 0; }
.entry-detail-panel { background: var(--page); padding: 18px 22px 22px; }
.entry-detail-panel dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px 24px; margin: 0; }
.entry-detail-panel dl > div { min-width: 0; }
.entry-detail-panel dd { margin-top: 5px; }
.entry-detail-panel .actions { justify-content: flex-end; border-top: 1px solid var(--border); margin-top: 18px; padding-top: 15px; }
.ledger-table { table-layout: fixed; }
.ledger-table th:first-child { width: 102px; }
.ledger-table th:nth-child(2) { width: 29%; }
.ledger-table th:last-child { width: 68px; }
.ledger-table th:nth-child(4),.ledger-table th:nth-child(5) { width: 16%; }
.entry-date { color: var(--secondary); font-size: 12px; white-space: nowrap; }
.entry-type { font-size: 12px; }
.entry-person strong { display: block; overflow-wrap: anywhere; }
.entry-cash small { font-size: 10px; }
.entry-person .cell-secondary { line-height: 1.65; }
.entry-operation .text-button { color: var(--secondary); padding-inline: 5px; }
.entry-operation [aria-expanded=true] { color: var(--accent); }
.audit-details { font-size: 11px; }
.audit-details pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; padding: 12px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 4px; font-size: 11px; }
.minor-stat { font-size: 11px; color: var(--muted); }
.login-page { background: var(--page); }
.login-page main { margin: 11vh auto; max-width: 430px; padding: 30px; }
.login-page form { display: grid; gap: 16px; }
.login-page h1 { margin: 24px 0 8px; }
.login-page .panel { padding: 0; }
[hidden] { display: none!important; }
@media (min-width: 901px) {
  main > form:not(.income-workflow):not([method=get]),main > .panel > form:not([method=get]) { max-width: 780px; }
}
@media (max-width: 1320px) and (min-width: 901px) {
  :root { --sidebar: 192px; --page-pad: 28px; }
  .income-columns { grid-template-columns: minmax(0,1fr) 250px; gap: 28px; }
  .save-summary { padding: 17px; }
  td,th { padding-inline: 11px; }
}
@media (max-width: 900px) {
  :root { --page-pad: 28px; }
  main { margin: 0; padding: 28px var(--page-pad) 54px; }
  .mobile-header { display: flex; height: 58px; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--page); }
  .mobile-header .brand { padding: 0; font-size: 15px; }
  .mobile-header .brand-mark { height: 27px; width: 27px; flex-basis: 27px; font-size: 20px; }
  .mobile-header button { min-height: 32px; padding: 5px 11px; font-size: 12px; background: transparent; }
  .workspace-sidebar { transform: translateX(-100%); width: 264px; }
  .mobile-close { display: block; margin: 16px 0 0; }
  .nav-open .workspace-sidebar { transform: none; }
  .nav-open { overflow: hidden; }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 29; background: #25232d55; }
  .income-columns { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .save-summary { position: static; margin-top: 4px; padding: 20px; }
  .save-summary [data-key="最终消费 USD"] dt { max-width: none; }
  .save-summary .allocation-preview { display: flex; }
  .save-summary .allocation-preview strong { margin-bottom: 0; }
  .metrics-band { grid-template-columns: 100px minmax(0,1fr); gap: 15px; }
  .metrics-band .stat { padding-inline: 16px; }
  .metrics-band .stat strong { font-size: 25px; }
}
@media (max-width: 700px) {
  :root { --page-pad: 18px; }
  main { padding: 24px var(--page-pad) 40px; }
  .mobile-header { padding-inline: 18px; }
  h1 { font-size: 22px; }
  h2 { font-size: 15px; }
  .page-header { flex-wrap: wrap; gap: 18px; margin-bottom: 24px; padding-bottom: 20px; }
  .page-actions { width: 100%; }
  .page-actions .button { min-height: 40px; }
  a.text-button { min-height: 40px; }
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .form-section { padding: 24px 0; }
  .form-section h2 { margin-bottom: 18px; }
  input,select,textarea { min-height: 44px; font-size: 16px; }
  label { font-size: 12px; }
  .service-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 30px; gap: 12px; }
  .service-row label:first-child { grid-column: 1; }
  .service-row label:nth-child(2) { grid-column: 2; }
  .service-row label:nth-child(3) { grid-column: 1; grid-row: 2; }
  .service-row [data-remove] { grid-column: 3; }
  .service-row [data-unit-price] { grid-column: 2/4; grid-row: 2; padding-bottom: 12px; font-size: 11px; }
  .player-roster { margin-top: 20px; }
  .player-row button { flex-basis: 32px; }
  .discount-choices { gap: 5px; }
  .discount-choices button { min-height: 40px; padding-inline: 10px; }
  .customer-context { font-size: 11px; min-height: 40px; }
  .discount-region { min-height: 86px; }
  .save-summary { padding: 18px 16px; }
  .save-summary [data-key="最终消费 USD"] dd { font-size: 23px; }
  .save-summary .allocation-preview { display: block; }
  .rmb-results { gap: 10px; }
  .rmb-results dd { font-size: 13px; }
  .action-bar { min-height: 72px; gap: 8px; padding-block: 12px calc(12px + env(safe-area-inset-bottom)); }
  .action-bar button,.action-bar .button { min-height: 44px; }
  .income-workflow .action-bar .secondary { display: none; }
  .income-workflow { padding-bottom: 12px; }
  .action-total strong { font-size: 20px; }
  .metrics-band { grid-template-columns: minmax(0,1fr); gap: 18px; padding: 21px 0; }
  .period-label { flex-direction: row; align-items: center; justify-content: space-between; }
  .period-label h2 { margin: 0; font-size: 13px; }
  .metrics-band .stat { padding: 0 10px; }
  .metrics-band .stat:first-child { padding-left: 0; }
  .metrics-band .stat strong { font-size: 24px; }
  .metrics-band.monthly .stat strong { font-size: 20px; }
  .metrics-band .stat > span { font-size: 10px; }
  .dashboard-periods { margin-bottom: 28px; }
  .grid,.metric-strip { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 0; }
  .grid .stat,.metric-strip .stat { padding: 0 14px; }
  .grid .stat:nth-child(odd),.metric-strip .stat:nth-child(odd) { padding-left: 0; }
  .stat strong { font-size: 21px; }
  .stat-primary strong { font-size: 26px; }
  .account-strip { gap: 22px; padding-top: 12px; }
  .account-primary { width: 100%; }
  .account-primary strong { font-size: 30px; }
  .account-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
  .section-tabs { gap: 8px 22px; }
  .section-heading { flex-wrap: wrap; }
  .section-heading > form,.section-heading > .local-search { width: 100%; }
  .section-heading > .local-search { margin-block: 0; }
  .info-grid { grid-template-columns: 1fr; gap: 20px; }
  .filter-bar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 10px; }
  .filter-bar > div { min-width: 0; }
  .filter-bar > div:has([name=q]) { grid-column: 1/-1; grid-row: 1; }
  .filter-bar input[name=q] { min-width: 0; }
  .filter-bar a,.filter-bar button { white-space: normal; }
  .local-search { max-width: none; }
  .table-wrap { overflow: visible; background: transparent; border: 0; margin-top: 8px; }
  .responsive-table,.responsive-table tbody,.responsive-table tr,.responsive-table td,.ledger-table,.ledger-table tbody { display: block; width: 100%; max-width: none; }
  .responsive-table thead,.ledger-table thead { display: none; }
  .responsive-table tbody tr { padding: 18px 0; border-bottom: 1px solid var(--border); }
  .responsive-table td { display: grid; grid-template-columns: minmax(84px,33%) minmax(0,1fr); gap: 8px 15px; border: 0; padding: 6px 0; text-align: left; }
  .responsive-table td:before { content: attr(data-label); color: var(--muted); font-size: 11px; text-align: left; }
  .responsive-table td:first-child { font-size: 14px; font-weight: 600; padding-bottom: 10px; }
  .responsive-table td > .badge,.responsive-table td > .vip-badge { justify-self: start; }
  .responsive-table .numeric-cell { text-align: right; }
  .responsive-table details { grid-column: 2; }
  .responsive-table td.empty-cell { display: block; font-weight: 400; text-align: center; padding: 24px 0; }
  .responsive-table td.empty-cell:before { display: none; }
  .row-actions { white-space: normal; }
  .ledger-table .entry-main-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 14px; padding: 20px 0; border-bottom: 1px solid var(--border); }
  .ledger-table .entry-main-row > td { display: block; padding: 0; border: 0; max-width: none; }
  .ledger-table .entry-date { grid-column: 1; grid-row: 4; font-size: 11px; color: var(--muted); }
  .ledger-table .entry-person { grid-column: 1/-1; grid-row: 2; }
  .ledger-table .entry-person strong { font-size: 13px; }
  .ledger-table .entry-type { grid-column: 1; grid-row: 1; font-size: 12px; }
  .ledger-table .entry-consumption { grid-column: 2; grid-row: 1; font-size: 18px; font-weight: 600; }
  .ledger-table .entry-cash { grid-column: 1/-1; grid-row: 3; text-align: left; color: var(--muted); font-size: 12px; }
  .ledger-table .entry-cash:before { content: '实际收支 USD '; font-size: 11px; }
  .ledger-table .entry-cash small { display: inline; margin-left: 8px; }
  .ledger-table .entry-operation { grid-column: 2; grid-row: 4; }
  .ledger-table .entry-detail-row,.ledger-table .entry-detail-row > td { display: block; width: 100%; max-width: none; }
  .entry-detail-panel { padding: 18px 14px; }
  .entry-detail-panel dl { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  .entry-detail-panel .actions { justify-content: flex-start; }
  .entry-detail-panel .button { min-height: 40px; }
  .detail-list { grid-template-columns: 90px minmax(0,1fr); }
  .login-page main { margin-top: 5vh; padding: 28px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto!important; transition: none!important; }
}

.identity-footer { display: grid; gap: 4px; padding: 16px 12px 8px; border-top: 1px solid var(--border); }
.identity-footer strong { font-size: 13px; overflow-wrap: anywhere; }
.identity-footer span { color: var(--muted); font-size: 11px; }
.identity-footer .text-button { justify-self: start; padding-left: 0; font-size: 12px; }
.auth-user-table td small { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.auth-user-table td { overflow-wrap: anywhere; }
.login-page .form-section label:not(:first-child) { margin-top: 20px; }
@media (max-width: 600px) {
  .auth-user-table, .auth-user-table tbody, .auth-user-table tr, .auth-user-table td { display: block; width: 100%; min-width: 0; }
  .auth-user-table thead { display: none; }
  .auth-user-table tr { padding: 16px 0; border-bottom: 1px solid var(--border); }
  .auth-user-table td { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 12px; border: 0; padding: 6px 0; }
  .auth-user-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .auth-user-table td small { grid-column: 2; }
}
