:root {
  --ink: #17231f;
  --muted: #718078;
  --line: #e1e8e3;
  --surface: #ffffff;
  --canvas: #f2f6f3;
  --brand: #16755d;
  --brand-dark: #105a48;
  --income: #16825d;
  --expense: #d5523f;
  --gold: #b57a21;
  --shadow: 0 12px 35px rgba(22, 55, 43, .08);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 18% 12%, #d9eee6, transparent 35%), linear-gradient(135deg, #edf5f1, #dbe9e3); }
.login-card { width: 430px; max-width: 100%; padding: 42px; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 16px; color: white; background: var(--brand); font-size: 26px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 30px; }
h2 { margin-bottom: 0; font-size: 24px; }
h3 { margin-bottom: 4px; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #48584f; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfdfc; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,117,93,.1); }
.primary, .secondary { border: 0; border-radius: 10px; padding: 11px 17px; font-weight: 800; }
.primary { color: white; background: var(--brand); }
.primary:hover { background: var(--brand-dark); }
.secondary { color: var(--brand); border: 1px solid #b8d6cc; background: #eff8f4; }
.form-error { min-height: 18px; margin: 12px 0 0; color: var(--expense); font-size: 13px; }
.login-note { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.clinic-select-card { width: 620px; max-width: 100%; position: relative; z-index: 2; max-height: calc(100vh - 48px); overflow: auto; }
.clinic-options { display: grid; gap: 14px; margin-top: 24px; }
.book-options { margin-top: 0; }
.clinic-option { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 20px; border: 1px solid #cfe0d9; border-radius: 16px; color: var(--ink); background: #fbfdfc; text-align: left; transition: border-color .16s, transform .16s, box-shadow .16s; }
.clinic-option:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(22,117,93,.1); }
.clinic-option strong, .clinic-option small { display: block; }
.clinic-option strong { color: var(--brand-dark); font-size: 18px; }
.clinic-option small { margin-top: 6px; color: var(--muted); font-size: 12px; }
.clinic-option .clinic-arrow { color: var(--brand); font-size: 22px; }
.clinic-back { margin-top: 22px; color: var(--brand); }
body.manual-clinic #view-dashboard .stat-card.income span { color: var(--income); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; color: #dcebe5; background: #143a30; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.sidebar-brand > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: white; background: #259274; font-size: 20px; font-weight: 800; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { margin-top: 3px; color: #8eafa3; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border: 0; border-radius: 10px; color: #b9d0c7; background: transparent; text-align: left; }
.nav-item span { width: 20px; text-align: center; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.11); }
.nav-download { margin-top: 6px; color: #d9f5eb; background: rgba(37,146,116,.2); }
.nav-download span { color: #65d6b1; }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding: 18px 8px 0; color: #8eafa3; font-size: 12px; }
.link-button { padding: 0; border: 0; color: #d8e9e2; background: transparent; text-align: left; }
.main { min-width: 0; padding: 28px 32px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.quick-book-switch { padding: 10px 14px; border: 1px solid #b8d6cc; border-radius: 10px; color: var(--brand); background: #eff8f4; font-weight: 800; white-space: nowrap; }
.quick-book-switch:hover { border-color: var(--brand); background: #e4f5ee; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--brand); font-weight: 800; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { margin-top: 3px; color: var(--muted); }
.view { display: none; }
.view.active { display: block; animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
.card { margin-bottom: 18px; padding: 22px; border: 1px solid rgba(220,229,224,.9); border-radius: 16px; background: var(--surface); box-shadow: 0 7px 24px rgba(34,68,55,.04); }
.compact { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.compact label { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; padding: 22px; border-radius: 16px; background: white; box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; right: -20px; top: -28px; width: 100px; height: 100px; border-radius: 50%; background: currentColor; opacity: .08; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 9px 0 5px; font-size: 27px; }
.stat-card.income { color: var(--income); }
.stat-card.expense { color: var(--expense); }
.stat-card.balance { color: var(--gold); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: left; }
td { padding: 13px 12px; border-bottom: 1px solid #edf1ee; font-size: 13px; }
tbody tr:hover { background: #f8fbf9; }
.income-text { color: var(--income); font-weight: 800; }
.expense-text { color: var(--expense); font-weight: 800; }
.empty-row { padding: 36px; color: var(--muted); text-align: center; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.user-grid { grid-template-columns: 1fr 1fr; }
.inline-fields { display: flex; gap: 14px; align-items: end; }
.inline-fields > label { flex: 1; min-width: 0; }
.tips-card { color: #3f5249; background: linear-gradient(145deg, #fff, #f4faf7); }
.tips-card ol { margin: 0; padding-left: 20px; line-height: 2; }
.tips-card code { padding: 2px 5px; border-radius: 5px; color: #265c4b; background: #e5f2ed; }
.result-box { margin-top: 20px; padding: 14px; border: 1px dashed #b9d2c8; border-radius: 10px; line-height: 1.7; }
.user-list { display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfc; }
.user-row strong, .user-row small { display: block; }
.user-row small { margin-top: 4px; color: var(--muted); }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 800; }
.badge.active { color: #116148; background: #dff4eb; }
.badge.inactive { color: #8d4d44; background: #f8e6e2; }
.row-actions { display: flex; gap: 7px; }
.small-button { padding: 7px 10px; border: 1px solid #cbdcd5; border-radius: 8px; color: var(--brand); background: white; font-size: 12px; }
.danger-button { color: var(--expense); border-color: #efc9c2; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.status-item { padding: 14px; border-radius: 12px; background: #f4f8f6; }
.status-item span, .status-item strong { display: block; }
.status-item span { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.status-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f4f2; font-size: 22px; line-height: 1; }
dialog { width: 520px; max-width: calc(100vw - 30px); padding: 24px; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(10,45,34,.25); }
dialog::backdrop { background: rgba(13, 35, 28, .5); backdrop-filter: blur(2px); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: calc(100vw - 48px); padding: 14px 18px; border-radius: 11px; color: white; background: #173a30; box-shadow: 0 12px 35px rgba(8,35,26,.25); }
.toast.error { background: #a84031; }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 74px 1fr; }
  .sidebar { padding-inline: 10px; }
  .sidebar-brand div, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding-inline: 0; }
  .nav-item span { font-size: 20px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-footer { font-size: 0; text-align: center; }
  .link-button { font-size: 12px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 10; height: 66px; display: block; padding: 7px 8px; }
  .sidebar-brand, .sidebar-footer { display: none; }
  .nav-download { display: none; }
  #main-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .nav-item { min-width: 0; height: 52px; display: grid; place-items: center; }
  .nav-item span { font-size: 19px; }
  .main { padding: 20px 15px 90px; }
  .topbar { align-items: start; }
  .user-chip div { display: none; }
  .stat-grid, .grid-two, .user-grid { grid-template-columns: 1fr; }
  .compact { align-items: stretch; }
  .compact label, .toolbar .grow { min-width: 100%; }
  .inline-fields { display: grid; grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 30px 22px; }
}
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-grid.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1400px) { .stat-grid.five { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .stat-grid.five { grid-template-columns: repeat(2, 1fr); } }
.formula-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(135deg, #fff, #eef8f4); }
.formula-card h3 { margin-bottom: 7px; }
.formula-card > strong { color: var(--brand); font-size: 27px; white-space: nowrap; }
.keyword-field { margin: 18px 0; }
.rule-input { min-width: 100px; padding: 8px 10px; }
.rule-type { min-width: 130px; }
@media (max-width: 1200px) { .stat-grid.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .stat-grid.four { grid-template-columns: 1fr; }
  .formula-card { align-items: flex-start; flex-direction: column; }
}
.sub-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.sub-tabs button { padding: 10px 20px; border: 1px solid #d6e1dc; border-radius: 10px; color: #567066; background: #fff; font-weight: 700; }
.sub-tabs button.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.wide-table { min-width: 2450px; }
.wide-table th, .wide-table td { padding: 9px 10px; font-size: 12px; }
#daily-settlement-grid { min-width: 1380px; }
#monthly-income-grid { min-width: 900px; }
#monthly-expense-grid { min-width: 980px; }
#monthly-income-grid td:nth-child(n+3), #monthly-expense-grid td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
#monthly-income-grid .payment-badge { min-width: 44px; justify-content: center; }
#daily-settlement-grid th, #daily-settlement-grid td { white-space: nowrap; }
#daily-settlement-grid td:nth-child(n+7) { text-align: right; font-variant-numeric: tabular-nums; }
#daily-settlement-grid .settlement-payment-continuation { background: #fbfdfc; }
#daily-settlement-grid .settlement-payment-spacer { border-top: 0; border-bottom: 0; }
.detail-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.detail-summary > div { padding: 12px; border-radius: 10px; background: #f3f8f5; }
.detail-summary span, .detail-summary strong { display: block; }
.detail-summary span { color: var(--muted); font-size: 12px; }
.detail-summary strong { margin-top: 5px; font-size: 17px; }
.payment-detail-list { max-height: 320px; overflow: auto; }
.payment-detail-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid #edf1ee; }
.payment-detail-row:last-child { border-bottom: 0; }
.payment-detail-row strong { color: var(--income); }
.payment-badge { display: inline-flex; margin: 2px 4px 2px 0; padding: 3px 7px; border-radius: 12px; color: #176f59; background: #e6f5ef; font-size: 11px; font-weight: 700; }
.detail-link { padding: 0; color: var(--brand); font-weight: 700; text-align: left; }
.detail-link:hover { text-decoration: underline; }
.detail-panels article { min-width: 0; }
.detail-panels h4 { margin: 0 0 12px; }
.ledger-plus { margin-left: 8px; padding: 3px 8px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 800; }
.expense-detail-list { max-height: 560px; overflow: auto; }
.expense-detail-item { margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfc; }
.expense-detail-main { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.expense-detail-main strong, .expense-detail-main small { display: block; }
.expense-detail-main small { margin-top: 5px; color: var(--muted); }
.voucher-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.voucher-item { position: relative; width: 92px; padding: 6px; border-radius: 9px; background: #fff; text-align: center; }
.voucher-item img { width: 78px; height: 58px; border-radius: 6px; object-fit: cover; }
.voucher-item a { display: block; overflow: hidden; color: var(--brand); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.voucher-delete { position: absolute; top: 1px; right: 1px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(172,57,42,.88); line-height: 20px; }
.voucher-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.amount-detail-button { padding: 2px 4px; border: 0; background: transparent; font-weight: 800; text-decoration: underline dotted; cursor: pointer; }
.ledger-draft-footer { margin: 12px 0 18px; } .ledger-draft-footer strong { color: var(--brand); }
.date-ledger-button { display: inline-flex; flex-direction: column; }
.date-ledger-button small { margin-top: 3px; color: #b57a21; font-size: 10px; font-weight: 700; }
.date-ledger-button.has-ledger { padding: 6px 9px; border-radius: 9px; color: #9a651a; background: #fff1d2; }
.permission-groups { display: grid; gap: 16px; max-height: 520px; overflow: auto; }
.permission-group { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.permission-group h4 { margin: 0 0 10px; }
.permission-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.permission-option { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: #f6faf8; font-size: 13px; }
.permission-option input { width: auto; }
#login-brand-logo img, #sidebar-brand-logo img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.branding-preview { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: #f3f8f5; }
.branding-preview img, .branding-preview > span { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; }
.branding-preview > span { display: grid; place-items: center; color: #fff; background: var(--brand); font-size: 24px; font-weight: 800; }
.branding-preview img.hidden + span { display: grid; }
.branding-preview strong, .branding-preview small { display: block; }
.branding-preview small { margin-top: 4px; color: var(--muted); }


/* 打印凭证：勾选清单 */
#voucher-print-dialog { width: 720px; max-width: calc(100vw - 30px); }
.voucher-pick-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.voucher-pick-list { max-height: 46vh; overflow: auto; border: 1px solid #dbe6e1; border-radius: 12px; padding: 6px; background: #fbfdfc; }
.voucher-pick-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.voucher-pick-item:hover { background: #f1f8f4; }
.voucher-pick-item + .voucher-pick-item { border-top: 1px solid #eef4f1; }
.voucher-pick-item input { flex: none; }
.voucher-pick-main { flex: 1; min-width: 0; }
.voucher-pick-main strong { display: block; font-size: 13px; }
.voucher-pick-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.voucher-pick-file { flex: none; max-width: 190px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }


/* 记录列表：日期前面的勾选列 */
#record-table-grid .pick-col { display: none; width: 44px; padding-inline: 8px; text-align: center; }
#record-table-grid.pick-mode .pick-col { display: table-cell; }
#record-table-grid .pick-col input { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }
#record-table-grid .pick-col input:disabled { cursor: not-allowed; opacity: .35; }

@media (max-width: 760px) { .stat-grid.five { grid-template-columns: 1fr; } }

/* 绩效：老板分成规则备注 */
.rule-note { margin: 8px 0 0; max-width: 780px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.formula-card { align-items: flex-start; }

/* 绩效：老板分成两个口径 */
.owner-pay-label { display: inline-block; min-width: 72px; margin-right: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

.payment-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.payment-inputs input { background: #fff; }
.readonly-amount { color: #276b57; background: #eef8f4 !important; font-weight: 800; }
@media (max-width: 720px) { .payment-inputs { grid-template-columns: 1fr; } }
.input-with-action { display: flex; align-items: stretch; gap: 8px; }
.input-with-action input, .input-with-action select { flex: 1; min-width: 0; }
.gear-button { flex: none; width: 42px; height: 42px; padding: 0; color: var(--brand); background: #eff8f4; font-size: 20px; }
.gear-button:hover { color: #fff; background: var(--brand); }
.auto-login-option { display: none; grid-template-columns: auto 1fr; align-items: center; gap: 8px; margin-top: -4px; }
.auto-login-option input { width: auto; }
body.android-app .auto-login-option { display: grid; }
.user-menu-wrap { position: relative; }
.user-chip-button { width: auto; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.user-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 50; min-width: 150px; padding: 7px; border: 1px solid #dbe6e1; border-radius: 12px; background: #fff; box-shadow: 0 14px 35px rgba(22,55,43,.16); }
.user-menu button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; color: #29463b; background: transparent; text-align: left; }
.user-menu button:hover { color: #105a48; background: #eff8f4; }
@media (max-width: 760px) {
  .sidebar {
    bottom: env(safe-area-inset-bottom, 0px);
    height: calc(66px + env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px));
  }
  .main { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}
/* 2026 UI refresh: green-teal medical dashboard style */
:root {
  --ink: #26343b;
  --muted: #8d98a2;
  --line: #e5ecef;
  --surface: #ffffff;
  --canvas: #f3f8f8;
  --brand: #278b84;
  --brand-dark: #1f7375;
  --income: #2b9b72;
  --expense: #d85c5c;
  --gold: #c18a2e;
  --shadow: 0 8px 26px rgba(35, 94, 96, .08);
}
body { color: var(--ink); background: var(--canvas); }
.login-shell {
  position: relative;
  overflow: hidden;
  padding: 42px 24px;
  background: #ffffff;
}
.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-shell::before {
  width: 720px;
  height: 720px;
  left: -330px;
  bottom: -470px;
  background: linear-gradient(135deg, #83df83 0%, #3fa876 55%, #237b7d 100%);
}
.login-shell::after {
  width: 560px;
  height: 560px;
  right: -260px;
  top: -330px;
  background: linear-gradient(135deg, #55c67d 0%, #20757c 100%);
}
.login-card-split {
  position: relative;
  z-index: 2;
  width: 900px; max-width: calc(100vw - 48px);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(25, 83, 79, .18);
}
.login-visual {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 52px 48px;
  color: #fff;
  background: linear-gradient(135deg, #67cf80 0%, #29957b 50%, #1f6e77 100%);
}
.login-visual::before {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  right: -66px;
  bottom: -105px;
  border: 48px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: -90px;
  bottom: -80px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.login-visual-content { position: relative; z-index: 1; width: 100%; }
.login-visual .brand-mark {
  width: 62px;
  height: 62px;
  margin-bottom: 92px;
  border-radius: 16px;
  color: #257c78;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 75, 72, .16);
}
.login-visual .eyebrow { color: rgba(255,255,255,.82); }
.login-visual h1 {
  margin: 8px 0 12px;
  color: #fff;
  font-size: 34px;
  line-height: 1.2;
}
.login-visual-subtitle {
  margin: 0;
  color: rgba(255,255,255,.86);
  font-size: 15px;
  line-height: 1.8;
}
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 58px 52px;
  background: #fff;
}
.login-panel-tab {
  width: max-content;
  margin-bottom: 34px;
  padding: 0 5px 12px;
  border-bottom: 3px solid #378f8c;
  color: #2d8886;
  font-size: 18px;
  font-weight: 800;
}
.login-panel .stack { gap: 18px; }
.login-panel label:not(.auto-login-option) {
  position: relative;
  font-size: 0;
}
.login-panel label:not(.auto-login-option) input { font-size: 14px; }
.login-panel input,
.login-panel select {
  padding: 13px 17px;
  border-color: #dbe7e8;
  border-radius: 999px;
  background: #fff;
}
.login-panel input:focus { border-color: #3a9b97; box-shadow: 0 0 0 3px rgba(58,155,151,.12); }
.login-panel .auto-login-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6e7982;
  font-size: 13px;
  font-weight: 500;
}
.login-panel .auto-login-option input { width: auto; padding: 0; border-radius: 3px; }
.login-submit {
  margin-top: 8px;
  padding: 14px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #49b984 0%, #2b8b89 100%);
  box-shadow: 0 8px 20px rgba(42,139,136,.18);
}
.login-submit:hover { background: linear-gradient(90deg, #3fac78 0%, #237d80 100%); }
.login-panel .form-error { margin-top: 10px; text-align: center; }
.login-panel .login-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid #edf1f2; }

.app-shell { grid-template-columns: 246px 1fr; }
.sidebar {
  padding: 24px 16px;
  color: #fff;
  background: linear-gradient(180deg, #59c67c 0%, #25877d 48%, #1d6976 100%);
}
.sidebar-brand { padding-bottom: 26px; }
.sidebar-brand small { color: rgba(255,255,255,.72); }
.sidebar-brand > span { color: #247c78; background: #fff; box-shadow: 0 7px 18px rgba(16,74,72,.16); }
.nav-item { color: rgba(255,255,255,.88); border-radius: 8px; }
.nav-item span { color: rgba(255,255,255,.94); }
.nav-item:hover,
.nav-item.active {
  color: #1f7475;
  background: #fff;
  box-shadow: 0 7px 18px rgba(20,80,80,.16);
}
.nav-item:hover span,
.nav-item.active span { color: #278b84; }
.nav-download { color: #fff; background: rgba(255,255,255,.16); }
.nav-download span { color: #fff; }
.sidebar-footer { color: rgba(255,255,255,.74); }
.sidebar-footer .link-button { color: rgba(255,255,255,.9); }
.main { background: linear-gradient(180deg, #eef6f6 0%, #f8fbfb 100%); }
.card {
  border-color: #e5ecef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(35, 94, 96, .06);
}
.stat-card {
  border: 1px solid #e7eef0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(35, 94, 96, .07);
}
.stat-card::after { opacity: .06; }
.section-heading h3 { color: #2b3c43; }
input, select, textarea { border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { border-color: #3a9b97; box-shadow: 0 0 0 3px rgba(58,155,151,.1); }
.primary { background: linear-gradient(90deg, #4ab884, #2b8b89); border-radius: 7px; }
.primary:hover { background: linear-gradient(90deg, #3fab78, #237d80); }
.secondary { color: #277d80; border-color: #cfe2e4; background: #f7fbfb; border-radius: 7px; }
th { padding: 12px; border-bottom: 0; color: #7a858e; background: #e6f2f5; }
th:first-child { border-radius: 6px 0 0 6px; }
th:last-child { border-radius: 0 6px 6px 0; }
td { border-bottom-color: #edf1f3; }
tbody tr:hover { background: #f5fafb; }
dialog { border-radius: 12px; }
.user-menu { border-radius: 8px; box-shadow: 0 12px 30px rgba(30,79,83,.16); }
.user-menu button { border-radius: 6px; }

@media (max-width: 900px) {
  .login-card-split { grid-template-columns: 1fr; min-height: 0; }
  .login-visual { min-height: 230px; padding: 36px; }
  .login-visual .brand-mark { margin-bottom: 24px; }
  .login-panel { padding: 38px 32px; }
}
@media (max-width: 760px) {
  .login-shell { padding: 20px 14px; }
  .login-card-split { width: 100%; border-radius: 14px; }
  .login-visual { min-height: 190px; padding: 28px 26px; }
  .login-visual h1 { font-size: 27px; }
  .login-panel { padding: 30px 24px; }
  .login-panel-tab { margin-bottom: 24px; font-size: 16px; }
}

/* Mobile compatibility: keep bottom navigation fixed and decorations behind cards */
.login-shell > .login-card { position: relative; z-index: 2; }
@media (max-width: 760px) {
  #main-nav {
    display: flex;
    height: 52px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  #main-nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 68px; width: 68px; height: 52px; padding: 0; }
  .nav-item span { font-size: 19px; }
  .login-shell::before { width: 300px; height: 300px; left: -160px; bottom: -190px; }
  .login-shell::after { width: 260px; height: 260px; right: -150px; top: -160px; }
  .clinic-select-card { width: 100%; padding: 28px 20px; max-height: calc(100vh - 36px); }
  .clinic-option { padding: 16px; }
  .topbar { position: relative; z-index: 3; }
  .main { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
}

/* Responsive navigation: keep labels visible and scroll when there are many items */
@media (min-width: 761px) and (max-width: 1050px) {
  .app-shell { grid-template-columns: 188px 1fr; }
  .sidebar { padding: 20px 12px; }
  .sidebar-brand { justify-content: flex-start; padding-inline: 6px; }
  .sidebar-brand div,
  .nav-item,
  .sidebar-footer { font-size: 13px; }
  .nav-item { justify-content: flex-start; padding: 11px 10px; }
  .nav-item span { width: 22px; font-size: 18px; }
  .link-button { font-size: 12px; }
}
@media (max-width: 760px) {
  .sidebar {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: 76px;
    padding: 6px 8px;
  }
  #main-nav {
    display: flex;
    height: 62px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  #main-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 76px;
    width: 76px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 0;
    font-size: 11px !important;
    line-height: 1.05;
    white-space: nowrap;
  }
  .nav-item span { width: auto; font-size: 18px; }
  .nav-download { display: flex !important; margin-top: 0; }
  .main { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* Old WebView fallback for flex spacing and mobile record cards */
.sidebar-brand > * + * { margin-left: 12px; }
.user-chip > * + * { margin-left: 10px; }
.section-heading > * + * { margin-left: 16px; }
.inline-fields > * + * { margin-left: 14px; }
.sub-tabs > * + * { margin-left: 8px; }
.row-actions > * + * { margin-left: 7px; }
.compact > * { margin-right: 12px; margin-bottom: 12px; }
.compact > *:last-child { margin-right: 0; }

@media (max-width: 760px) {
  .compact {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .compact > * {
    width: 100%;
    min-width: 0;
    margin: 0 0 12px;
  }
  .compact > *:last-child { margin-bottom: 0; }
  .compact .primary,
  .compact .secondary { width: 100%; }

  .table-wrap { overflow: visible; }
  #record-table-grid {
    min-width: 0;
    white-space: normal;
  }
  #record-table-grid thead { display: none; }
  #record-table-grid tbody { display: block; }
  #record-table-grid tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #e3edee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(35, 94, 96, .06);
  }
  #record-table-grid td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    font-size: 13px;
    white-space: normal;
  }
  #record-table-grid .record-date {
    grid-column: 1;
    color: #267d80;
    font-weight: 700;
  }
  #record-table-grid .record-type {
    grid-column: 2;
    justify-self: end;
  }
  #record-table-grid .record-amount {
    grid-column: 1 / 3;
    display: flex;
    align-items: center;
    padding: 7px 0 8px;
    border-bottom: 1px solid #edf2f3;
    font-size: 21px;
  }
  #record-table-grid .record-amount::before {
    content: attr(data-label);
    margin-right: 10px;
    color: #8d98a2;
    font-size: 12px;
    font-weight: 500;
  }
  #record-table-grid .record-item,
  #record-table-grid .record-category,
  #record-table-grid .record-payment,
  #record-table-grid .record-created {
    grid-column: 1 / 3;
    display: flex;
    align-items: flex-start;
    padding: 2px 0;
    word-break: break-word;
  }
  #record-table-grid .record-item::before,
  #record-table-grid .record-category::before,
  #record-table-grid .record-payment::before,
  #record-table-grid .record-created::before {
    content: attr(data-label);
    flex: 0 0 68px;
    color: #8d98a2;
    font-size: 12px;
    font-weight: 500;
  }
  #record-table-grid .record-payment { flex-wrap: wrap; }
  #record-table-grid .record-actions {
    grid-column: 1 / 3;
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
  }
  #record-table-grid .record-actions:empty { display: none; }
  #record-table-grid .record-pick-cell { display: none; }
  #record-table-grid.pick-mode .record-pick-cell {
    position: absolute;
    top: 12px;
    right: 12px;
    display: block;
  }
  #record-table-grid.pick-mode .record-type { margin-right: 34px; }
  #record-table-grid .record-empty-row {
    grid-column: 1 / 3;
    padding: 28px 10px;
    text-align: center;
  }
  .amount-detail-button { font-size: 19px; }
  .ledger-plus { margin-left: 10px; }
}

/* Mobile cards for dashboard, charge/debt, and performance tables */
@media (max-width: 760px) {
  #daily-table-grid,
  #charge-debt-grid,
  #performance-grid,
  #performance-daily-grid {
    display: block;
    min-width: 0;
    white-space: normal;
  }
  #daily-table-grid thead,
  #charge-debt-grid thead,
  #performance-grid thead,
  #performance-daily-grid thead { display: none; }
  #daily-table-grid tbody,
  #charge-debt-grid tbody,
  #performance-grid tbody,
  #performance-daily-grid tbody { display: block; }
  #daily-table-grid tr,
  #charge-debt-grid tr,
  #performance-grid tr,
  #performance-daily-grid tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #e3edee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(35, 94, 96, .06);
  }
  #daily-table-grid td,
  #charge-debt-grid td,
  #daily-settlement-grid td,
  #performance-grid td,
  #performance-daily-grid td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    font-size: 13px;
    white-space: normal;
  }
  #daily-table-grid .mobile-card-date,
  #daily-settlement-grid .mobile-card-date,
  #performance-daily-grid .mobile-card-date {
    grid-column: 1;
    color: #267d80;
    font-weight: 800;
  }
  #daily-table-grid .mobile-card-actions,
  #performance-daily-grid .mobile-card-actions {
    grid-column: 2;
    justify-self: end;
  }
  #charge-debt-grid .mobile-card-title,
  #daily-settlement-grid .mobile-card-title,
  #performance-grid .mobile-card-title,
  #performance-daily-grid .mobile-card-title {
    grid-column: 1 / 3;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f3;
    color: #267d80;
    font-size: 16px;
  }
  #charge-debt-grid td[data-label],
  #daily-settlement-grid td[data-label],
  #performance-grid td[data-label],
  #performance-daily-grid td[data-label],
  #daily-table-grid td[data-label] {
    grid-column: 1 / 3;
    display: flex;
    align-items: flex-start;
    padding: 2px 0;
    word-break: break-word;
  }
  #charge-debt-grid td[data-label]::before,
  #daily-settlement-grid td[data-label]::before,
  #performance-grid td[data-label]::before,
  #performance-daily-grid td[data-label]::before,
  #daily-table-grid td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 84px;
    color: #8d98a2;
    font-size: 12px;
    font-weight: 500;
  }
  #daily-table-grid td[data-label="系统收入"] { font-size: 18px; font-weight: 800; }
  #charge-debt-grid .mobile-card-amount,
  #daily-settlement-grid .mobile-card-amount,
  #performance-grid .mobile-card-amount,
  #performance-daily-grid .mobile-card-amount {
    margin-top: 4px;
    padding-top: 9px;
    border-top: 1px solid #edf2f3;
    font-size: 18px;
    font-weight: 800;
  }
  #daily-table-grid .mobile-card-empty,
  #charge-debt-grid .mobile-card-empty,
  #daily-settlement-grid .mobile-card-empty,
  #performance-grid .mobile-card-empty,
  #performance-daily-grid .mobile-card-empty {
    grid-column: 1 / 3;
    padding: 28px 10px;
    text-align: center;
  }
}

/* Mobile cards for audit log */
@media (max-width: 760px) {
  #audit-grid { display: block; min-width: 0; white-space: normal; }
  #audit-grid thead { display: none; }
  #audit-grid tbody { display: block; }
  #audit-grid tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #e3edee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(35, 94, 96, .06);
  }
  #audit-grid td {
    display: flex;
    width: auto;
    padding: 2px 0;
    border: 0;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
  }
  #audit-grid td::before {
    content: attr(data-label);
    flex: 0 0 62px;
    color: #8d98a2;
    font-size: 12px;
    font-weight: 500;
  }
  #audit-grid .mobile-card-date {
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f3;
    color: #267d80;
    font-weight: 700;
  }
  #audit-grid .mobile-card-title {
    padding-bottom: 6px;
    color: #267d80;
    font-size: 16px;
    font-weight: 700;
  }
  #audit-grid .mobile-card-empty {
    display: block;
    padding: 28px 10px;
    text-align: center;
  }
  #audit-grid .mobile-card-empty::before { display: none; }
}

/* Mobile cards for bank fee calculation */
@media (max-width: 760px) {
  #fee-calc-grid { display: block; min-width: 0; white-space: normal; }
  #fee-calc-grid thead { display: none; }
  #fee-calc-grid tbody { display: block; }
  #fee-calc-grid tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #e3edee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(35, 94, 96, .06);
  }
  #fee-calc-grid td {
    display: flex;
    width: auto;
    padding: 2px 0;
    border: 0;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
  }
  #fee-calc-grid td::before {
    content: attr(data-label);
    flex: 0 0 62px;
    color: #8d98a2;
    font-size: 12px;
    font-weight: 500;
  }
  #fee-calc-grid .mobile-card-date {
    grid-column: 1;
    color: #267d80;
    font-weight: 800;
  }
  #fee-calc-grid .mobile-card-amount {
    grid-column: 2;
    justify-self: end;
    color: #d85c5c;
    font-size: 17px;
    font-weight: 800;
  }
  #fee-calc-grid .mobile-card-amount::before { display: none; }
  #fee-calc-grid .mobile-card-empty {
    grid-column: 1 / 3;
    display: block;
    padding: 28px 10px;
    text-align: center;
  }
  #fee-calc-grid .mobile-card-empty::before { display: none; }
}

.voucher-preview-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #101715; }
.voucher-preview-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.voucher-preview-shell { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.voucher-preview-back { position: fixed; top: 18px; left: 18px; z-index: 2; padding: 10px 16px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; color: #fff; background: rgba(0, 0, 0, .58); font-weight: 800; cursor: pointer; }
.voucher-preview-image { display: block; max-width: 96vw; max-height: 92vh; object-fit: contain; background: #fff; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }

.payment-breakdown { display: grid; gap: 3px; margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(23, 35, 31, .08); color: var(--muted); font-size: 11px; }
.payment-breakdown span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.payment-breakdown em { font-style: normal; }
.payment-breakdown b { color: var(--ink); font-weight: 800; }

.sub-tabs { flex-wrap: wrap; }
