/* One theme contract for existing modals, including legacy inline styles. */
html[data-theme] body .auth-modal>.auth-card,html[data-theme] body .auth-modal>.auth-form,html[data-theme] body dialog,html[data-theme] body .auth-modal :is(.permission-grid,.permission-grid label,.confirm,.formula,.panel,.card){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body .auth-modal :is(h1,h2,h3,label,p,small,legend,th,td,span),html[data-theme] body dialog :is(h1,h2,h3,label,p,small){color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body .auth-modal :is(input,select,textarea),html[data-theme] body dialog :is(input,select,textarea){background:var(--field)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body .auth-modal button,html[data-theme] body main button,html[data-theme] body dialog button{box-sizing:border-box!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;height:auto!important;min-height:38px!important;line-height:1.4!important;padding:8px 14px!important;white-space:normal!important;vertical-align:middle!important;overflow:visible!important;text-indent:0!important;background:var(--raised)!important;color:var(--gold)!important;border-color:var(--line)!important}
html[data-theme] body main nav button{justify-content:flex-start!important}
html[data-theme] body main button:focus-visible,html[data-theme] body .auth-modal button:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
html[data-theme] body main #memberTable .member-actions button{width:34px!important;min-width:34px!important;min-height:34px!important;padding:4px!important;line-height:1!important}
html[data-theme] body main #dashboard :is(.loan-money,.income-event){display:block!important;text-align:left!important;min-height:0!important;padding:2px 0!important;border:0!important;border-radius:0!important;background:transparent!important;line-height:1.4!important;color:var(--accent)!important;white-space:normal!important}
html[data-theme] body main #dashboard :is(.paid-line,.paid-money){color:var(--muted)!important}
html[data-theme] body main :is(.finance-table tfoot td,.finance-table tfoot th){background:var(--raised)!important;color:var(--gold)!important;font-weight:700;padding:14px!important}
html[data-theme=light] body main .negative{color:#b42318!important}
.pending-delete>span:first-child,.pending-delete>td:not(:last-child){text-decoration:line-through;opacity:.6}
.finance-toolbar{align-items:flex-end!important}.finance-toolbar label{display:grid;gap:5px}
.finance-card .actions{flex-wrap:wrap}
html[data-theme] body .auth-modal .finance-card.history-card{width:1250px!important;max-width:calc(100vw - 32px)!important}
.member-history-grid{display:grid;grid-template-columns:minmax(260px,2fr) minmax(400px,3fr);gap:20px}
.member-history-grid table{border-collapse:collapse}.member-history-grid th,.member-history-grid td{border:1px solid var(--line);padding:8px!important;text-align:left!important;white-space:nowrap}
.member-history-grid p{font-size:14px;line-height:1.5}.history-scroll{overflow:auto}
@media(max-width:850px){.member-history-grid{grid-template-columns:1fr}.member-history-grid>div{overflow:auto}.finance-toolbar{gap:8px}.finance-toolbar button{max-width:100%}}

html[data-theme] body main :is(#members,#memberForm,#settings,#accountAdmin,#memberDetail){background:var(--surface)!important;color:var(--ink)!important}
html[data-theme] body main :is(#cashIncome,#event,#accountAdmin,#settings) button{background:var(--raised)!important;color:var(--gold)!important;border-color:var(--line)!important}
html[data-theme] body main :is(#accountAdmin,#settings) input{background:var(--field)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body main #memberDetail :is(.member-detail-list,.tracking-section,.member-card,dt,dd,#trackingTable,#trackingTable td){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body main #memberDetail .tracking-toolbar textarea{background:var(--field)!important;color:var(--ink)!important;border-color:var(--line)!important}

html[data-theme] body :is(#permissionModal,#archiveModal,#passwordModal,#applyModal) :is(.auth-card,.permission-grid,.permission-grid label){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme] body :is(#permissionModal,#archiveModal,#passwordModal,#applyModal) :is(h2,p,label){color:var(--ink)!important}
html[data-theme] body main :is(.status-pill,.success-box,.developer-banner,.danger-zone){background:var(--raised)!important;color:var(--ink)!important;border-color:var(--line)!important}

html body main #members .filter-grid{grid-template-columns:100px minmax(120px,1fr) 70px minmax(90px,140px) minmax(230px,auto)!important;max-width:100%!important;width:100%!important}
html body main #members .member-filter-actions{display:flex!important;gap:5px!important;align-items:center!important;flex-wrap:nowrap!important;grid-column:auto!important}
html[data-theme] body main #members .member-filter-actions button{font-size:13px!important;padding:5px 8px!important;min-height:32px!important;white-space:nowrap!important;width:auto!important}
html body #themeSwitch{display:none!important}
.merge-card{width:760px;max-width:calc(100vw - 32px)}.merge-card table{width:100%;border-collapse:collapse}.merge-card td,.merge-card th{padding:8px;border:1px solid var(--line)}.merge-card label{display:block;margin:12px 0}.merge-card input:not([type=checkbox]){padding:8px;max-width:100%}.merge-card .actions{display:flex;gap:10px;flex-wrap:wrap}.merge-card input[type=checkbox]{width:20px;height:20px}.merge-card .merge-preview{padding:12px;background:var(--raised);line-height:1.6}
@media(max-width:800px){html body main #members .filter-grid{grid-template-columns:88px minmax(0,1fr)!important}html body main #members .member-filter-actions{grid-column:1/-1!important}}

html[data-theme] body main button[hidden],html[data-theme] body .auth-modal button[hidden]{display:none!important}

/* DEV workspace categories. */
.dev-dashboard{margin-top:20px;min-width:0}.dev-tabs{display:flex;flex-wrap:wrap;gap:8px;padding:12px;background:#eef3fa;border:1px solid #c7d2e3;border-radius:12px;margin-bottom:18px}
html body .dev-tabs button{min-height:44px!important;padding:10px 16px!important;white-space:normal!important;border-radius:9px!important;color:#254367!important;background:#fff!important}
html body .dev-tabs button[aria-selected=true]{background:#315fbe!important;color:white!important;border-color:#315fbe!important}
.dev-content>[hidden]{display:none!important}.dev-content section{margin-top:0}.dev-content{min-width:0}.dev-content [role=tabpanel]{overflow-x:auto;padding:4px}
.rescue-confirm,.rescue-secret{padding:18px;margin:16px 0;background:#eef4ff;border:2px solid #315fbe;border-radius:12px;scroll-margin:20px}
@media(max-width:600px){.dev-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:8px}.dev-tabs button{width:100%!important;font-size:14px!important}.dev-content .account-actions{min-width:150px}.rescue-secret input{max-width:100%;box-sizing:border-box}}

html body main .dev-dashboard .dev-tabs button[role=tab]{min-height:44px!important;height:auto!important;background:#fff!important;color:#254367!important;padding:10px 16px!important}
html body main .dev-dashboard .dev-tabs button[role=tab][aria-selected=true]{background:#315fbe!important;color:#fff!important;border-color:#315fbe!important}

/* 0.4.60: compact statement, clear date and amount boundaries. */
body #cashList #cashTable{width:max-content!important;min-width:0!important;max-width:none!important;table-layout:auto!important;border-collapse:collapse!important}
body #cashList #cashTable th,body #cashList #cashTable td{border:2px solid #8798ad!important;padding:7px 10px!important;width:auto!important;min-width:0!important;vertical-align:top}
body #cashList #cashTable td:first-child,body #cashList #cashTable th:first-child{white-space:nowrap!important;width:1%!important}
body #cashList #cashTable .entry{display:grid;grid-template-columns:minmax(0,1fr) max-content;column-gap:20px;min-width:0;border-bottom:1px solid #c3cbd6}
body #cashList #cashTable .entry>span:last-child{white-space:nowrap;text-align:right}
body #cashList #cashTable td:last-child{white-space:nowrap}
body .paid-line,body .paid-money{color:#a2a9b3!important;font-weight:400!important}
body .loan-line,body .loan-money{font-weight:700!important}
body #trackingTable{width:100%;border-collapse:collapse;table-layout:auto}
body #trackingTable td,body #trackingTable th{border:1px solid #bcc7d5;padding:8px;vertical-align:top}
body #trackingTable .tracking-content{white-space:pre-wrap;overflow-wrap:anywhere}
body #trackingTable button{font-size:14px;padding:5px 9px;margin:2px;min-height:32px}
.tracking-toolbar{display:flex;gap:8px;flex-wrap:wrap}.tracking-toolbar textarea{flex:1;min-width:220px;min-height:90px}
.tracking-scroll{overflow:auto}.tracking-section textarea{box-sizing:border-box;max-width:100%}
html[data-theme] body main #dashboard :is(.paid-line,.paid-money){color:#a2a9b3!important;font-weight:400!important} html[data-theme] body main #dashboard .loan-line{color:#111!important;font-weight:700!important}

/* Detail tables follow the compact cashflow layout. */
body #cashIn #cashInTable,body #cashOutPage #cashOutTable{width:max-content!important;min-width:0!important;max-width:none!important;table-layout:auto!important;border-collapse:collapse!important}
body #cashIn #cashInTable th,body #cashIn #cashInTable td,body #cashOutPage #cashOutTable th,body #cashOutPage #cashOutTable td{border:2px solid #8798ad!important;padding:7px 10px!important;width:auto!important;min-width:0!important;vertical-align:top}
body #cashIn #cashInTable tr:not(:has([colspan]))>:is(:nth-child(1),:nth-child(4)),body #cashOutPage #cashOutTable tr:not(:has([colspan]))>:nth-child(2){white-space:nowrap!important;width:1%!important}
body #cashIn #cashInTable .entry{display:grid;grid-template-columns:minmax(0,1fr) max-content;column-gap:20px;min-width:0;border-bottom:1px solid #c3cbd6}
body #cashIn #cashInTable .entry>span:last-child{white-space:nowrap;text-align:right}
body #cashIn #cashInTable tr:not(:has([colspan]))>td:is(:nth-child(3),:nth-child(6)),body #cashOutPage #cashOutTable tr:not(:has([colspan]))>td:nth-child(3),body #cashIn #cashInTable tfoot td,body #cashOutPage #cashOutTable tfoot td:first-of-type{white-space:nowrap!important;text-align:right!important}
body #cashOutPage #cashOutTable tr:not(:has([colspan]))>td:nth-child(5){white-space:nowrap}

/* Compact date pickers only; keep member selection below the form. */
html body main :is(#cashIncome,#event) .member-picker-layout{display:flex!important;flex-direction:column!important;gap:12px!important}
html body main :is(#cashIncome,#event) .mini-calendar-v2{display:table!important;width:308px!important;min-width:0!important;max-width:100%!important;table-layout:fixed!important;border-collapse:collapse!important;border-spacing:0!important;margin:8px auto!important;align-self:center!important}
html body main :is(#cashIncome,#event) .mini-calendar-v2 :is(th,td){box-sizing:border-box!important;width:14.2857%!important;min-width:0!important;padding:0!important;font-size:16px!important;line-height:1.2!important;text-align:center!important;vertical-align:middle!important;white-space:nowrap!important}
html body main :is(#cashIncome,#event) .mini-calendar-v2 th{height:28px!important}
html body main :is(#cashIncome,#event) .mini-calendar-v2 td{height:36px!important}
html body main :is(#cashIncome,#event) .mini-calendar-v2 td.selected{background:#dce9ff!important;color:#17498a!important;font-weight:700!important;box-shadow:inset 0 0 0 2px #5683c9}
@media(max-width:600px){
 html body main :is(#cashIncome,#event) .picker-left{padding:12px!important;box-sizing:border-box!important}
 html body main :is(#cashIncome,#event) .event-message{margin:6px 0!important;min-height:0!important}
}

/* Responsive layout corrections, v0.4.74. */
@media(min-width:1000px){
 html body main :is(#cashIncome,#event) .member-picker-layout{display:grid!important;grid-template-columns:minmax(320px,380px) minmax(0,1fr)!important;align-items:start!important;width:100%!important;max-width:none!important;gap:20px!important}
 html body main :is(#cashIncome,#event) .member-picker-layout>div{box-sizing:border-box!important;min-width:0!important;width:100%!important}
 html body main :is(#cashIncome,#event) .picker-left{padding:16px!important}
 html body main :is(#cashIncome,#event) .picker-form{width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed!important}
 html body main :is(#cashIncome,#event) .picker-form td:first-child{width:56px!important}
 html body main :is(#cashIncome,#event) .picker-form input{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important}
 html body main :is(#cashIncome,#event) .picker-grid{width:100%!important;min-width:0!important}
 html body main :is(#cashIncome,#event) :is(.event-actions,#cashIncomeSubmitV2){margin-left:0!important}
}
html body main #settings #tagSettingsTable{width:max-content!important;max-width:100%!important;min-width:0!important;table-layout:auto!important;border-collapse:collapse!important}
html body main #settings #tagSettingsTable :is(td,th){width:auto!important;min-width:0!important;padding:8px 12px!important;overflow-wrap:anywhere}
html body main #settings #tagSettingsTable td:last-child{white-space:nowrap}
html body main #settings #tagSettingsTable input{box-sizing:border-box!important;width:180px!important;max-width:100%!important;min-width:0!important}
@media(max-width:850px){
 html body main :is(.page,.member-card,.picker-left,.account-section,.finance-toolbar,.member-detail-toolbar){box-sizing:border-box!important;min-width:0!important;max-width:100%!important}
 html body main :is(#cashIncome,#event) .picker-form{display:table!important;table-layout:fixed!important;width:100%!important;min-width:0!important;max-width:100%!important}
 html body main :is(#cashIncome,#event) .picker-form td{min-width:0!important;padding:5px 2px!important}
 html body main :is(#cashIncome,#event) .picker-form td:first-child{width:56px!important}
 html body main :is(#cashIncome,#event) .picker-form input{box-sizing:border-box!important;display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;font-size:16px!important;min-height:42px!important}
 html body main input[type=date]{box-sizing:border-box!important;min-width:0!important;max-width:100%!important}
 html body main input[type=date]::-webkit-date-and-time-value{text-align:left;min-width:0}
 html body main #settings .account-toolbar{display:flex!important;flex-wrap:wrap!important;gap:8px!important}
 html body main #settings #newTagInput{box-sizing:border-box!important;width:180px!important;max-width:100%!important;min-width:0!important;font-size:16px!important}
 html body main #settings #tagSettingsTable td:last-child{white-space:normal!important}
 html body main #settings .account-section{overflow:visible!important}
 html body main :is(#memberForm,#memberDetail) :is(input,select,textarea,.inline-fields,.member-detail-list,dd){box-sizing:border-box!important;min-width:0!important;max-width:100%!important;overflow-wrap:anywhere}
 html body main :is(#memberForm,#memberDetail) :is(input,select,textarea){font-size:16px!important}
 html body main .member-detail-toolbar{display:flex!important;flex-wrap:wrap!important;gap:8px!important}
 html body .auth-modal{box-sizing:border-box!important;inset:0!important;width:100%!important;height:100dvh!important;max-width:100%!important;padding:10px!important;overflow:auto!important;align-items:center!important}
 html body .auth-modal>:is(.auth-card,.auth-form),html body .auth-modal .finance-card.history-card{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important;max-height:calc(100dvh - 20px)!important;overflow:auto!important;padding:16px!important;margin:auto!important;overflow-wrap:anywhere}
 html body .auth-modal :is(input,select,textarea){box-sizing:border-box!important;min-width:0!important;max-width:100%!important;font-size:16px!important}
 html body .auth-modal :is(.actions,.auth-form-actions){display:flex!important;flex-wrap:wrap!important;gap:8px!important}
 html body .auth-modal .member-history-grid{display:block!important;min-width:0!important}
 html body .auth-modal .member-history-grid>div{min-width:0!important;max-width:100%!important;overflow:auto!important}
 html body main .finance-scroll{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
 html body main .finance-toolbar label{max-width:100%!important}
 html body main #trackingTable{min-width:0!important;font-size:14px!important}
 html body main #trackingTable :is(td,th){padding:6px!important}
}

@media(max-width:850px){
 html body .auth-modal{z-index:10000!important}
 html body:has(.auth-modal:not([hidden])) .mobile-menu-toggle{visibility:hidden!important}
 html body main :is(#memberForm,#memberDetail) .member-fields .radio-row{display:flex!important;flex-wrap:wrap!important;overflow:visible!important;gap:8px!important}
 html body main :is(#memberForm,#memberDetail) .inline-fields{flex-wrap:wrap!important}
 html body main :is(#memberForm,#memberDetail) .inline-fields>*{min-width:0!important;max-width:100%!important}
 html body main #memberForm .member-fields input[type=radio]{width:auto!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table){display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;table-layout:auto!important;border:0!important;background:transparent!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table)>tbody{display:block!important;width:100%!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) tr:has(th){display:none!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) tr:not(:has(th)){display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:0!important;border:1px solid #becbdc!important;border-radius:10px!important;margin:0 0 12px!important;padding:8px!important;overflow:hidden!important;background:#fff!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) td{box-sizing:border-box!important;display:flex!important;flex-direction:column!important;align-items:flex-start!important;width:auto!important;min-width:0!important;max-width:100%!important;border:0!important;padding:6px!important;font-size:15px!important;line-height:1.45!important;white-space:normal!important;overflow-wrap:anywhere!important;text-align:left!important}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) td[data-label]::before{content:attr(data-label);display:block;font-size:12px;color:#52657c;margin-bottom:3px}
 html body :is(main,.auth-modal) table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) td:is([data-label="操作"],[data-label="紀錄內容"],[data-label="短備註"],[colspan]){grid-column:1/-1!important}
 html body main #memberTable td.member-actions{flex-direction:row!important;flex-wrap:wrap!important;gap:8px!important}
 html body main #memberTable td.member-actions::before{width:100%}
 html[data-theme] body main #memberTable .member-actions button{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
 html body .auth-modal table.mobile-records:is(#memberTable,#loanHistory,#trackingTable,#accountAdmin table,.merge-card table,.history-scroll table) input[type=checkbox]{width:24px!important;height:24px!important}
 html body main #dashboard .calendar-header-v2 label{white-space:nowrap!important}
 html body main #dashboard .calendar-header-v2 input{max-width:90px!important}
}
@media(max-width:850px){
 html body main #members .filter-grid :is(input,select){box-sizing:border-box!important;min-width:0!important;max-width:100%!important;font-size:16px!important}
 html body main #members .filter-grid>.wide{display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:8px!important;overflow:visible!important;white-space:normal!important;font-size:14px!important}
 html body main #members .filter-grid>.wide label{display:inline-flex!important;align-items:center!important;margin:0!important;white-space:nowrap!important;gap:4px!important;min-height:32px!important}
 html body main #memberTable.mobile-records td.member-actions{flex-direction:row!important;flex-wrap:wrap!important;gap:8px!important}
}

@media(max-width:850px){
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable){display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;border:0!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable)>:is(tbody,tfoot){display:block!important;width:100%!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable)>tbody>tr:has(th){display:none!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable) tr{display:block!important;border:2px solid #8798ad!important;border-radius:8px!important;margin:0 0 10px!important;padding:8px!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable) :is(td,th){display:block!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important;padding:6px!important;border:0!important;white-space:normal!important;font-size:15px!important;text-align:left!important;overflow-wrap:anywhere!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable) td:empty{display:none!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable) td[data-label]:not(:empty)::before{content:attr(data-label);display:block;font-size:12px;color:#52657c;margin-bottom:3px}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable) .entry{display:grid!important;grid-template-columns:minmax(0,1fr) max-content!important;gap:12px!important}
 html body main :is(#cashList #cashTable,#cashIn #cashInTable) .entry>span:first-child{white-space:normal!important;overflow-wrap:anywhere!important}
 html body main #cashList #cashTable .day-total{margin-top:-10px!important;border-top:0!important;background:#f1f5f9!important}
 html body main #cashList #cashTable .day-total td::before{display:none!important}
 html body main #cashIn #cashInTable tr>td:nth-child(4){border-top:1px solid #becbdc!important;margin-top:8px!important;padding-top:10px!important}
 html body main #cashOutPage #cashOutTable td:nth-child(3){text-align:right!important}
}

@media(max-width:850px){
 html body main:has(.member-cloud-bar)>section>.page{padding-top:16px!important}
 html body main #memberDetail .member-detail-list{grid-template-columns:100px minmax(0,1fr)!important}
 html body main #memberDetail .member-detail-list :is(dt,dd){font-size:15px!important;line-height:1.5!important;padding:7px!important}
 html body .auth-modal .history-scroll{overflow:visible!important}
}

@media(max-width:850px){
 html body main>section>.page:is(#members,#memberForm,#memberDetail,#cashIncome,#event,#cashList,#cashIn,#cashOutPage,#settings,#accountAdmin,#dashboard){padding-top:16px!important}
 html body main #cashIn #cashInTable>tbody{display:flex!important;flex-direction:column!important}
 html body main #cashIn #cashInTable>tbody>tr:not(:has(th)){display:contents!important}
 html body main #cashIn #cashInTable>tbody>tr>td:is(:nth-child(1),:nth-child(4)){background:#edf2f8!important;border:1px solid #8798ad!important;border-radius:8px 8px 0 0!important;margin:8px 0 0!important;padding:8px!important}
 html body main #cashIn #cashInTable>tbody>tr>td:is(:nth-child(3),:nth-child(6)){border-bottom:2px solid #8798ad!important;margin-bottom:8px!important}
}
@media(min-width:851px) and (max-width:999px){
 html body main :is(#cashIncome,#event) .member-picker-layout{width:100%!important;max-width:100%!important}
 html body main :is(#cashIncome,#event) :is(.picker-left,.picker-form){box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important}
 html body main :is(#cashIncome,#event) .picker-form input{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important}
}
@media(max-width:850px){
 html[data-theme] body main :is(#cashList #cashTable,#cashIn #cashInTable,#cashOutPage #cashOutTable) tr:not(:has([colspan]))>td:nth-child(n){width:100%!important;min-width:0!important;max-width:100%!important;white-space:normal!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;gap:8px!important}
}

/* v0.4.74 mobile daily subtotals; desktop ledger stays unchanged. */
.mobile-income-total,.mobile-expense-total{display:none}
@media(max-width:850px){
 html body main #settings #tagSettingsTable{width:100%!important;table-layout:fixed!important}
 html body main #settings #tagSettingsTable :is(th,td){width:50%!important;text-align:center!important}
 html[data-theme] body main #cashList #cashTable :is(.mobile-income-total,.mobile-expense-total){display:block!important;margin:8px -6px 0!important;padding:10px!important;font-weight:700!important;border-top:2px solid #8798ad!important;border-radius:4px;color:#173453!important}
 html[data-theme] body main #cashList #cashTable .mobile-income-total{background:#e3efff!important}
 html[data-theme] body main #cashList #cashTable .mobile-expense-total{background:#fff0d8!important}
 html[data-theme] body main #cashList #cashTable .day-total td:nth-child(-n+3){display:none!important}
 html[data-theme] body main #cashList #cashTable .day-total,
 html[data-theme] body main #cashList #cashTable .day-total td:last-child{background:#dce7f2!important;color:#173453!important;font-weight:700!important}
 html[data-theme] body main #cashList #cashTable tfoot :is(tr,th,td){background:#dce7f2!important;font-weight:700!important}
}

/* Fail closed before authentication and while reconnecting. */
html body:not(.auth-ready) .mobile-menu-toggle,html body:not(.auth-ready) nav#nav{display:none!important;visibility:hidden!important;pointer-events:none!important}
html body:not(.auth-ready).mobile-nav-open::after{display:none!important}

/* v0.4.74 statement totals and incidental income. */
html[data-theme] body main #dashboard .calendar-v2 .income-event{color:#8525b9!important}
html[data-theme] body main #cashList #cashTable .day-total td{font-weight:700!important}
html[data-theme] body main #cashList #cashTable .day-total td:nth-child(2){background:#e3efff!important}
html[data-theme] body main #cashList #cashTable .day-total td:nth-child(3){background:#fff0d8!important}
html[data-theme] body main #cashList #cashTable .day-total td:nth-child(4){background:#dce7f2!important}
html body main #cashList #cashTable .total-pair{display:grid;grid-template-columns:max-content max-content;justify-content:space-between;gap:18px;white-space:nowrap!important;line-height:1.6}
html body main #cashList #cashTable .total-pair span:first-child{text-align:left!important}
html body main #cashList #cashTable .total-pair span:last-child{text-align:right!important}
@media(min-width:851px){html body main #cashList #cashTable td:last-child{white-space:nowrap!important;width:1%!important}}
html body main[hidden]{display:none!important;visibility:hidden!important;pointer-events:none!important}

html body main #cashList #cashTable th:last-child{text-align:left!important}

#dataSyncStatus{position:fixed;bottom:8px;left:50%;transform:translateX(-50%);max-width:90vw;padding:8px 14px;border:1px solid #bd8d25;background:#fff4d2;color:#593b00;z-index:80;font-size:14px;border-radius:8px}#dataSyncStatus[hidden]{display:none!important}

#loanHistory td:last-child{text-align:center} .finance-card .actions{justify-content:center;flex-wrap:wrap} #partialPreview{padding:10px;background:#eff6ff;color:#18344f;overflow-wrap:anywhere}

/* v0.4.74 mobile controls and compact member actions */
@media(max-width:850px){
 html[data-theme] body main #dashboard .calendar-header-v2{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto!important;gap:8px!important;align-items:center!important}
 html[data-theme] body main #dashboard .calendar-header-v2 #prevCalendar{grid-row:1;grid-column:1;justify-self:start}
 html[data-theme] body main #dashboard .calendar-header-v2 .month-nav{grid-row:1;grid-column:2;white-space:nowrap;font-size:16px!important}
 html[data-theme] body main #dashboard .calendar-header-v2 #nextCalendar{grid-row:1;grid-column:3}
 html[data-theme] body main #dashboard .calendar-header-v2 label{display:flex!important;gap:4px!important;min-width:0!important;font-size:14px!important;width:auto!important}
 html[data-theme] body main #dashboard .calendar-header-v2 :is(input,select){box-sizing:border-box!important;flex:1 1 auto!important;width:100%!important;min-width:0!important;max-width:none!important;height:42px!important;font-size:16px!important;padding:4px!important}
 html[data-theme] body main #dashboard .calendar-header-v2 #reloadCalendar{font-size:13px!important;padding:6px!important;min-height:42px!important}
 html[data-theme] body main #event .picker-form{display:block!important;width:100%!important}
 html[data-theme] body main #event .picker-form tbody{display:block!important;width:100%!important}
 html[data-theme] body main #event .picker-form tr{display:grid!important;grid-template-columns:42px minmax(0,1fr)!important;align-items:center!important;width:100%!important}
 html[data-theme] body main #event .picker-form td{display:block!important;width:auto!important;min-width:0!important;padding:5px 2px!important;box-sizing:border-box!important}
 html[data-theme] body main #event .picker-form td:first-child{width:auto!important}
 html[data-theme] body main #event .picker-form input{display:block!important;box-sizing:border-box!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;-webkit-appearance:none;appearance:none}
 html[data-theme] body main #event .picker-form input[type=date]::-webkit-date-and-time-value{min-width:0!important;text-align:left}
 html[data-theme] body main #members #memberTable.mobile-records tr:not(:has(th)){grid-template-columns:minmax(0,1fr) minmax(148px,1fr)!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions{grid-column:2!important;grid-row:1!important;justify-content:flex-end!important;align-items:center!important;flex-wrap:nowrap!important;gap:4px!important;padding:4px 0!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions::before{display:none!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions button{margin:0!important;flex:0 0 44px!important}
}

@media(max-width:850px){
 html[data-theme] body .auth-modal #loanForm{min-width:0!important;max-width:100%!important;box-sizing:border-box!important}
 html[data-theme] body .auth-modal #loanForm input{box-sizing:border-box!important;display:block!important;width:100%!important;inline-size:100%!important;min-width:0!important;min-inline-size:0!important;max-width:100%!important;margin:0!important}
 html[data-theme] body .auth-modal #loanForm input[type=date]{-webkit-appearance:none!important;appearance:none!important;overflow:hidden!important}
 html[data-theme] body .auth-modal #loanForm input[type=date]::-webkit-date-and-time-value{min-width:0!important;text-align:left!important}
 html[data-theme] body .auth-modal #loanForm input[type=date]::-webkit-datetime-edit{min-width:0!important;padding:0!important}
}

/* Tag settings: equal columns and visible grid on desktop and mobile. */
html[data-theme] body main #settings #tagSettingsTable{width:100%!important;max-width:100%!important;table-layout:fixed!important;border-collapse:collapse!important;border:2px solid #8798ad!important;border-radius:0!important}
html[data-theme] body main #settings #tagSettingsTable :is(th,td){width:50%!important;text-align:center!important;vertical-align:middle!important;border:2px solid #8798ad!important}

html[data-theme] body main #settings .account-section{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important}
html[data-theme] body main #settings #tagSettingsTable :is(th,td):first-child{width:66.666667%!important}
html[data-theme] body main #settings #tagSettingsTable :is(th,td):last-child{width:33.333333%!important}

@media(min-width:851px){
 html[data-theme] body main #settings .account-section{width:640px!important;max-width:100%!important}
 html[data-theme] body main #settings .account-toolbar{display:flex!important;flex-wrap:nowrap!important;gap:10px!important;width:100%!important;box-sizing:border-box!important}
 html[data-theme] body main #settings .account-toolbar #newTagInput{width:0!important;min-width:0!important;flex:1 1 0!important;box-sizing:border-box!important}
 html[data-theme] body main #settings .account-toolbar button{flex:0 0 auto!important;margin-left:0!important;margin-right:0!important;white-space:nowrap!important}
}

/* Shared sizing for event date and content, including desktop native date controls. */
html[data-theme] body main #event .picker-form input{box-sizing:border-box!important;display:block!important;width:100%!important;inline-size:100%!important;min-width:0!important;min-inline-size:0!important;max-width:100%!important;margin:0!important}
html[data-theme] body main #event .picker-form input[type=date]{-webkit-appearance:none!important;appearance:none!important}
html[data-theme] body main #event .picker-form input[type=date]::-webkit-date-and-time-value{min-width:0!important;text-align:left!important}

/* Preserve actual table cells on desktop; flex on a td creates an anonymous extra cell. */
@media(min-width:851px){
 html[data-theme] body main #members #memberTable td.member-actions{display:table-cell!important;min-width:0!important;width:1%!important;white-space:nowrap!important;vertical-align:middle!important}
 html[data-theme] body main #members #memberTable th:nth-child(2){width:1%!important;min-width:0!important;white-space:nowrap!important}
 html[data-theme] body main #members #memberTable td.member-actions button{margin:0 4px 0 0!important}
 html[data-theme] body main #members #memberTable td.member-actions button:last-child{margin-right:0!important}
}

/* v0.4.74: DEV settings and bounded tracking history. */
.account-settings-panel{max-width:640px;box-sizing:border-box;padding:18px;border:1px solid #bcc7d5;border-radius:10px;background:#f4f7fc}
.account-settings-panel label{display:grid;gap:6px;margin:12px 0}
.account-settings-panel input,.account-settings-panel select{box-sizing:border-box;min-width:0;width:100%;max-width:100%;padding:10px}
.account-settings-panel button{margin-right:8px;min-height:40px}
.tracking-pager{display:flex;align-items:center;justify-content:center;gap:16px;margin:12px 0}
.tracking-pager[hidden]{display:none!important}
.tracking-pager button{min-height:44px!important;padding:8px 16px!important}
@media(min-width:851px){.tracking-scroll{overscroll-behavior:contain}#trackingTable th{position:sticky;top:0;background:#f1f5fb;z-index:1}}
@media(max-width:850px){.tracking-scroll{max-height:none!important;overflow:visible}}

/* v0.4.74: prevent native numeric steppers; keep all history inside the dialog. */
input[type=number]{appearance:textfield;-moz-appearance:textfield}
input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
html[data-theme] body .auth-modal .finance-card.history-card{box-sizing:border-box!important;overflow-x:hidden!important;overflow-y:auto!important}
html body .auth-modal .member-history-grid{grid-template-columns:minmax(0,2fr) minmax(0,3fr);gap:16px;min-width:0}
html body .auth-modal .member-history-grid>div{min-width:0!important;max-width:100%!important;overflow:visible!important}
html body .auth-modal .member-history-grid table{width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed!important}
html body .auth-modal .member-history-grid :is(th,td){white-space:normal!important;overflow-wrap:anywhere!important;font-size:13px!important;padding:5px!important;line-height:1.45}
html body .auth-modal .member-history-grid p{overflow-wrap:anywhere}
html body .auth-modal .member-history-grid button{white-space:normal!important;max-width:100%;padding:4px!important;font-size:12px!important}
.mobile-finance-days,.date-jump-toggle,.date-jump-panel{display:none}
@media(max-width:850px){
 html body main :is(#cashIn,#cashOutPage)>.finance-scroll{display:none!important}
 .mobile-finance-days{display:block}
 html body main :is(#cashIn,#cashOutPage) .finance-top{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid #bdcadd;padding:8px 0}
 .finance-top .finance-toolbar{margin:0;gap:8px}
 .finance-top .finance-status{font-size:12px;margin:4px 0;min-height:0}
 .date-jump-toggle{display:inline-block;min-width:38px;min-height:38px;font-size:22px}
 .date-jump-panel:not([hidden]){display:block;padding:8px;border:1px solid #becbdc;background:#f5f8fc;border-radius:8px;margin-top:8px}
 .date-jump-title{text-align:center;font-weight:bold;margin-bottom:6px}
 .date-jump-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;text-align:center}
 .date-jump-grid button{min-width:0;min-height:34px;padding:3px;margin:0}
 .finance-day{border:1px solid #8798ad;border-radius:8px;margin:12px 0;overflow:hidden}
 .finance-day h3{background:#edf2f8;font-size:15px;margin:0;padding:8px;border-bottom:1px solid #becbdc}
 .day-entries{padding:0 8px}
 .finance-day .entry{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:7px 0;border-bottom:1px solid #dae1eb;font-size:14px}
 .finance-day .entry>span:first-child{overflow-wrap:anywhere}
 .finance-day .entry>span:last-child{text-align:right;white-space:nowrap}
 .finance-day .entry button{display:block;margin:4px 0 0 auto;min-height:32px;font-size:13px}
 .day-subtotal,.month-subtotal{display:flex;justify-content:space-between;gap:12px;padding:8px;background:#f3f6fa;font-size:14px}
 .month-subtotal{background:#e3edfa;font-weight:bold;border:1px solid #8798ad;border-radius:8px}
 .day-selected{outline:3px solid #789ce1;outline-offset:1px}
 .mobile-finance-days .negative{color:#b91c1c}
 .mobile-finance-days .pending-delete{opacity:.55;text-decoration:line-through}
 html[data-theme] body main #members #memberTable.mobile-records tr:not(:has(th)){grid-template-columns:repeat(3,minmax(0,1fr))!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions{grid-column:2/4!important;grid-row:1!important;gap:5px!important}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions button{width:34px!important;min-width:34px!important;height:34px!important;min-height:34px!important;flex:0 0 34px!important}
 html[data-theme] body main #members #memberTable.mobile-records td{font-size:14px!important;padding:5px!important}
 html body .auth-modal .member-history-grid{display:block!important}
}

@media(max-width:850px){
 html body main :is(#cashIn,#cashOutPage) .finance-top::before{content:"";position:absolute;top:-16px;height:16px;left:0;right:0;background:#fff}
 html body main :is(#cashIn,#cashOutPage) .finance-toolbar>span{display:none}
}

/* v0.4.74: font-independent icons, one-row mobile actions and member disclosures. */
.toolbar-mobile{display:none}
html body main #members #memberTable td.member-summary{display:none!important}
.date-jump-toggle svg{display:block;width:22px;height:22px;flex-shrink:0}
@media(max-width:850px){
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-top{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid #bdcadd;padding:8px 0}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-top::before{content:"";position:absolute;top:-16px;height:16px;left:0;right:0;background:#fff}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar{display:flex!important;align-items:flex-end!important;flex-wrap:nowrap!important;gap:5px!important;margin:0!important}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar>span{display:none!important}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar label{display:flex!important;flex-direction:column!important;gap:3px!important;margin:0!important;font-size:12px!important;flex:0 0 auto!important}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar input[data-year]{box-sizing:border-box!important;width:66px!important;min-width:0!important;height:36px!important;padding:5px!important;font-size:16px!important}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar select[data-month]{box-sizing:border-box!important;width:48px!important;min-width:0!important;height:36px!important;padding:3px!important;font-size:16px!important}
 html body main :is(#cashList,#cashIn,#cashOutPage) .finance-toolbar button{box-sizing:border-box!important;flex:0 0 auto!important;min-width:32px!important;height:36px!important;min-height:36px!important;padding:5px!important;margin:0!important;font-size:13px!important;white-space:nowrap!important}
 html body main .finance-toolbar .toolbar-desktop{display:none!important}
 html body main .finance-toolbar .toolbar-mobile{display:inline-block!important;vertical-align:middle}
 html body main .finance-toolbar .date-jump-toggle{display:flex!important;align-items:center;justify-content:center}
 html body main .finance-toolbar:has([data-save-deletes]){flex-wrap:wrap!important}
 html body main #members #memberTable.mobile-records tr:not(:has(th)){position:relative!important;min-height:44px!important;padding:5px!important;margin-bottom:7px!important}
 html body main #members #memberTable.mobile-records tr:has(.member-summary):not(.member-expanded)>td:not(.member-summary):not(.member-actions){display:none!important}
 html body main #members #memberTable.mobile-records td.member-summary{display:block!important;grid-column:1/-1!important;grid-row:1!important;padding:0 116px 0 0!important;min-width:0!important}
 html body main #members #memberTable.mobile-records td.member-summary::before{display:none!important}
 html body main #members #memberTable.mobile-records td.member-summary button{display:flex!important;align-items:center!important;gap:5px!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;min-height:34px!important;margin:0!important;padding:3px!important;background:transparent!important;border:0!important;box-shadow:none!important;color:#16345b!important;text-align:left!important;font-size:15px!important}
 html body main #members #memberTable.mobile-records .member-summary button>span:last-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 html body main #members #memberTable.mobile-records .expand-marker{font-size:22px;flex:0 0 auto}
 html body main #members #memberTable.mobile-records .member-expanded .expand-marker{transform:rotate(90deg)}
 html[data-theme] body main #members #memberTable.mobile-records td.member-actions{position:absolute!important;top:5px!important;right:5px!important;display:flex!important;width:auto!important;gap:4px!important;padding:0!important}
}
