.tag.type-single{background:#e8f1fd;color:#215b9c;border:1px solid #c9dcf4}
.tag.type-month{background:#e5f4ec;color:#236440;border:1px solid #c2e3d0}
.tag.type-subscription{background:#f0eafa;color:#674093;border:1px solid #dcd0ed}
.report-tabs{display:flex;gap:6px;border-bottom:1px solid var(--border);margin-bottom:24px;padding-bottom:9px;overflow:auto}
.report-tabs button{white-space:nowrap;font-size:15px;font-weight:500}
.report-tabs button.active{background:#20252b;color:white}
.subscription-summary{display:flex;flex-wrap:wrap;gap:25px;padding:15px 0 21px;font-size:14px;color:var(--muted)}
.subscription-summary strong{font-size:20px;color:var(--ink);margin-right:4px;font-variant-numeric:tabular-nums}
.ends-soon{background:#fff3dd;color:#875e13;padding:4px 8px;border-radius:4px;font-size:13px}
.compare-controls,.people-period{margin-bottom:18px;align-items:end;gap:15px}
.compare-controls select,.people-period select{min-width:130px}
.compare-legend{margin-top:22px}
.compare-legend span:nth-child(2):before{background:#9674b8}
.compare-chart{height:300px}
.people-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:25px;margin:24px 0;align-items:start}
.people-layout>div{min-width:0}
.people-picker{border:1px solid var(--border);border-radius:6px;padding:12px;background:#fafbfc}
.people-picker>input{font-size:13px}
.picker-heading{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--muted);padding:12px 0}
#person-options{max-height:500px;overflow:auto}
.person-choice{display:flex;flex-direction:row;align-items:start;font-size:14px;gap:9px;padding:7px 0;font-weight:400}
.person-choice input,.alias-choice input{width:16px;min-width:16px;height:16px;min-height:16px;margin:3px 0 0;accent-color:#294e77}
.people-results>.subscription-summary{padding-top:0}
.people-results .table-wrap{margin:0}
.people-results td:first-child,.people-results th:first-child{padding-left:10px}
.people-results td:last-child,.people-results th:last-child{padding-right:10px}
.people-results td:first-child .subtext{white-space:normal;max-width:360px;line-height:1.6}
.person-detail{padding-top:28px;margin-top:24px;border-top:1px solid var(--border);scroll-margin-top:90px}
.person-detail h2{font-size:18px}
.panel>.hint{margin-bottom:20px}
#aliases-dialog{max-width:700px}
#alias-search{margin:18px 0 10px}
#aliases-list{max-height:280px;overflow:auto;border:1px solid var(--border);border-radius:6px;padding:5px 12px}
.alias-choice{display:flex;flex-direction:row;gap:12px;padding:9px 0;border-bottom:1px solid #eceff3;font-size:14px;cursor:pointer}
.alias-choice:last-child{border:0}
.alias-choice strong{font-weight:550}
.alias-choice small{display:block;font-size:12px;color:var(--muted);margin-top:3px}
#alias-summary{margin:16px 0;font-size:13px}
#alias-new-name{margin-top:16px}
#person-link-hint{font-size:12px;font-weight:400}
table tfoot td{font-weight:650;border-top:1px solid var(--border);background:#fafbfc}
@media(max-width:1100px){.people-layout{grid-template-columns:200px minmax(0,1fr);gap:16px}.compare-controls{gap:10px}.compare-controls select{min-width:110px}}
@media(max-width:760px){.people-layout{grid-template-columns:1fr}.people-picker{padding:12px}#person-options{max-height:190px}.person-choice{padding:6px 0}.report-tabs{gap:3px}.report-tabs button{font-size:13px;padding:9px 11px}.compare-controls>label,.people-period>label{flex:1;min-width:120px}.compare-controls select,.people-period select{width:100%;min-width:0}.compare-chart{height:250px}.subscription-summary{gap:12px;font-size:12px}.subscription-summary strong{font-size:18px}.report-tools label{width:auto;flex:1}.report-tools label select{min-width:0;width:100%}.people-results .subtext{max-width:190px!important}.person-detail{scroll-margin-top:135px}#aliases-dialog .dialog-actions{flex-wrap:wrap}#aliases-dialog .dialog-actions .primary{width:100%}}

/* Shared presentation and touch interaction. Business calculations stay shared. */
.mobile-only{display:none}
.filter-options{display:flex;align-items:end;flex-wrap:wrap;gap:10px}
.filter-options label{font-size:12px;color:var(--muted);gap:4px}
.filters{align-items:end}
.filter-options .quiet{font-size:13px;min-height:42px}
.chart-readout{font-size:12px;line-height:1.5;color:var(--muted);min-height:36px;margin:0 0 16px}
.help-note{margin-bottom:18px;color:var(--muted);font-size:13px}
.help-note summary{cursor:pointer;padding:8px 0;width:fit-content}
.help-note .hint{margin:5px 0 12px}
.chart [role=button]{cursor:pointer;outline:none}
.chart-selected,.chart [role=button]:focus{stroke:#20252b;stroke-width:2;paint-order:stroke}
#menu-dialog{max-width:440px}
#menu-links{position:static;display:grid;gap:4px;min-width:0}
#menu-links button{justify-content:start;gap:14px;min-height:48px;text-align:left}
#menu-links button>span:last-child{margin-left:auto}
#menu-links svg,#mobile-nav svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.menu-account{border-top:1px solid var(--border);padding-top:16px;margin-top:16px}
.menu-account p{font-size:14px;color:var(--muted)}
.menu-account>div{display:flex;gap:10px}
html{scroll-padding-top:90px}
body:has(dialog[open]){overflow:hidden}
input,select,textarea,.form-grid>label,.report-tools>label{min-width:0}
.filters,.person-detail{scroll-margin-top:80px}
.breakdown>div>span:first-child,.settings-row>span{min-width:0;overflow-wrap:anywhere}
.breakdown>div>span:last-child,.breakdown strong{flex-shrink:0;font-variant-numeric:tabular-nums}

@media(min-width:761px) and (max-width:1050px){
 .page-heading{flex-wrap:wrap}.actions{flex-wrap:wrap}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .people-layout{grid-template-columns:minmax(0,1fr)}
 #person-options{max-height:220px;display:grid;grid-template-columns:1fr 1fr;gap:0 16px}
 .panel-heading:has(.report-tools){align-items:stretch;flex-direction:column}
 .report-tools{min-width:0}.report-tools>label{flex:1}
}

@media(max-width:760px){
 :root{background:#f3f5f7}
 html{scroll-padding-top:72px}
 .mobile-only{display:block}
 button,.table-button{min-height:44px;touch-action:manipulation}
 input,select,textarea{font-size:16px!important;min-height:46px;border-radius:8px;max-width:100%;width:100%}
 input[type=date]{display:block;min-width:0;-webkit-appearance:none;appearance:none;text-align:left}
 input[type=date]::-webkit-date-and-time-value{text-align:left;min-height:1.5em}
 input[type=checkbox]{min-height:20px;min-width:20px;width:20px;height:20px;flex:none;accent-color:var(--accent)}
 label{font-size:13px;line-height:1.45}
 header{height:60px;padding:0 16px;padding-top:env(safe-area-inset-top);height:calc(60px + env(safe-area-inset-top));gap:12px;z-index:10}
 header .wordmark{font-size:23px;letter-spacing:-.9px}
 .header-account{display:none}
 #mobile-account{font-size:13px;min-height:40px;padding:7px 13px;border-color:var(--border);color:var(--muted)}
 .workspace{display:block;min-height:0}
 .workspace>aside{display:none}
 main{padding:22px 16px calc(96px + env(safe-area-inset-bottom));margin:0;max-width:none;min-width:0}
 #mobile-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));position:fixed;inset:auto 0 0;z-index:15;background:#fff;border-top:1px solid var(--border);gap:3px;padding:7px max(8px,env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom));min-width:0;box-shadow:0 -4px 20px #20252b05}
 #mobile-nav button{display:flex;flex-direction:column;justify-content:center;gap:3px;min-width:0;min-height:54px;padding:5px 1px;text-align:center;border-radius:9px;color:#717b88;font-weight:500}
 #mobile-nav button span{font-size:11px;color:inherit;white-space:nowrap}
 #mobile-nav button.active{color:#264f7c;background:#edf3fa;font-weight:650}
 .page-heading{position:relative;display:block;margin-bottom:20px;padding-top:0}
 .page-heading .eyebrow{display:none}
 .page-heading h1{font-size:27px;line-height:1.3;letter-spacing:-.8px;margin:0 52px 0 0;outline:none}
 .actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px;width:100%}
 .actions button{padding:10px 12px;border-radius:9px;font-size:14px;font-weight:600}
 #refresh{position:absolute;right:0;top:-4px;width:44px;height:44px;padding:0;font-size:0;background:white}
 #refresh:before{content:'↻';font-size:26px;font-weight:400;line-height:1}
 #refresh:focus-visible{outline:3px solid #8db3ff}
 body[data-view=reports] .actions,body[data-view=balances] .actions,body[data-view=settings] .actions{margin:0}
 body[data-view=reports] #add-payment,body[data-view=reports] #add-expense,body[data-view=balances] #add-payment,body[data-view=balances] #add-expense,body[data-view=settings] #add-payment,body[data-view=settings] #add-expense{display:none}
 .actions:not(:has(.admin-only:not([hidden]))){margin:0}
 .period-bar{display:block;margin:0 0 20px;gap:0}
 .period-presets{width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:4px;border-radius:10px;background:#e7ebf0}
 .period-presets button{min-width:0;font-size:12px;min-height:40px;padding:7px 3px;border-radius:7px}
 .date-toggle{display:flex;width:100%;align-items:center;justify-content:space-between;gap:8px;text-align:left;font-size:11px;font-weight:400;color:var(--muted);padding:10px 1px;min-height:40px}
 .date-toggle>span:last-child{color:#346497;white-space:nowrap}
 #custom-dates{display:none;width:100%;padding:12px;border:1px solid var(--border);border-radius:10px;background:#fff;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:3px 0 12px}
 .dates-open #custom-dates{display:grid}
 #custom-dates label{display:flex;flex-direction:column;align-items:stretch;gap:5px;font-size:12px}
 #custom-dates input{width:100%;padding:8px 6px}
 #custom-dates>span{display:none}
 #apply-dates{grid-column:1/-1;font-size:14px;min-height:42px;background:#edf3fa;border:0;color:#294e77}
 .stats{gap:10px;margin-bottom:18px}
 .stat{padding:14px 13px 12px;border-radius:12px;min-width:0}
 .stat-label{font-size:12px;margin-bottom:8px;line-height:1.4;min-height:17px}
 .stat-value{font-size:clamp(20px,6.1vw,26px);letter-spacing:-.8px;white-space:normal;overflow-wrap:anywhere;font-weight:650}
 .stat-value small{font-size:13px;white-space:nowrap}
 .stat-note{font-size:11px;line-height:1.45;margin-top:7px}
 .overview-grid{display:block}
 .panel{padding:18px 16px;margin-bottom:16px;border-radius:12px;min-width:0}
 .panel-heading{gap:10px;margin-bottom:16px;align-items:start;flex-wrap:wrap}
 .panel-heading h2{font-size:17px;line-height:1.45;letter-spacing:-.2px;min-width:0;flex:1 1 150px}
 .panel-heading>.table-button{font-size:12px;flex-shrink:0;min-height:32px;display:inline-flex;align-items:center;padding:0 2px}
 .panel-heading:has(.report-tools){display:block}
 .panel-heading .report-tools{margin-top:14px}
 .legend{flex-wrap:wrap;gap:8px 16px;font-size:11px;margin-bottom:6px}
 .chart,.compare-chart{height:auto;aspect-ratio:360/245;margin:8px 0 0;max-width:100%}
 .chart text{font-size:12px}
 .chart-readout{font-size:12px;min-height:38px;margin-bottom:12px;line-height:1.55}
 .balance-top{align-items:baseline}
 .balance-number{font-size:21px;white-space:nowrap}
 .balance-detail{font-size:12px;line-height:1.6;margin-top:5px}
 .balance-cards{display:block}
 .balance-cards .stat-value{font-size:30px}
 .breakdown>div{font-size:13px;line-height:1.5;gap:10px}
 .notice{font-size:13px;line-height:1.6;padding:12px;border-radius:0 8px 8px 0}
 .hint{font-size:12px;line-height:1.65}
 .filters{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin-bottom:18px;align-items:center}
 .filters>input{min-width:0;width:100%;max-width:none;padding:10px}
 #filter-toggle{font-size:12px;padding:9px 10px;min-height:46px}
 #filter-toggle.has-filters{background:#edf3fa;border-color:#bbcee5;color:#294e77}
 .filter-options{display:none;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));padding:12px;background:#f6f8fa;border:1px solid var(--border);border-radius:9px;gap:12px 8px}
 .filters-expanded .filter-options{display:grid}
 .filter-options label{min-width:0}
 .filter-options label:has(#filter-type){grid-column:1/-1}
 .filters .filter-options select{width:100%;max-width:100%;min-width:0;padding:8px 5px}
 #reset-filters{align-self:end;font-size:12px;min-height:46px}
 .table-wrap.responsive-wrap{overflow:visible;margin:0;background:none}
 .responsive-table{display:block;white-space:normal!important;font-size:14px!important;width:100%;min-width:0}
 .responsive-table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .responsive-table tbody,.responsive-table tfoot{display:grid;gap:12px;min-width:0}
 .responsive-table tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px 14px;border:1px solid #e3e7ed;border-radius:10px;padding:14px;background:#fff;min-width:0}
 .responsive-table tbody tr:hover{background:#fff}
 .responsive-table td,.responsive-table td:first-child,.responsive-table td:last-child{display:block;min-width:0;padding:0;border:0;text-align:left;white-space:normal;overflow-wrap:anywhere}
 .responsive-table td:before{content:attr(data-label);display:block;font-size:11px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--muted);margin-bottom:3px}
 .responsive-table td[data-cell=action]:before,.responsive-table td[data-cell=title]:before{display:none}
 .responsive-table td .subtext{white-space:normal;max-width:none!important;line-height:1.6;font-size:12px;margin-top:4px;overflow-wrap:anywhere}
 .responsive-table td[data-cell=title]{grid-column:1/-1;font-weight:650;font-size:16px;padding-bottom:9px;border-bottom:1px solid #edf0f3}
 .responsive-table td[data-cell=action]{grid-column:1/-1}
 .responsive-table .table-button{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:6px 13px;border:1px solid #dbe3ed;background:#f6f9fd;border-radius:7px;font-size:12px;font-weight:500}
 .responsive-table tfoot{margin-top:12px}
 .responsive-table tfoot tr{background:#f3f6fa;border-color:#cad6e4}
 .responsive-table tfoot td{background:none;font-weight:650}
 .responsive-table .tag{font-size:11px;padding:3px 6px;white-space:normal;max-width:100%;line-height:1.5}
 .responsive-table[data-kind=payment] tr,.responsive-table[data-kind=expense] tr{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px}
 .responsive-table[data-kind=payment] td[data-cell=date],.responsive-table[data-kind=expense] td[data-cell=date]{grid-column:1;grid-row:1;font-size:12px;color:var(--muted);align-self:center}
 .responsive-table[data-kind=payment] td[data-cell=type]{grid-column:2;grid-row:1;text-align:right;max-width:155px}
 .responsive-table[data-kind=payment] td[data-cell=name],.responsive-table[data-kind=expense] td[data-cell=name]{grid-column:1;grid-row:2;font-size:16px;line-height:1.45}
 .responsive-table[data-kind=payment] td[data-cell=amount],.responsive-table[data-kind=expense] td[data-cell=amount]{grid-column:2;grid-row:2;font-size:18px;font-weight:650;text-align:right;white-space:nowrap;align-self:start}
 .responsive-table[data-kind=payment] td[data-cell=meta],.responsive-table[data-kind=expense] td[data-cell=meta]{grid-row:3;font-size:13px}
 .responsive-table[data-kind=payment] td[data-cell=period]{grid-column:1/-1;grid-row:4;font-size:12px}
 .responsive-table[data-kind=payment] td[data-redundant=true]{display:none}
 .responsive-table[data-kind=payment] td[data-cell=action],.responsive-table[data-kind=expense] td[data-cell=action]{text-align:right;border-top:1px solid #edf0f3;padding-top:9px}
 .responsive-table[data-kind=payment] td[data-cell=date]:before,.responsive-table[data-kind=expense] td[data-cell=date]:before,.responsive-table[data-kind=payment] td[data-cell=type]:before,.responsive-table[data-kind=payment] td[data-cell=name]:before,.responsive-table[data-kind=expense] td[data-cell=name]:before,.responsive-table[data-kind=payment] td[data-cell=amount]:before,.responsive-table[data-kind=expense] td[data-cell=amount]:before{display:none}
 .responsive-table[data-kind=subscription] td[data-cell=name],.responsive-table[data-kind=person] td[data-cell=name]{grid-column:1;grid-row:1;font-size:16px;line-height:1.4}
 .responsive-table[data-kind=subscription] td[data-cell=amount],.responsive-table[data-kind=person] td[data-cell=amount]{grid-column:2;grid-row:1;font-size:18px;font-weight:650;text-align:right}
 .responsive-table[data-kind=subscription] td[data-cell=name]:before,.responsive-table[data-kind=person] td[data-cell=name]:before,.responsive-table[data-kind=subscription] td[data-cell=amount]:before,.responsive-table[data-kind=person] td[data-cell=amount]:before{display:none}
 .responsive-table[data-kind=subscription] td[data-cell=period]{grid-column:1/-1}
 .responsive-table[data-kind=subscription] td[data-cell=remaining]{align-self:center}
 .responsive-table[data-kind=subscription] td[data-cell=action],.responsive-table[data-kind=person] td[data-cell=action]{grid-column:2;text-align:right;align-self:end}
 .responsive-table[data-kind=person] td[data-cell=name] .subtext{font-size:11px}
 .panel-foot{display:grid;grid-template-columns:1fr;gap:12px;text-align:center;font-size:12px;padding-top:14px;margin-top:16px}
 .pager{justify-content:space-between;gap:12px}
 .pager button{min-width:48px;min-height:44px;font-size:18px;border-radius:8px}
 .report-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;overflow:visible;padding:4px;border:0;background:#e7ebf0;border-radius:10px;margin-bottom:18px}
 .report-tabs button{min-height:48px;font-size:11px;line-height:1.35;white-space:normal;padding:7px 3px;font-weight:600;border-radius:7px}
 .report-tabs button.active{background:#fff;color:#294e77;box-shadow:0 1px 3px #20252b15}
 .report-tools,.compare-controls,.people-period{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 8px;align-items:end;width:100%}
 .report-tools>label,.compare-controls>label,.people-period>label{min-width:0;width:100%;font-size:12px}
 .report-tools select,.report-tools label select{width:100%;min-width:0;padding:8px 5px;max-width:100%}
 .report-tools>select{grid-column:1/-1}
 .report-tools .table-button{display:inline-flex;align-items:center;padding:5px 0;font-size:13px}
 .subscription-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:0 0 16px;font-size:11px;line-height:1.4}
 .subscription-summary>span{min-width:0;background:#f5f7fa;border-radius:8px;padding:10px 8px}
 .subscription-summary strong{display:block;font-size:19px;margin:0 0 4px;overflow-wrap:anywhere;color:var(--ink)}
 .people-layout{display:block;margin:12px 0 0}
 .people-picker{display:none;margin-bottom:18px;padding:12px;background:#f6f8fa;border-radius:9px}
 .people-open .people-picker{display:block}
 #people-toggle{width:100%;text-align:left;font-size:13px;min-height:46px;padding:10px 12px}
 #people-toggle:after{content:'⌄';float:right}
 #people-done{width:100%;margin-top:12px;min-height:44px;font-size:14px}
 #person-options{max-height:240px;overscroll-behavior:contain}
 .person-choice{padding:11px 4px;min-height:46px;gap:10px;align-items:start;font-size:14px}
 .person-choice input{margin-top:0}
 .picker-heading{align-items:center;padding:4px 0}
 .picker-heading button{min-height:44px;font-size:13px;padding:6px}
 .people-results>.subscription-summary{padding-top:0;margin:0}
 .people-results>.subscription-summary>span:last-child{grid-column:1/-1;display:flex;gap:8px;align-items:baseline}
 .people-results>.subscription-summary{grid-template-columns:1fr 1fr}
 .people-results>.subscription-summary>span:last-child strong{font-size:25px;margin:0}
 .person-detail .panel-heading .quiet:empty{display:none}
 .help-note{margin-bottom:12px;font-size:12px}.help-note summary{min-height:40px;display:flex;align-items:center;gap:6px}.help-note summary:before{content:'ⓘ';font-size:14px}
 .person-detail{padding-top:20px;margin-top:20px;scroll-margin-top:78px}
 .settings-grid{display:block}
 .settings-row{gap:14px;line-height:1.5;padding:4px 0}
 .settings-row button{min-height:44px;padding:8px 10px;flex:none}
 .inline-form{min-width:0}.inline-form input{min-width:0}
 .settings-form{max-width:100%;gap:16px}.settings-form button{width:100%;justify-self:stretch}
 .settings-form select{white-space:normal}
 pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;max-width:100%}
 footer{margin:22px 0 0;font-size:11px}
 #toast{bottom:calc(86px + env(safe-area-inset-bottom));max-width:calc(100% - 32px);width:max-content;padding:12px 16px;font-size:13px;line-height:1.5}
 dialog{max-width:calc(100% - 24px);width:calc(100% - 24px);padding:20px;max-height:calc(100dvh - 32px);border-radius:14px;overscroll-behavior:contain}
 #entry-dialog,#aliases-dialog{inset:0;margin:0;width:100%;max-width:100%;height:100dvh;max-height:100dvh;border:0;border-radius:0;padding:0 18px;background:white;overflow-y:auto}
 #entry-dialog>form,#aliases-dialog>form{padding-bottom:env(safe-area-inset-bottom);min-height:100%;display:flex;flex-direction:column}
 .dialog-heading{gap:12px;align-items:center;margin-bottom:20px}
 .dialog-heading h2{font-size:20px;line-height:1.4}
 .icon-button{min-width:44px;min-height:44px;line-height:1;font-size:28px}
 #entry-dialog .dialog-heading,#aliases-dialog .dialog-heading{position:sticky;top:0;z-index:2;background:#fff;padding:calc(10px + env(safe-area-inset-top)) 0 10px;border-bottom:1px solid var(--border);margin-bottom:20px}
 .form-grid{grid-template-columns:minmax(0,1fr);gap:18px;min-width:0;flex:1}
 .form-grid>.full{grid-column:auto}
 .form-grid label{font-size:13px;gap:7px}
 .form-grid textarea{min-height:90px;resize:vertical}
 .form-grid .hint{line-height:1.55;font-size:12px}
 .quick-amounts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin-top:2px}
 .quick-amounts button{min-height:44px;padding:5px 3px;font-size:14px}
 .checkbox-label{align-items:start;line-height:1.55;padding:4px 0}
 .checkbox-label input{margin:0}
 .dialog-actions{gap:8px;flex-wrap:wrap;justify-content:stretch;margin-top:22px}
 .dialog-actions .spacer{display:none}
 .dialog-actions button{flex:1;min-height:46px;font-size:14px;padding:10px 12px}
 #entry-dialog .dialog-actions,#aliases-dialog .dialog-actions{position:sticky;bottom:0;z-index:2;background:white;border-top:1px solid var(--border);padding:12px 0 calc(12px + env(safe-area-inset-bottom));margin-top:24px;flex-wrap:nowrap}
 #delete-entry{flex:0 1 auto;font-size:12px;border:0;padding:8px}
 #aliases-dialog .dialog-actions .primary{width:auto;flex:2;font-size:13px}
 #aliases-dialog .dialog-actions .secondary{flex:1;font-size:13px}
 #aliases-list{max-height:32dvh;min-height:150px;overscroll-behavior:contain;padding:4px 10px}
 .alias-choice{min-height:48px;gap:10px;padding:12px 0}
 .alias-choice>span{min-width:0;overflow-wrap:anywhere}
 #alias-summary{font-size:12px;line-height:1.6}
 #menu-dialog{margin:auto auto calc(82px + env(safe-area-inset-bottom));width:calc(100% - 24px);max-height:calc(100dvh - 106px - env(safe-area-inset-bottom));padding:18px}
 #menu-dialog .dialog-heading{margin-bottom:12px}
 #menu-links{gap:2px}
 #menu-links button{min-height:46px;padding:9px 10px;border-radius:8px;font-size:14px}
 #menu-links button span{font-size:14px;color:inherit}
 #menu-links button.active{background:#edf3fa;color:#294e77}
 #menu-links button>span:last-child{font-size:21px;color:#8a939d}
 .menu-account{padding-top:12px;margin-top:12px}.menu-account p{font-size:12px;margin-bottom:10px}
 .menu-account>div>button{flex:1;min-height:44px;font-size:12px;padding:9px}
 .login-shell{min-height:100dvh;padding:24px 16px}
 .login-card{padding:28px 24px;border-radius:14px}.login-card .wordmark{font-size:28px}
 .login-card>.primary{min-height:48px}
}
@media(max-width:359px){
 main{padding-left:12px;padding-right:12px}.panel{padding:16px 12px}
 .stat{padding:12px 10px}.stat-value{font-size:21px}
 .responsive-table tr{padding:12px;gap:10px}
 .responsive-table[data-kind=payment] tr,.responsive-table[data-kind=expense] tr{grid-template-columns:minmax(0,1fr) auto;gap:9px}
 .responsive-table[data-kind=payment] td[data-cell=amount],.responsive-table[data-kind=expense] td[data-cell=amount]{font-size:16px}
 .responsive-table[data-kind=payment] td[data-cell=type]{max-width:135px}
 .responsive-table[data-kind=payment] td[data-cell=name],.responsive-table[data-kind=expense] td[data-cell=name]{font-size:14px}
 #period-summary{font-size:10px}.date-toggle{font-size:10px}
 .report-tabs button{font-size:10px}
 #entry-dialog,#aliases-dialog{padding-left:14px;padding-right:14px}
 .report-tools:has(#subscription-date){grid-template-columns:minmax(0,1fr)}
 .filter-options{grid-template-columns:minmax(0,1fr)}
 .compare-controls>label:has(#compare-month),.compare-controls>label:has(#compare-metric),.people-period>label:has(input[type=date]){grid-column:1/-1}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.chart-readout{transition:none}}

/* A payment date and a paid coverage period are independent. */
.activity-filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:20px 0}
.activity-since{margin:0 0 20px}
.activity-panel h3{margin-bottom:8px}
.activity-panel .table-wrap{margin-top:14px}
.activity-history-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:30px}
.activity-history-heading .muted{font-size:12px}
.activity-summary{white-space:normal;min-width:180px;overflow-wrap:anywhere}
.activity-more{margin-top:18px}
@media(max-width:759px){.activity-filters{grid-template-columns:minmax(0,1fr);gap:14px}.activity-summary{min-width:0}.activity-more{width:100%;min-height:44px}.activity-panel .table-wrap{margin-top:14px}}
.subscription-status{display:inline-block;font-size:11px;font-weight:600;line-height:1.4;padding:3px 7px;border-radius:5px;white-space:nowrap}
.subscription-status.future{color:#7b5118;background:#fff3db}
.subscription-status.active{color:#236348;background:#e9f5ee}
.subscription-status.paused{color:#674093;background:#f0eafa}
.subscription-status.expired{color:#626b76;background:#edf0f3}
.subscription-summary.subscription-counts-managed{grid-template-columns:repeat(4,minmax(0,1fr));max-width:640px}
.subscription-counts>.paused-summary{color:#674093;background:#f6f1fc;border-color:#e5d9f3}
.subscription-counts>.paused-summary strong{color:inherit}
.entry-actions{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.subscription-current{padding:14px 16px;background:#f5f7fa;border-radius:8px;margin:0 0 20px}
.subscription-current>span+span{margin-left:8px;font-size:13px}
.subscription-current p{margin:10px 0 0}
#subscription-person{font-size:17px;overflow-wrap:anywhere}
#subscription-action-hint{margin:12px 0 18px;line-height:1.6}
#subscription-preview{margin:18px 0 0}
#subscription-pause-history{margin-top:20px;font-size:13px}
#subscription-pause-history summary{cursor:pointer;padding:6px 0}
#subscription-pause-history li{padding:5px 0}
#toggle-expired-subscriptions{margin-bottom:16px}
@media(max-width:759px){
 .subscription-summary.subscription-counts-managed{grid-template-columns:repeat(2,minmax(0,1fr))}
 .entry-actions{align-items:flex-end;gap:4px}
 #subscription-dialog{max-width:calc(100% - 24px);width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:18px 14px}
 #subscription-dialog .dialog-heading{align-items:flex-start;margin-bottom:14px}
 #subscription-dialog .dialog-heading h2{font-size:18px;line-height:1.4}
 #subscription-dialog .dialog-actions{position:sticky;bottom:-18px;background:#fff;padding:12px 0;margin-top:16px}
 #subscription-dialog .dialog-actions button{min-width:0;font-size:12px;white-space:normal}
 #subscription-dialog select{font-size:14px;padding-left:8px;padding-right:6px}
 #subscription-dialog .notice,#subscription-current .hint{font-size:12px;line-height:1.5}
}
.subscription-section{margin-top:24px}
.subscription-section h3{font-size:15px;font-weight:650;margin:0 0 14px}
.subscription-section h3>span{color:var(--muted);font-size:13px;font-weight:400;margin-left:5px}
.subscription-section>.panel-heading h3{margin:0}
.future-section{border-top:1px solid var(--border);padding-top:22px}
.future-section>.panel-heading{margin-bottom:14px}
.future-section>.panel-heading>.muted{font-size:13px}
.subscription-counts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;max-width:540px;padding:0 0 18px;font-size:13px;line-height:1.4}
.subscription-counts>span{min-width:0;padding:14px 16px;background:#f5f7fa;border:1px solid #e9edf2;border-radius:8px}
.subscription-counts strong{display:block;margin:0 0 4px;font-size:23px;line-height:1.2}
.subscription-counts>.future-summary{background:#fff8eb;border-color:#f4e6ca;color:#7b5118}
.subscription-counts>.future-summary strong{color:inherit}
.payment-tags{display:inline-flex;flex-direction:column;align-items:flex-start;gap:6px;max-width:100%;vertical-align:middle}
.payment-tags>.tag,.payment-tags>.subscription-status{box-sizing:border-box;display:inline-flex;align-items:center;min-height:27px;padding:4px 8px;border:1px solid transparent;border-radius:5px;font-size:12px;font-weight:500;line-height:1.4}
.payment-tags>.type-single{border-color:#c9dcf4}
.payment-tags>.type-month{border-color:#c2e3d0}
.payment-tags>.type-subscription{border-color:#dcd0ed}
.payment-tags>.future{border-color:#f4e6ca}
.later-payments{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.later-payments button{flex-shrink:0}
@media(max-width:759px){
 .subscription-section{margin-top:18px}
 .subscription-section h3{font-size:15px}
 .future-section>.panel-heading{gap:6px}
 .subscription-counts{gap:8px;font-size:11px;padding-bottom:16px}
 .subscription-counts>span{padding:10px 8px}
 .subscription-counts strong{font-size:20px}
 .payment-tags{align-items:flex-end}
 .responsive-table .payment-tags>.tag,.responsive-table .payment-tags>.subscription-status{min-height:26px;padding:4px 6px;font-size:11px;line-height:1.4}
 .later-payments{font-size:12px;line-height:1.5}
 .later-payments button{min-height:44px}
 input[type=month]{min-width:0;max-width:100%;width:100%;font-size:16px;min-height:44px}
}
.investor-badge{display:block;width:fit-content;margin-top:4px;font-size:11px;line-height:1.5;font-weight:500;color:#806127;background:#faf5e9;border-radius:4px;padding:1px 6px}
.auto-badge,.auto-hint{display:inline-block;max-width:180px;white-space:normal;text-align:left;font-size:12px;line-height:1.45;border-radius:5px;padding:4px 7px;color:#356451;background:#edf6f0;border:1px solid #d6e8db;overflow-wrap:anywhere}
.auto-badge{cursor:pointer}.auto-badge:hover{background:#dfeee4}.auto-hint{color:#49647c;background:#eff4f8;border-color:#dbe5ef}
.investor-field .checkbox-label{margin-bottom:5px}.investor-field .hint{display:block}
#automatic-dialog{width:min(540px,calc(100vw - 24px));padding:24px;box-sizing:border-box}.automatic-person{font-weight:600}.automatic-sources{list-style:none;margin:18px 0;padding:0}.automatic-sources li{display:flex;gap:12px;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line,#e4e7eb)}.automatic-sources strong{white-space:nowrap}.automatic-sources div{min-width:0;overflow-wrap:anywhere}
@media(max-width:600px){.auto-badge,.auto-hint{max-width:100%;font-size:11px}#automatic-dialog{padding:16px}.investor-field .hint{font-size:12px}}
/* Compact mobile ledger cards: identity, badges, coverage, then useful footer. */
.mobile-card-badges{display:none}
@media(max-width:759px){
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) tbody{gap:8px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) tr{grid-template-columns:minmax(0,1fr) auto auto;gap:6px 10px;padding:11px 12px;border-radius:9px;align-items:center}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=name]{grid-column:1/3;grid-row:1;font-size:15px;line-height:1.35}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=amount]{grid-column:3;grid-row:1;font-size:17px;line-height:1.35;align-self:start;white-space:nowrap}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=type]{grid-column:1/-1;grid-row:2;max-width:none;text-align:left}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=type]:before{display:none}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .payment-tags{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .payment-tags>.tag,.responsive-table:is([data-kind=payment],[data-kind=subscription]) .subscription-status{min-height:0;padding:2px 6px;font-size:11px;line-height:1.45}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .mobile-card-badges{display:contents}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=name]>.investor-badge,.responsive-table[data-kind=subscription] .desktop-status{display:none}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .investor-badge{display:inline-block;margin:0;font-size:10px;padding:2px 5px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .auto-badge{padding:3px 6px;font-size:11px;min-height:30px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .auto-hint{max-width:100%;padding:3px 6px;font-size:11px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td .subtext{font-size:11px;line-height:1.4;margin-top:2px}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=period]{grid-column:1/-1;font-size:12px;line-height:1.45}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) td[data-cell=period]:before{display:inline;margin:0 5px 0 0;content:'Дія:'}
 .responsive-table[data-kind=payment] td[data-cell=meta]{grid-row:3;font-size:12px;line-height:1.45}
 .responsive-table[data-kind=payment] td[data-cell=meta]:before{display:none}
 .responsive-table[data-kind=payment] td[data-cell=meta][data-label='Отримувач']{grid-column:1/3}
 .responsive-table[data-kind=payment] td[data-cell=meta][data-label='Спосіб']{grid-column:3;text-align:right}
 .responsive-table[data-kind=payment] td[data-cell=period]{grid-row:4}
 .responsive-table[data-kind=payment] td[data-cell=date]{grid-row:5;grid-column:1/3;font-size:11px;line-height:1.4}
 .responsive-table[data-kind=payment] td[data-cell=date]:before{display:inline;content:'Оплата ';font-size:11px;margin:0}
 .responsive-table[data-kind=payment] td[data-cell=action]{grid-row:5;grid-column:3;border:0;padding:0}
 .responsive-table[data-kind=subscription] td[data-cell=period]{grid-row:3}
 .responsive-table[data-kind=subscription] td[data-cell=date]{grid-row:4;grid-column:1;font-size:11px;line-height:1.4}
 .responsive-table[data-kind=subscription] td[data-cell=date]:before{content:'Оплата';font-size:10px;margin:0 0 2px}
 .responsive-table[data-kind=subscription] td[data-cell=remaining]{grid-row:4;grid-column:2;font-size:12px;line-height:1.4}
 .responsive-table[data-kind=subscription] td[data-cell=remaining]:before{font-size:10px;margin:0 0 2px}
 .responsive-table[data-kind=subscription] td[data-cell=action]{grid-row:4;grid-column:3;align-self:center}
 .responsive-table:is([data-kind=payment],[data-kind=subscription]) .table-button{min-height:40px;padding:5px 8px;font-size:11px}
 .responsive-table[data-kind=payment] .entry-actions{flex-direction:row;flex-wrap:wrap;justify-content:flex-end;gap:4px}
 .responsive-table[data-kind=payment] td[data-cell=action]:has(.entry-actions>button:nth-child(2)){grid-column:1/-1;grid-row:6}
 .responsive-table[data-kind=payment] tr:has(.entry-actions>button:nth-child(2)) td[data-cell=date]{grid-column:1/-1}
}
.type-event{color:#785420;background:#fff3df;border:1px solid #ead7b8}.tariff-start{display:block;max-width:350px;margin:16px 0}.tariff-start input{display:block;width:100%;margin-top:6px}.tariff-months{border:1px solid var(--border);border-radius:8px;padding:14px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:18px 0}.tariff-months label{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer}.tariff-months input{flex:none}.tariff-prices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;max-width:700px}.tariff-prices label{display:flex;flex-direction:column;gap:6px;font-size:13px;min-width:0}.tariff-prices input{width:100%;min-width:0}#tariff-form>.hint{margin:12px 0}
@media(max-width:759px){.tariff-months{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px;padding:10px}.tariff-months label{min-height:40px}.tariff-prices{grid-template-columns:minmax(0,1fr)}#tariff-form>.primary{width:100%;min-height:44px}.tariff-months legend{font-size:13px}.tariff-start{font-size:13px}}
.profile-link{color:inherit;text-decoration:underline;text-decoration-color:#a9bac9;text-underline-offset:3px;border-radius:2px}.profile-link:hover{color:#315e85;text-decoration-color:currentColor}.profile-link:focus-visible{outline:2px solid #3978af;outline-offset:3px}
