/* Shared components for every page family. Geometry and behavior remain in the existing modules. */
body {
    background: var(--tf-bg);
    color: var(--tf-text-primary);
    font-family: var(--tf-font-ui);
    font-size: var(--tf-font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
html[lang="bn"] body { font-family: var(--tf-font-bangla); line-height: 1.75; }
html[lang="bn"] :is(h1,h2,h3,small,label,.nav-label,.page-kicker,.standing-label) { letter-spacing: normal; text-transform: none; }
button,input,select,textarea { font: inherit; }
a { text-underline-offset: .2em; }
:is(button,a,input,select,textarea,summary,[tabindex="0"]):focus-visible {
    outline: 3px solid var(--tf-focus);
    outline-offset: 3px;
}
.table-scroll:focus-visible { outline-offset: -3px; }
.tf-skip { position: fixed; z-index: 500; inset: 8px auto auto 16px; transform: translateY(-200%); padding: 12px 18px; background: var(--tf-surface); color: var(--tf-text-primary); border: 2px solid var(--tf-focus); border-radius: var(--tf-radius-control); }
.tf-skip:focus { transform: none; }
.ambient { display: none; }
:where(h1,h2,h3,p,dl,ul,form,section,article,nav) { min-width: 0; }
h1,h2,h3 { color: var(--tf-text-primary); font-weight: 700; line-height: 1.3; }
:where(.workspace-card,.dash-card,.record-card,.summary-stat,.card,.panel,.audit-event,.glass,.entry-preview,.review-alert) {
    background: var(--tf-surface);
    border: 1px solid var(--tf-border);
    border-radius: var(--tf-radius-card);
    box-shadow: var(--tf-shadow-card);
}
body :is(.workspace-card,.dash-card,.record-card,.summary-stat,.card,.panel,.audit-event,.glass,.finance-modal-sheet) {
    background: var(--tf-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: var(--tf-shadow-card);
    border-color: var(--tf-border);
    animation: none;
}
body :is(.workspace-card,.dash-card) { padding: var(--tf-card-padding); }
.workspace-card { margin-bottom: var(--tf-space-4); }
.workspace-card h2,.dash-section-title { font-size: var(--tf-font-section); font-weight: 700; line-height: 1.4; }
.workspace-card h3 { font-size: 17px; }
body .workspace-card :is(p,label),.finance-entry-form label { font-size: inherit; }
.workspace-card p,.dash-section-subtitle,.due-meta,.activity-meta { line-height: 1.65; }
.muted,.workspace-card small,.dash-section-subtitle,.standing-metric small { color: var(--tf-text-secondary); }
body :is(.muted,small,.feature-description,.standing-metric small,.activity-meta,.account-type) { font-size: var(--tf-font-caption); }
.workspace-grid,.form-grid,.dash-grid { gap: var(--tf-space-5); }
.record-card,.summary-stat { padding: var(--tf-space-5); }
.record-card { box-shadow: none; }
.large-money,.finance-balance,[data-money],.amount-chip,.finance-table,.summary-stat strong,.detail-grid dd { font-variant-numeric: tabular-nums; }
.large-money,.summary-stat strong { font-size: clamp(22px,2.5vw,30px); line-height: 1.35; letter-spacing: -.025em; }
body .summary-stat strong,body .detail-grid dd.large-money { overflow-wrap: normal; word-break: normal; white-space: nowrap; }
.detail-grid>div,.summary-stat,.record-card { min-width: 0; container-type: inline-size; }
.detail-grid dt { color: var(--tf-text-secondary); font-size: 13px; margin-bottom: 5px; }
.detail-grid dd { margin-inline: 0; white-space: normal; overflow-wrap: anywhere; }
@supports(font-size:1cqi) {
    .summary-stat strong,.detail-grid .large-money { font-size: clamp(14px,5.5cqi,28px); }
}
/* Navigation and orientation layers. Solid fallback is declared first. */
body .sidebar,body .topbar,.mobile-bottom-nav,body .settings-index {
    background: var(--tf-surface);
    border: 1px solid var(--tf-border);
    box-shadow: var(--tf-shadow-float);
}
body .sidebar { inset: 16px auto 16px 16px; width: 232px; border-radius: var(--tf-radius-card); padding: 18px 12px; z-index: var(--tf-z-navigation); }
.main-content { margin-left: 264px; padding: var(--tf-space-6) var(--tf-space-6) 56px; }
.page-content,.topbar { max-width: 1480px; }
body .topbar { padding: var(--tf-space-4); border-radius: var(--tf-radius-card); margin-bottom: var(--tf-space-5); gap: var(--tf-space-4); }
.topbar h1 { font-size: var(--tf-font-page); letter-spacing: -.035em; line-height: 1.3; overflow-wrap: anywhere; }
.topbar p { font-size: 13px; line-height: 1.6; max-width: 62ch; }
.page-kicker,.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--tf-text-secondary); }
.nav-label { margin-top: 12px; padding: 10px 14px 6px; }
.side-nav { gap: 4px; }
body .side-nav a,.sidebar-footer>a { min-height: var(--tf-control-size); padding: 9px 12px; font-size: var(--tf-font-label); line-height: 1.5; color: var(--tf-text-secondary); border-radius: var(--tf-radius-control); }
body :is(.side-nav a,.sidebar-footer>a,.mobile-bottom-nav a)>.ui-icon { width: var(--tf-icon-size); height: var(--tf-icon-size); flex-shrink: 0; }
.side-nav a:hover { background: var(--tf-surface-muted); color: var(--tf-text-primary); transform: none; }
body .side-nav a.active,body .sidebar a.active { background: var(--tf-selected)!important; color: var(--tf-success)!important; border: 1px solid var(--tf-border)!important; border-inline-start: 3px solid var(--tf-success)!important; box-shadow: none; font-weight: 700; }
.brand.tf-brand { display: block; padding: 14px 12px var(--tf-space-1); }
.tf-wordmark { display: block; width: 180px; max-width: 100%; height: auto; }
.tf-symbol { display: none; width: 32px; height: 34px; object-fit: contain; }
.tf-wordmark img { display: block; width: 100%; height: auto; }
.tf-wordmark .tf-logo-white { display: none; }
html[data-theme="dark"] .tf-wordmark .tf-logo-colour { display: none; }
html[data-theme="dark"] .tf-wordmark .tf-logo-white { display: block; }
.tf-profile-symbol { background: var(--tf-surface-muted); }
.tf-mobile-brand { display: none; }
.sidebar-footer { margin-top: 20px; }
.sidebar-footer small { font-size: 12px; }
.global-search { min-width: 0; }
.topbar-actions { gap: 8px; }
.global-search input { width: 100%; min-height: var(--tf-control-size); padding: 0 var(--tf-space-3); font-size: var(--tf-font-label); background: var(--tf-surface); border-color: var(--tf-control-border); }
.theme-switcher { border-radius: 14px; background: var(--tf-surface); border-color: var(--tf-border); }
.theme-switcher button { width: var(--tf-control-size); min-width: var(--tf-control-size); min-height: var(--tf-control-size); }
body .theme-switcher button.active { color: var(--tf-action-text); background: var(--tf-action); }
.language-switch select { border-color: var(--tf-border); font-size: 14px; min-height: 46px; }
/* Inputs, actions and transient states. */
body :is(.btn,.quick-shortcuts button,.sort-step),body.auth-page button { min-height: var(--tf-control-size); border-radius: var(--tf-radius-control); font-size: var(--tf-font-label); font-weight: 650; line-height: 1.4; padding: 9px 14px; gap: var(--tf-space-2); }
.btn { white-space: normal; text-align: center; text-decoration: none; border: 1px solid var(--tf-control-border); background: var(--tf-surface); color: var(--tf-text-primary); }
body .btn-primary,body .quick-add-floating,body .mobile-add,body.auth-page :is(.submit,button:not(.secondary)) { color: var(--tf-action-text); background: var(--tf-action); border-color: transparent; box-shadow: none; }
html[data-theme] body .btn-primary,html[data-theme] body :is(.quick-add-floating,.mobile-add),html[data-theme] body .theme-switcher button.active { background: var(--tf-action); color: var(--tf-action-text); }
body .btn-secondary,body.auth-page button.secondary { background: var(--tf-surface-muted); border: 1px solid var(--tf-control-border); color: var(--tf-text-primary); }
body .btn-danger { color: var(--tf-danger); background: color-mix(in srgb,var(--tf-danger) 8%,var(--tf-surface)); border: 1px solid var(--tf-danger); }
button:disabled,.btn[aria-disabled="true"],input:disabled,select:disabled { opacity: .6; cursor: not-allowed; }
body :is(.workspace-card,.finance-entry-form,.auth-card,.box) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea) {
    width: 100%; max-width: 100%; min-width: 0; min-height: var(--tf-control-size); padding: 9px 12px; margin: 6px 0 12px; font-size: max(15px, 1em); line-height: 1.55; color: var(--tf-text-primary); background: var(--liquid-input, var(--tf-surface))!important; border: 1px solid var(--tf-control-border); border-radius: var(--tf-radius-control); box-shadow: none;
}
label { line-height: 1.6; }
input::placeholder,textarea::placeholder { color: var(--tf-text-secondary); opacity: 1; }
input[type="checkbox"],input[type="radio"] { accent-color: var(--tf-action); }
body select option,body select optgroup { background: var(--tf-surface)!important; color: var(--tf-text-primary)!important; }
body :is(.form-actions,.entry-actions) { display: flex; flex-wrap: wrap; gap: 10px; }
.section-tabs,.ledger-presets { padding: 4px; gap: 8px; }
.section-tabs a,.ledger-presets a { padding: 10px 14px; min-height: 44px; border-radius: 12px; line-height: 1.5; }
.feature-group,.preference-group { padding: 16px; border-radius: 16px; background: var(--tf-surface-muted); }
.preference-group>summary { font-size: 15px; min-height: 44px; }
.settings-index a { font-size: 14px; padding: 12px; }
.settings-index a[aria-current="page"],.section-tabs a[aria-current="page"] { background: var(--tf-selected); color: var(--tf-success); }
.feature-toggle { border-radius: 14px; }
.toggle-track { background: var(--tf-control-border); }
.feature-toggle input:checked+.toggle-track { background: var(--tf-action); }
.feature-toggle input:checked+.toggle-track::after { background: var(--tf-action-text); }
.appearance-save-status { background: var(--tf-surface-muted); }

/* Settings remain spacious even when both navigation columns are visible. */
.settings-shell { gap: 24px; align-items: start; }
.settings-content { min-width: 0; container: tf-settings / inline-size; }
body .settings-index { padding: 8px; border-radius: 18px; max-height: calc(100dvh - 48px); overflow-y: auto; }
.settings-index a { display: flex; align-items: center; gap: 10px; min-height: 48px; white-space: normal; line-height: 1.5; }
.settings-index a .ui-icon { flex: 0 0 20px; width: 20px; height: 20px; }
.settings-index a span { min-width: 0; overflow-wrap: anywhere; }
.settings-content .workspace-card { margin-bottom: 24px; }
.settings-content .preference-group { margin-top: 16px; padding: 16px; border: 1px solid var(--tf-border); }
.settings-content .preference-group>summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; margin: 0; padding: 4px 0; }
.settings-content .preference-group>summary::-webkit-details-marker { display: none; }
.settings-content .preference-group>summary::after { content: '+'; flex: 0 0 24px; font-size: 22px; line-height: 1; color: var(--tf-text-secondary); text-align: center; }
.settings-content .preference-group[open]>summary { margin-bottom: 18px; }
.settings-content .preference-group[open]>summary::after { content: '−'; }
.settings-content :is(form,.form-grid,.setting-checks,.feature-toggle,.feature-toggle>span:last-child) { min-width: 0; }
.settings-content .feature-toggle { align-items: flex-start; }
.settings-content .feature-toggle strong { display: block; line-height: 1.5; overflow-wrap: anywhere; }
.settings-content .feature-description { display: block; margin-top: 6px; line-height: 1.65; overflow-wrap: anywhere; }
.settings-content textarea { min-height: 108px; resize: vertical; }
.profile-photo-layout { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.profile-photo-layout form { flex: 1 1 220px; }
.settings-profile-photo { flex: 0 0 88px; width: 88px; height: 88px; border-radius: 20px; object-fit: cover; border: 1px solid var(--tf-border); }
.settings-profile-form { margin-top: 24px; }
.backup-status-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-block: 20px; }
.backup-status-grid>div { padding: 16px; background: var(--tf-surface-muted); border: 1px solid var(--tf-border); border-radius: 14px; min-width: 0; }
.backup-status-grid p { margin-bottom: 0; font-weight: 650; }
.settings-subsection { padding-top: 20px; border-top: 1px solid var(--tf-border); }
.settings-check { display: flex!important; align-items: flex-start; gap: 10px; margin: 20px 0; }
.settings-check input[type="checkbox"] { flex: 0 0 20px; width: 20px; height: 20px; margin: 3px 0 0; }
.settings-restore>summary { color: var(--tf-danger); }
@container tf-settings (max-width:620px) {
    .settings-content :is(.form-grid,.setting-checks,.backup-status-grid) { grid-template-columns: minmax(0,1fr); }
}
@media(min-width:821px) and (max-width:1200px) {
    .settings-shell { grid-template-columns: minmax(0,1fr); gap: 20px; }
    body .settings-index { position: static; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); max-height: none; }
}
@media(max-width:820px) {
    body .settings-index { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); white-space: normal; overflow: visible; max-height: none; }
    .settings-index a { padding: 10px; font-size: 13px; }
    .settings-index a:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .settings-content .preference-group { padding: 14px; }
    .settings-content .form-actions>.btn,.settings-content .form-actions>form { flex: 1 1 180px; }
    .settings-content .form-actions>form>.btn { width: 100%; }
}
details>summary { cursor: pointer; line-height: 1.6; }
.finance-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.finance-table th { color: var(--tf-text-secondary); background: var(--tf-surface-muted); font-size: 12px; font-weight: 650; padding: 14px; line-height: 1.5; }
.finance-table td { padding: 16px 14px; line-height: 1.6; border-color: var(--tf-border); }
.finance-table :is(.number,.amount-cell),.ledger-table :is(th,td):nth-child(6) { text-align: end; }
.finance-table td.number>[data-money] { white-space: nowrap; }
.finance-table tbody tr:hover { background: var(--tf-surface-muted); }
.table-scroll { max-width: 100%; border: 1px solid var(--tf-border); border-radius: var(--tf-radius-control); background: var(--tf-surface); }
.amount-chip { white-space: nowrap; letter-spacing: 0; }
.badge,.account-type { padding: 4px 10px; background: var(--tf-surface-muted); border: 1px solid var(--tf-border); border-radius: 999px; font-size: 12px; }
.notice,.alert,.review-alert { padding: 16px 18px; border-radius: 16px; background: var(--tf-surface-muted); border: 1px solid var(--tf-border); line-height: 1.65; }
.danger-zone,.alert-danger,.errors,.err { color: var(--tf-danger); border-color: var(--tf-danger); background: color-mix(in srgb,var(--tf-danger) 7%,var(--tf-surface)); }
.required-star,.required { color: var(--tf-danger); }
.tf-field-error { display: block; margin: 0 0 var(--tf-space-2); }
body :is(.workspace-card,.finance-entry-form,.finance-modal,.record-create-dialog) .tf-field-error { color: var(--tf-danger); }
.tf-validation-summary,.finance-entry-form .form-errors:not(:empty) {
    color: var(--tf-danger);
    background: color-mix(in srgb, var(--tf-danger) 7%, var(--tf-surface));
    border: 1px solid var(--tf-danger);
    border-radius: var(--tf-radius-control);
    padding: var(--tf-space-3) var(--tf-space-4);
    margin-block: 0 var(--tf-space-4);
}
body .tf-validation-summary a { color: inherit; }
.tf-validation-summary ul { margin-block: var(--tf-space-1) 0; }
body :is(input,select,textarea)[aria-invalid="true"] { border-color: var(--tf-danger); }
.tf-validation-summary:focus-visible,.finance-entry-form .form-errors:focus-visible { outline: 3px solid var(--tf-focus); outline-offset: 2px; }
.review-alert-urgent { border-inline-start: 4px solid var(--tf-danger); }
.review-alert.tf-alert-backup { border-inline-start-color: var(--tf-warning); }
.review-alert strong { font-size: 15px; }
.review-alert span { font-size: 13px; }
.archive-section { border-top: 1px solid var(--tf-border); padding-top: 20px; }
.finance-modal { z-index: var(--tf-z-dialog); }
.finance-modal-header { padding: 20px 24px; border-bottom: 1px solid var(--tf-border); }
.finance-modal-body { padding: 24px; }
.finance-modal-header h2 { font-size: 22px; }
.finance-modal-close { min-width: 44px; min-height: 44px; color: var(--tf-text-secondary); }
.finance-toast { z-index: var(--tf-z-toast); background: var(--tf-surface); color: var(--tf-text-primary); border: 1px solid var(--tf-success); border-radius: 16px; box-shadow: var(--tf-shadow-float); }
.finance-toast-icon { background: var(--tf-selected); color: var(--tf-success); }
.auth-page .finance-toast { background: var(--tf-surface); color: var(--tf-text-primary); border-color: var(--tf-success); box-shadow: var(--tf-shadow-float); }
.auth-page .finance-toast button { width: auto; min-width: 44px; background: transparent!important; color: var(--tf-text-primary)!important; }
/* Data-first Dashboard. No formulas or values are changed by this layer. */
.dashboard-quick-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.dashboard-quick-tools .quick-shortcuts { flex: 1 1 360px; gap: 12px; padding: 0; margin: 0; border: 0; }
body .dashboard-calculator { min-width: 0; }
.dashboard-calculator .calculator-body { margin-block-start: var(--tf-space-3); }
.calculator-body:focus-visible { outline: 2px solid var(--tf-action); outline-offset: 4px; }
.dashboard-main-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: var(--tf-space-4); align-items: stretch; }
.dashboard-main-charts:has(> [hidden], > :only-child) { grid-template-columns: minmax(0, 1fr); }
.dashboard-feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 196px), 1fr)); gap: var(--tf-space-3); }
.dashboard-feature-card { display: flex; flex-direction: column; gap: var(--tf-space-2); color: var(--tf-text-primary); text-decoration: none; }
.dashboard-feature-card:hover { border-color: var(--tf-action); }
.dashboard-feature-card small { color: var(--tf-text-secondary); }
.dashboard-feature-card strong { overflow-wrap: anywhere; }
.dashboard-more-features { margin-block-start: var(--tf-space-3); }
.dashboard .account-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.dashboard [data-dashboard-widget="cards"]:has(> :only-child),
.dashboard [data-dashboard-widget="cards"]:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }
.record-icon-label { display: inline-flex; align-items: center; gap: var(--tf-space-2); }
.record-icon-label > .ui-icon { width: 1rem; height: 1rem; }
.settings-profile-heading { margin-block-end: var(--tf-space-3); }
.settings-profile-heading h2 { margin: 0; }
.settings-profile-heading span { overflow-wrap: anywhere; }
.settings-content .appearance-advanced { margin-block-start: var(--tf-space-4); }
.record-disclosure-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--tf-space-2); align-items: start; }
.record-disclosure { min-width: 0; margin: 0; padding: 0; border: 0; }
.record-disclosure > summary { min-height: var(--tf-control-size); overflow-wrap: anywhere; }
.record-disclosure > summary .record-preview { display: block; font-variant-numeric: tabular-nums; }
.record-disclosure > summary > strong { display: block; font-variant-numeric: tabular-nums; }
.record-disclosure-layout:has(.record-disclosure[open]) { grid-template-columns: minmax(0, 1fr); }
.record-disclosure-layout:has(.record-disclosure[open]) > .record-sort-arrows { grid-row: 1; justify-self: end; }
.record-disclosure-content { padding-block-start: var(--tf-space-2); }
.topbar h1 .ui-icon { width: .8em; height: .8em; }
.backup-command { white-space: pre-wrap; overflow-wrap: anywhere; }
.due-agreement { padding-block: var(--tf-space-3); border-block-start: 1px solid var(--tf-border); }
.due-contact-history { padding-inline-start: var(--tf-space-4); }
.due-contact-history li { padding-block: var(--tf-space-1); }
.provider-feedback-message { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 820px) {
    .dashboard-main-charts { grid-template-columns: minmax(0, 1fr); }
}
/* Everyday tasks stay visible; additional tools remain available on demand. */
.quick-shortcuts:not(.quick-shortcuts-expanded)>[data-record-id]:nth-of-type(n+3) { display: none; }
body .quick-shortcuts .shortcut-more { background: transparent; border-style: dashed; }
.transaction-search { margin: 20px 0 16px; }
.transaction-search>label { display: block; margin-bottom: 8px; font-weight: 650; }
.transaction-search-controls { display: flex; align-items: stretch; gap: 12px; }
.transaction-search-controls input { flex: 1; min-width: 0; margin: 0; }
.appearance-advanced { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--tf-border); }
.appearance-advanced>summary { font-size: 16px; font-weight: 700; min-height: 44px; }
.notification-groups { display: grid; gap: 20px; }
.notification-group { scroll-margin-top: 24px; }
.notification-group h3 { margin: 0 0 12px; }
.auth-policy-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 20px; font-size: 13px; margin-top: 20px; }
.auth-language a[aria-current="true"] { color: var(--tf-text-primary); font-weight: 700; text-underline-offset: 4px; }
.public-policy { box-sizing: border-box; width: min(760px,calc(100% - 32px)); margin: 24px auto; padding: 28px; background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: var(--tf-radius-card); }
.public-policy h2 { margin-top: 24px; }
.dashboard { gap: 20px; }
body .dashboard .financial-standing.standing-split { padding: 0; border: 0; background: none; box-shadow: none; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 20px; overflow: visible; }
body .standing-split .standing-spendable-hero { border-radius: var(--tf-radius-card); border: 1px solid var(--tf-brand-primary); background: var(--tf-brand-dark); color: white; padding: 28px; gap: 16px; box-shadow: var(--tf-shadow-card); }
body .standing-split .standing-spendable-hero>span,body .standing-split .standing-spendable-hero>strong { color: white; }
body .standing-split .standing-spendable-hero>span { font-size: 14px!important; }
body .standing-split .standing-spendable-hero>strong { font-size: clamp(28px,3.4vw,44px); line-height: 1.25; letter-spacing: -.035em; white-space: nowrap; }
body .standing-split .standing-spendable-hero>small,body .standing-split .standing-spendable-hero .reservation-summary { color: #d5eee2; }
body .standing-spendable-hero .balance-toggle { color: white; border-color: #91b4a5; background: transparent; min-height: 44px; }
body .standing-split .standing-compact-grid { gap: 14px; grid-template-columns: repeat(2,minmax(0,1fr)); }
body .standing-split .standing-metric { border: 1px solid var(--tf-border); border-radius: var(--tf-radius-card); background: var(--tf-surface); padding: 20px; gap: 8px; min-width: 0; container-type: inline-size; }
body .standing-split .standing-metric>span { font-size: 13px; color: var(--tf-text-secondary); }
body .dashboard .standing-split .standing-compact-grid .standing-metric small { font-size: 12px; line-height: 1.6; }
body .standing-split .standing-metric strong { color: var(--tf-text-primary); white-space: nowrap; font-size: clamp(18px,2vw,26px); line-height: 1.3; letter-spacing: -.025em; }
body .standing-split .standing-owed strong { color: var(--tf-danger); }
.account-card { background: var(--tf-surface-muted); border-color: var(--tf-border); border-radius: 16px; }
.account-card,.due-card,.monthly-card { container-type: inline-size; min-width: 0; }
.account-card::before,.account-card::after,.dash-card::before,.dash-card::after { content: none; }
.account-name { font-size: 15px; font-weight: 650; }
.account-balance { font-size: 26px; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.monthly-value,.due-value { font-size: clamp(25px,2.8vw,34px); line-height: 1.35; font-weight: 700; white-space: nowrap; }
.monthly-label,.standing-label { font-size: 13px; font-weight: 600; }
.monthly-icon,.due-icon,.activity-icon { width: 40px; height: 40px; background: var(--tf-surface-muted); border-radius: 12px; }
.spending-item { gap: 12px; min-width: 0; }
.spending-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.spending-label,.spending-name { overflow-wrap: anywhere; }
.activity-name,.activity-amount { font-size: 15px; }
.activity-row { padding-block: 16px; }
.investment-widget :is(.investment-total,.investment-type strong) { white-space: nowrap; }
.expense-row-top { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.expense-row-top .expense-name { flex: 1 1 130px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.expense-row-top .expense-value { flex: 0 0 auto; white-space: nowrap; font-size: 15px; }
.expense-fill { background: var(--tf-action); }
.due-card .due-value { color: var(--tf-text-primary)!important; }
.monthly-card .monthly-icon,.receivable-icon,.liability-icon { background: var(--tf-surface-muted); color: var(--tf-text-secondary); }
.account-type,.account-icon,.activity-icon { color: var(--tf-text-secondary); }
@supports(font-size:1cqi) {
    .account-balance,.monthly-value,.due-value { font-size: clamp(15px,7cqi,32px); }
    body .dashboard .standing-split .standing-compact-grid .standing-metric strong { font-size: clamp(16px,7cqi,28px); }
}
.chart-holder { margin-top: 16px; }
.tf-dashboard-context { min-width: 0; order: 0; }
.tf-dashboard-context .workspace-card:last-child { margin-bottom: 0; }
.tf-chart-data { margin-top: 18px; }
.tf-chart-data>summary { min-height: 44px; padding-block: 10px; color: var(--tf-success); }
.credit-widget { min-width: 0; container-type: inline-size; }
.credit-metrics { grid-template-columns: repeat(auto-fit,minmax(min(100%,140px),1fr)); }
.credit-metric { min-width: 0; padding: 14px; background: var(--tf-surface-muted); }
.credit-title-value { font-size: clamp(20px,8cqi,34px); white-space: nowrap; }
/* Standalone auth and access screens use the same primitives. */
body.auth-page { min-height: 100svh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(ellipse at 15% 0%,var(--tf-selected),transparent 60%),var(--tf-bg); }
.auth-page :is(.box,.access-card,.auth-card) { width: min(460px,100%); max-width: 100%; margin: 0; padding: 36px; border: 1px solid var(--tf-border); border-radius: 24px; background: var(--tf-surface); box-shadow: var(--tf-shadow-card); backdrop-filter: none; }
.auth-page>main:has(>.workspace-card) { width: min(520px,100%); margin: 0!important; padding: 0!important; }
.auth-page .tf-auth-brand { display: block; margin: 0 0 28px; }
.auth-page h1 { font-size: 28px; letter-spacing: -.03em; margin: 0 0 10px; }
.auth-page p { color: var(--tf-text-secondary); font-size: 14px; line-height: 1.7; margin: 12px 0 24px; }
.auth-page label { display: block; font-size: 14px; margin-top: 14px; color: var(--tf-text-primary); }
.auth-page button { width: 100%; }
.auth-page .google { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #263238; border: 1px solid #758b82; border-radius: 14px; padding: 12px; font-weight: 650; text-decoration: none; }
.auth-page .google svg { width: 20px; height: 20px; flex: none; }
.auth-page .divider { display: flex; align-items: center; gap: 12px; color: var(--tf-text-secondary); margin: 22px 0; font-size: 12px; }
.auth-page .divider::before,.auth-page .divider::after { content: ''; height: 1px; flex: 1; background: var(--tf-border); }
.auth-page .footer { text-align: center; margin-top: 22px; }
.auth-page .footer a { color: var(--tf-success); }
.auth-page .err { padding: 12px 14px; border-radius: 12px; line-height: 1.6; margin-block: 16px; }
.tf-auth-tagline { font-size: 13px; color: var(--tf-text-secondary); }
/* Respect every existing appearance preference and OS accessibility choice. */
body.compact-ui :is(.workspace-card,.dash-card,.record-card) { padding: 16px; }
body.text-large .workspace-card p,body.text-large label { font-size: 17px; }
body.text-small .workspace-card p,body.text-small label { font-size: 14px; }
body.reduced-glass :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index) { background: var(--tf-surface)!important; backdrop-filter: none!important; -webkit-backdrop-filter: none!important; box-shadow: none; }
body.reduced-glass .finance-modal-backdrop { backdrop-filter: none!important; -webkit-backdrop-filter: none!important; }
body.edge-shine :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index) { box-shadow: var(--tf-edge),var(--tf-shadow-card); }
body :is(input,select,textarea):focus-visible { border-color: var(--tf-focus); }
body :is(.feature-toggle,.shortcut-choices label):focus-within { outline: 3px solid var(--tf-focus); outline-offset: 3px; }
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
    .btn,.quick-shortcuts button,.side-nav a,.settings-index a,.section-tabs a,summary,.quick-add-floating,.mobile-add { transition: background-color var(--tf-duration-fast),border-color var(--tf-duration-fast),box-shadow var(--tf-duration),transform var(--tf-duration) var(--tf-ease); }
    .record-link { transition: color var(--tf-duration-fast); }
    body:not(.reduced-motion) :is(.btn,.quick-shortcuts button):not(:disabled):hover { transform: translateY(-1px); filter: none; }
    body :is(.side-nav a,.settings-index a,.section-tabs a):hover { box-shadow: var(--tf-edge); }
    body .preference-group>summary:hover { color: var(--tf-success); }
}
@media(prefers-reduced-motion:no-preference) {
    body:not(.reduced-motion) :is(.btn,.quick-shortcuts button,.quick-add-floating,.mobile-add):not(:disabled):active { transform: translateY(0) scale(.98); }
    body:not(.reduced-motion) .finance-modal.open .finance-modal-sheet { animation: tf-sheet-reveal var(--tf-duration-sheet) var(--tf-ease) both; }
    body:not(.reduced-motion) .preference-group[open]>:is(form,.form-grid,p) { animation: tf-panel-reveal var(--tf-duration) var(--tf-ease) both; }
}
@keyframes tf-sheet-reveal { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes tf-panel-reveal { from { opacity: 0; } to { opacity: 1; } }
@media(prefers-reduced-transparency:reduce) {
    body :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index) { background: var(--tf-surface)!important; backdrop-filter: none!important; -webkit-backdrop-filter: none!important; }
    .finance-modal-backdrop { backdrop-filter: none!important; -webkit-backdrop-filter: none!important; }
}
@media(prefers-reduced-motion:reduce) {
    *,*::before,*::after { animation: none!important; transition: none!important; scroll-behavior: auto!important; }
    body :is(.btn,.quick-shortcuts button,.glass-hover):hover { transform: none!important; }
}
/* Keep state/layout transforms: drawers and checked switches still need them. */
body.reduced-motion *,body.reduced-motion *::before,body.reduced-motion *::after { animation: none!important; transition: none!important; scroll-behavior: auto!important; }
body.reduced-motion :is(.btn,.quick-shortcuts button,.glass-hover):hover { transform: none!important; }
@media(min-width:821px) {
    body .sidebar-collapsed .sidebar { display: block; width: 76px; padding-inline: 8px; }
    .app-shell.sidebar-collapsed .main-content { margin-left: 108px; width: auto; }
    .sidebar-collapsed .tf-wordmark,.sidebar-collapsed .nav-label,.sidebar-collapsed .sidebar-footer>a div { display: none; }
    .sidebar-collapsed .tf-symbol { display: block; }
    .sidebar-collapsed .tf-brand { padding: 14px 10px 20px; }
    .sidebar-collapsed :is(.side-nav a,.sidebar-footer>a) { font-size: 0; gap: 0; justify-content: center; padding: 12px; }
}
@media(max-width:1100px) {
    body .dashboard .financial-standing.standing-split { grid-template-columns: minmax(0,1fr); }
    .topbar-actions { flex-basis: 100%; }
    .topbar-actions .global-search { flex: 1 1 200px; }
}
@media(max-width:820px) {
    .account-cards .account-card { flex: 0 0 220px; min-width: 220px; }
    body .sidebar { inset: 10px auto 10px 10px; width: min(280px,calc(100vw - 32px)); transform: translateX(calc(-100% - 24px)); }
    body .sidebar.open { transform: translateX(0); }
    .main-content,.sidebar-collapsed .main-content { margin-left: 0; padding: 16px 16px calc(112px + env(safe-area-inset-bottom)); }
    body .topbar { padding: 16px; border-radius: 20px; gap: 14px; margin-bottom: 20px; }
    .topbar-left { gap: 10px; width: 100%; }
    .tf-mobile-brand { display: block; width: 28px; height: 30px; object-fit: contain; }
    .topbar h1 { font-size: clamp(24px,5.5vw,30px); }
    .topbar p { font-size: 13px; }
    .page-kicker { display: none; }
    .topbar-actions { gap: 8px; }
    .topbar-actions .global-search { flex: 1 0 100%; order: 5; }
    .topbar-actions .global-search input { min-width: 0; max-width: none; font-size: 16px; }
    .mobile-page-swipe-hint { font-size: 12px; }
    body .workspace-card,body .dash-card { padding: 20px; }
    body .workspace-card :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea),.finance-entry-form :is(input,select,textarea) { font-size: 16px; }
    .mobile-bottom-nav { bottom: max(12px,env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; border-radius: 24px; min-height: 70px; padding: 8px; z-index: var(--tf-z-navigation); }
    .mobile-bottom-nav a { min-height: 44px; font-size: 12px; color: var(--tf-text-secondary); }
    .mobile-bottom-nav a.active { color: var(--tf-success); }
    .mobile-add { min-width: 48px; min-height: 48px; border-radius: 16px; }
    .quick-add-floating { bottom: calc(100px + env(safe-area-inset-bottom)); }
    .finance-modal-sheet { width: calc(100% - 16px); max-height: calc(100dvh - 24px); border-radius: 22px; margin: 8px; }
    .finance-modal-body { padding: 16px; }
    .finance-modal-header { padding: 16px; }
    .workspace-card h2,.dash-section-title { font-size: 19px; }
    .entry-actions { bottom: 88px; }
    .theme-switcher button { min-height: 38px; }
}
@media(max-width:600px) {
    body .standing-split .standing-compact-grid { grid-template-columns: minmax(0,1fr); }
    body .standing-split .standing-metric { min-height: 100px; padding: 18px; }
    body .standing-split .standing-metric strong { font-size: 26px; }
    body .standing-split .standing-spendable-hero { padding: 24px; }
    .dashboard-tools-row { display: grid; grid-template-columns: minmax(0,1fr); }
    .summary-grid { grid-template-columns: minmax(0,1fr); }
    .settings-index { gap: 6px; }
    .settings-index a { font-size: 13px; padding: 10px; }
    .finance-table.ledger-table td { padding: 0; }
    .ledger-table tr { padding: 18px 12px; grid-template-columns: minmax(0,1fr); }
    .ledger-table td:nth-child(6),.ledger-table td:nth-child(7) { grid-column: 1; grid-row: auto; text-align: start; }
    .ledger-table td:nth-child(6) { margin-top: 8px; font-size: 19px; }
    .ledger-table td:nth-child(7) { margin-top: 4px; }
    .auth-page :is(.box,.access-card,.auth-card) { padding: 26px 22px; }
    .auth-page h1 { font-size: 26px; }
}
@media(max-width:360px) {
    .main-content { padding-inline: 12px; }
    body .topbar { padding: 14px 12px; }
    body .workspace-card,body .dash-card { padding: 16px; }
    body .standing-split .standing-spendable-hero { padding: 20px; }
    body .standing-split .standing-spendable-hero>strong { font-size: 28px; }
    .language-switch select { min-width: 80px; }
}
@media(min-width:360px) and (max-width:600px) {
    body .standing-split .standing-compact-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body .standing-split .standing-compact-grid .standing-metric { padding: 16px; min-height: 112px; }
    body .dashboard .standing-split .standing-compact-grid .standing-metric strong { font-size: clamp(14px,10cqi,24px); }
}
@media print {
    body { background: white!important; color: #162b25!important; }
    .tf-skip,.ambient,.mobile-bottom-nav,.quick-add-floating,.topbar,.sidebar { display: none!important; }
    body :is(.workspace-card,.dash-card,.record-card,.summary-stat,.table-scroll) { background: white!important; color: #162b25!important; box-shadow: none!important; backdrop-filter: none!important; border-color: #dce9e2; }
    .main-content { margin: 0!important; padding: 0!important; }
    .finance-table { display: table!important; font-size: 10px; }
    .finance-table thead { display: table-header-group!important; position: static!important; clip-path: none!important; width: auto!important; height: auto!important; }
    .finance-table tbody { display: table-row-group!important; }
    .finance-table tr { display: table-row!important; }
    .finance-table td { display: table-cell!important; }
}


@media(max-width:820px) {
    body .topbar { padding: 12px; gap: 10px; margin-bottom: 16px; }
    .topbar h1 { font-size: 21px; line-height: 1.3; }
    .topbar h1 .dashboard-greeting { display: none; }
    .topbar p { font-size: 12px; margin-top: 4px; }
    .topbar-actions { flex-wrap: wrap; gap: 8px; }
    .topbar-actions .global-search { flex-basis: 100%; order: 5; }
    .dashboard-quick-tools { align-items: flex-start; gap: 12px; margin-bottom: 16px; }
    .dashboard-quick-tools .quick-shortcuts { flex: 1 1 100%; gap: 8px; }
    .dashboard-quick-tools .quick-shortcuts button { padding: 10px 12px; font-size: 13px; }
    .transaction-search-controls { gap: 8px; }
}

html[data-theme="dark"] :is(.tf-symbol,.tf-profile-symbol,.tf-mobile-brand) { content: url('/brand/symbol-white.png'); }

/* A fixed mobile calculator must not inherit a backdrop-created containing block. */
body .dash-card.dashboard-calculator { backdrop-filter: none!important; -webkit-backdrop-filter: none!important; }
@media(max-width:820px) {
}

.calculator-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.calculator-panel-header button { min-height: 44px; min-width: 44px; padding: 4px; border-radius: 12px; font-size: 24px; color: var(--tf-text-primary); background: var(--tf-surface-muted); border: 1px solid var(--tf-border); }

/* Visible native switches: the whole label is a comfortable keyboard/touch target. */
body .settings-content label.settings-switch { display: flex; align-items: center; gap: 14px; min-height: 64px; min-width: 0; padding: 14px; margin: 0; border: 1px solid var(--tf-border); border-radius: 18px; cursor: pointer; background: color-mix(in srgb,var(--tf-surface) 50%,transparent); }
.settings-switch>span { flex: 1; min-width: 0; line-height: 1.5; }
.settings-switch strong { display: block; font-size: 14px; font-weight: 650; }
.settings-switch small { display: block; margin-top: 5px; line-height: 1.6; color: var(--tf-text-secondary); }
body .settings-content .settings-switch input.settings-switch-input[type="checkbox"] { appearance: none; -webkit-appearance: none; position: relative; opacity: 1; display: inline-block; flex: 0 0 48px; width: 48px; min-width: 48px; height: 28px; min-height: 28px; margin: 0; padding: 0; border: 1px solid var(--tf-control-border); border-radius: 99px; background: color-mix(in srgb,var(--tf-text-secondary) 30%,var(--tf-surface)); cursor: pointer; box-shadow: inset 0 1px 3px rgb(0 0 0 / .08); transition: background-color var(--tf-duration),border-color var(--tf-duration); }
.settings-switch input.settings-switch-input::after { content: ''; position: absolute; inset: 3px auto auto 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 4px rgb(0 0 0 / .2); transition: transform var(--tf-duration) var(--tf-ease); }
body .settings-content .settings-switch input.settings-switch-input:checked { background: var(--tf-action); border-color: var(--tf-action); }
.settings-switch input.settings-switch-input:checked::after { transform: translateX(20px); }
html[data-theme="dark"] .settings-switch input.settings-switch-input:checked::after { background: var(--tf-action-text); }
.settings-switch:focus-within { outline: 3px solid var(--tf-focus); outline-offset: 3px; }
.settings-switch:has(input:disabled) { opacity: .65; cursor: wait; }
body .settings-content :is(.feature-group,.preference-group) { background: color-mix(in srgb,var(--tf-surface) 35%,transparent); border: 1px solid var(--tf-border); }
body .shortcut-choices { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr)); gap: 10px; }
body.text-large :is(.side-nav a,.settings-index a,.btn,.finance-table,.settings-switch strong) { font-size: 16px; }
body.text-small :is(.side-nav a,.settings-index a,.btn,.finance-table,.settings-switch strong) { font-size: 13px; }
/* Shine and plain mode now affect every shared surface, including nested settings. */
body:not(.edge-shine) { --tf-edge: inset 0 0 0 transparent; }
body:not(.edge-shine) :is(.workspace-card,.dash-card,.record-card,.summary-stat,.standing-metric,.standing-spendable-hero,.finance-modal-sheet,.btn,.quick-shortcuts button) { box-shadow: var(--tf-shadow-card); }
body:not(.edge-shine) :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index) { box-shadow: var(--tf-shadow-card); background-image: none; }
body.reduced-glass .settings-content :is(.settings-switch,.preference-group,.feature-group) { background: var(--tf-surface-muted); box-shadow: none; }
body.edge-shine:not(.reduced-glass):not(.high-contrast) .settings-switch { box-shadow: var(--tf-edge),inset 1px 0 0 var(--tf-light); }

body.reduced-glass :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index,.workspace-card,.dash-card:not(.financial-standing),.record-card,.summary-stat,.finance-modal-sheet,.settings-switch,.btn) { background-image: none!important; box-shadow: none!important; backdrop-filter: none!important; -webkit-backdrop-filter: none!important; }


.tf-workspace-name { display: block; margin-top: 10px; color: var(--tf-text-secondary); overflow-wrap: anywhere; }
.tf-workspace-name[hidden],.sidebar-collapsed .tf-workspace-name { display: none; }

/* Audit refinements: compact chrome, readable financial surfaces, explicit context. */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .65; }
.header-display-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tf-space-2); min-width: 0; }
.header-display-controls #privacyToggle,.header-display-controls :is(button,select) { min-height: var(--tf-control-size); }
.topbar-actions { flex-wrap:wrap; }
.account-prerequisite p { margin: 6px 0 10px; }
.account-prerequisite small { display: block; margin-top: 8px; }
.account-prerequisite .btn { margin: 4px 6px 4px 0; }
.mobile-provider { display: block; margin-top: 10px; }
[hidden] { display: none!important; }
body.drawer-open .mobile-bottom-nav,body:has(.finance-modal.open,dialog[open]) .mobile-bottom-nav { visibility: hidden; pointer-events: none; }
.chart-empty { display: grid; place-items: center; min-height: 130px; text-align: center; color: var(--tf-text-secondary); padding: 16px; }
.chart-period { display: flex; gap: 6px; align-items: end; flex-wrap: wrap; margin-block: 12px; }
.chart-period label { display: grid; gap: 4px; }
.chart-period select { min-height: 44px; }
.chart-definition { font-size: 13px; line-height: 1.6; color: var(--tf-text-secondary); }
@media(max-width:820px) {
    body .topbar { padding: 10px 12px; gap: 8px; margin-bottom: 14px; }
    .topbar-left { gap: 8px; min-width: 0; }
    .topbar-left > div { min-width: 0; }
    .topbar .page-kicker,.topbar .mobile-page-swipe-hint,.topbar-left p { display: none; }
    body .topbar h1 { font-size: clamp(18px,4.5vw,23px); margin: 0; }
    .topbar-actions { display: flex; flex-wrap: wrap; width: 100%; }
    .topbar-actions .global-search { flex: 1 1 0; order: 0; min-width: 0; margin: 0; }
    .topbar-actions .global-search input { min-height: 44px; width: 100%; }
    .topbar .mobile-menu { min-width: 44px; min-height: 44px; }
    .backup-reminder .backup-actions { flex-wrap: nowrap; }
    .backup-reminder .backup-actions form { min-width: 0; }
    .backup-reminder h2 { margin: 0; }
}


html[data-theme="light"] .tf-mobile-brand-dark,html[data-theme="dark"] .tf-mobile-brand-light { display:none; }
.dashboard-other-sections>summary { padding:14px; cursor:pointer; color:var(--tf-text-secondary); }
.reports-chart { height:260px; min-width:0; }
.reports-chart canvas { max-inline-size: 100%; }

/* The primary money card retains a dark brand surface with white text in either theme. */
body .dashboard .standing-spendable-hero { background:#134438!important; color:#fff; }
body .dashboard .standing-spendable-hero>small { color:#d5eee2; }

.finance-toast[data-tone="info"] { border-color:var(--tf-info); }
.finance-toast[data-tone="info"] .finance-toast-icon { color:var(--tf-info); }
.finance-toast[data-tone="error"] { border-color:var(--tf-danger); }
.finance-toast[data-tone="error"] .finance-toast-icon { color:var(--tf-danger); }
.dashboard .investment-type { container-type:inline-size; min-width:0; }
.dashboard .investment-type .finance-balance { display:block; font-size:clamp(11px,7.2cqi,16px); white-space:nowrap; }

.notice-info { border-color:var(--tf-info); color:var(--tf-text-primary); }

body.auth-page { grid-template-columns:minmax(0,1fr); }
.auth-page :is(.box,.access-card,.auth-card) { min-width:0; overflow-wrap:anywhere; }

/* Keep long monetary values inside the hero without splitting their decimals. */
body .dashboard .standing-spendable-hero { container-type:inline-size; }
body .dashboard .standing-split .standing-spendable-hero>strong { font-size:clamp(18px,9cqi,44px); white-space:nowrap; max-width:100%; }

@media(max-width:390px) { body .dashboard .standing-split .standing-compact-grid { grid-template-columns:minmax(0,1fr); } }

/* Continuous rounded glass edges, without an extra rectangular parent layer. */
body .dashboard .financial-standing.standing-split {
    background:none!important; background-image:none!important; backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important; box-shadow:none!important; border:0; transform:none;
}
body .sidebar { scrollbar-width:none; }
body .sidebar::-webkit-scrollbar { display:none; }
body .topbar { position:relative; z-index:30; }
.header-display-controls .language-switch { margin: 0; }
.header-display-controls .theme-switcher { display: flex; flex-shrink: 0; margin: 0; }

.sidebar>.subscription-status {
    display: block;
    padding: 0 var(--tf-space-3) var(--tf-space-3);
    color: var(--tf-text-secondary);
    font-size: var(--tf-font-caption);
}
.sidebar .subscription-expiry { display: block; }
@media (min-width: 821px) {
    .sidebar-collapsed .sidebar>.subscription-status { display: none; }
}
.tf-header-account {
    display: flex;
    align-items: center;
    gap: var(--tf-space-2);
    position: relative;
    flex: none;
    margin-inline-start: auto;
}
.tf-header-account .tf-header-profile { margin: 0; padding: 0; border: 0; }
.tf-header-account .tf-header-trigger {
    display: grid;
    position: relative;
    place-items: center;
    width: var(--tf-control-size);
    height: var(--tf-control-size);
    margin: 0;
    padding: 0;
    list-style: none;
    cursor: pointer;
    color: var(--tf-text-primary);
    text-decoration: none;
    background: var(--tf-surface);
    border: 1px solid var(--tf-control-border);
    border-radius: var(--tf-radius-control);
}
.tf-header-trigger::-webkit-details-marker { display: none; }
.tf-header-trigger .ui-icon { width: var(--tf-icon-size); height: var(--tf-icon-size); }
.tf-header-trigger img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}
.tf-header-trigger .tf-profile-symbol { padding: 4px; }
.tf-header-trigger:is(:hover,[aria-current="page"]),.tf-header-profile[open]>.tf-header-trigger {
    background: var(--tf-selected);
    color: var(--tf-action);
}
.tf-header-count {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    min-width: 16px;
    padding: 1px 3px;
    border-radius: 999px;
    background: var(--tf-action);
    color: var(--tf-action-text);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}
.tf-header-flyout {
    position: absolute;
    z-index: 4;
    inset-block-start: 100%;
    inset-inline-end: 0;
    width: min(16rem, calc(100vw - 2.5rem));
    padding-block-start: var(--tf-space-2);
}
.tf-header-preview { visibility: hidden; pointer-events: none; }
.tf-header-notifications:not([data-preview-dismissed]):is(:hover,:focus-within)>.tf-header-preview {
    visibility: visible;
    pointer-events: auto;
}
.tf-header-card {
    display: grid;
    gap: var(--tf-space-1);
    padding: var(--tf-space-3);
    border: 1px solid var(--tf-border);
    border-radius: var(--tf-radius-control);
    background: var(--tf-surface-elevated);
    color: var(--tf-text-primary);
    box-shadow: var(--tf-shadow-float);
    overflow-wrap: anywhere;
}
.tf-header-card p,.tf-header-card ul {
    margin: 0;
    font-size: var(--tf-font-caption);
    color: var(--tf-text-secondary);
}
.tf-header-card ul { padding-inline-start: var(--tf-space-4); }
.tf-header-card li+li { margin-block-start: var(--tf-space-1); }
.tf-header-user {
    padding: var(--tf-space-1) var(--tf-space-2) var(--tf-space-2);
    border-bottom: 1px solid var(--tf-border);
}
.tf-header-card :is(a,button) {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--tf-control-size);
    padding: var(--tf-space-2);
    border: 0;
    border-radius: var(--tf-radius-control);
    background: transparent;
    color: var(--tf-text-primary);
    text-decoration: none;
    text-align: start;
    cursor: pointer;
}
.tf-header-card :is(a,button):is(:hover,:focus-visible) { background: var(--tf-selected); }
.tf-header-card button { color: var(--tf-danger); }
body .side-nav a.active,body .sidebar a.active { color:var(--tf-action)!important; border-inline-start-color:var(--tf-action)!important; }
.settings-index a[aria-current="page"],.section-tabs a[aria-current="page"] { color:var(--tf-action); }
/* Dense controls and records share opaque reading surfaces. */
body :is(.record-card,.account-card,.summary-stat,.standing-metric,.audit-event,.entry-preview,.settings-switch,.feature-group,.preference-group,.backup-status-grid>div) {
    background: var(--tf-surface-muted);
    border: 1px solid var(--tf-border);
    border-radius: var(--tf-radius-control);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body .settings-content :is(.feature-group,.preference-group,label.settings-switch) { background: var(--tf-surface-muted); }
body .financial-standing .standing-metric { background: var(--tf-surface); }
body :is(.btn,.quick-shortcuts button,.sort-step,.theme-switcher,.language-toggle,.global-search input,.calculator-keys button,.section-tabs a,.ledger-presets a) {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
body :is(.section-tabs a[aria-current="page"],.ledger-presets a.active,.settings-index a[aria-current="page"]) {
    background: var(--tf-selected);
    color: var(--tf-action);
    font-weight: 650;
}
/* Chrome and primary panels use one optical layer. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    @media not (prefers-reduced-transparency: reduce) {
        body:not(.reduced-glass):not(.high-contrast) { background-image: var(--liquid-backdrop); }
        body:not(.reduced-glass):not(.high-contrast) :is(.sidebar,.topbar,.mobile-bottom-nav,.settings-index,.box,.auth-card,.access-card,.public-policy,.workspace-card,.dash-card:not(.financial-standing,.dashboard-calculator),.glass,.card,.panel):not(:is(.workspace-card,.dash-card,.glass,.card,.panel,.finance-modal,.record-card) *) {
            background: var(--tf-glass-surface);
            border-color: var(--tf-border);
            box-shadow: var(--liquid-reflection), var(--tf-shadow-card);
            backdrop-filter: blur(var(--tf-blur));
            -webkit-backdrop-filter: blur(var(--tf-blur));
        }
        body:not(.reduced-glass):not(.high-contrast) .dashboard .standing-spendable-hero {
            background:radial-gradient(ellipse at 5% 0,rgb(215 255 240 / .08),transparent 65%),linear-gradient(145deg,rgb(8 65 47 / .96),rgb(8 47 37 / .98))!important;
            border-color: rgb(224 255 244 / .25);
            box-shadow: var(--liquid-reflection), var(--tf-shadow-card);
        }
    }
}
/* Reflections live inside the border, so hover cannot expose rectangular seams. */
body.edge-shine :is(.workspace-card,.dash-card:not(.financial-standing),.standing-metric,.standing-spendable-hero,.account-card,.record-card,.summary-stat,.audit-event)::before { content:none; }
body :is(.workspace-card,.dash-card:not(.financial-standing),.standing-metric,.standing-spendable-hero) { border-radius:var(--tf-radius-card); }
body .financial-standing .standing-metric { display:flex; flex-direction:column; justify-content:flex-start; gap:8px; }
body .financial-standing .standing-metric :is(strong,small) { margin:0; }
body .section-heading { gap:16px; }
body :is(.settings-switch,.finance-entry-form label,.record-create-dialog label,.settings-content label) { text-transform:none; letter-spacing:normal; }
body .settings-switch strong { color:var(--tf-text-primary); }
body .settings-switch small { font-weight:400; }
body .workspace-card h2 { margin-top:0; }
body .finance-entry-form>details.field-wide { margin:0 0 12px; padding:8px 0; }
body .finance-entry-form>details.field-wide>summary { min-height:36px; display:flex; align-items:center; gap:8px; }
body .finance-entry-form>details.field-wide>summary::before { content:'\203a'; font-size:20px; }
body .finance-entry-form>details.field-wide[open]>summary::before { transform:rotate(90deg); }
body .finance-entry-form>details.field-wide>summary::-webkit-details-marker { display:none; }
body :is(.record-card,.workspace-card)>details { margin-top:16px; }
html body:is(.high-contrast,.reduced-glass) {
    background: var(--tf-bg);
    --liquid-dialog: var(--tf-surface-elevated);
    --liquid-input: var(--tf-surface);
}

/* Give forms a stable reading surface while retaining glass on surrounding chrome. */
html[data-theme] body #financeModal .finance-modal-sheet,
html[data-theme] body dialog.record-create-dialog,
html[data-theme] body dialog.protected-action-dialog {
    color: var(--tf-text-primary);
    background: var(--tf-surface-elevated) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: var(--liquid-reflection),var(--tf-shadow-float);
    border: 1px solid var(--tf-border);
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    @media not (prefers-reduced-transparency: reduce) {
        html[data-theme] body:not(.reduced-glass):not(.high-contrast) :is(#financeModal .finance-modal-sheet,dialog.record-create-dialog,dialog.protected-action-dialog) {
            background: var(--liquid-dialog) !important;
            backdrop-filter: blur(var(--tf-blur));
            -webkit-backdrop-filter: blur(var(--tf-blur));
        }
    }
}
body .finance-modal :is(.entry-card,.finance-entry-form,.finance-modal-body) {
    background: transparent !important;
    color: var(--tf-text-primary);
}
body .finance-modal :is(label,summary,small),
body .record-create-dialog :is(label,summary,small) { color: var(--tf-text-secondary); }
.record-create-dialog {
    position: fixed;
    inset: 0;
    height: fit-content;
    width: min(640px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: clamp(16px, 4vw, 26px);
    border-radius: var(--tf-radius-card);
    overflow-y: auto;
    box-shadow: var(--tf-shadow-float);
}
.record-create-dialog::backdrop { background: rgb(8 24 20 / .55); }
.record-create-dialog .section-heading h2 { margin: 0; }
body .topbar { z-index: 70; }
.global-search { position: relative; }
.live-suggestions {
    display: grid;
    gap: 2px;
    background: var(--tf-surface-elevated);
    color: var(--tf-text-primary);
    border: 1px solid var(--tf-border);
    border-radius: var(--tf-radius-control);
    padding: 5px;
    margin-bottom: 8px;
    max-height: 16rem;
    overflow-y: auto;
    box-shadow: var(--tf-shadow-card);
}
.live-suggestions :is(a,button) {
    display: block;
    min-height: 40px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    border: 0;
    color: inherit;
    text-align: start;
    overflow-wrap: anywhere;
    text-decoration: none;
    cursor: pointer;
}
.live-suggestions :is(a,button):is(:hover,:focus-visible) { background: var(--tf-selected); }
.global-search-message { padding: 6px 10px; color: var(--tf-text-secondary); font-size: var(--tf-font-caption); }
.global-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    width: min(340px, 80vw);
    z-index: 2;
}
body .language-toggle { display: flex; align-items: center; gap: 3px; padding: 4px; }
.language-toggle span { padding: 4px 6px; border-radius: 8px; }
.language-toggle .selected { color: var(--tf-action-text); background: var(--tf-action); }
.record-link, .account-name, .standing-spendable-label { color: inherit; text-decoration: none; }
.record-link:hover, .account-name:hover, .standing-spendable-label:hover { text-decoration: underline; }
[data-record-link], [data-due-card] { cursor: pointer; }
.due-actions:empty { display: none; }
.due-actions .muted { flex-basis: 100%; }
@media (min-width: 821px) {
    body:has(.quick-add-floating:not([hidden])) .main-content { padding-inline-end: 76px; }
    body .quick-add-floating { width: 48px; height: 48px; right: 16px; bottom: 16px; }
    body[data-quick-add-side="left"]:has(.quick-add-floating:not([hidden])) .main-content { padding-inline: 76px var(--tf-space-6); }
    body[data-quick-add-side="left"] .quick-add-floating { left: 276px; }
    body[data-quick-add-side="left"]:has(.sidebar-collapsed) .quick-add-floating { left: 120px; }
}
@media (max-width: 820px) {
    html:has(.mobile-bottom-nav) { scroll-padding-block-end: calc(92px + env(safe-area-inset-bottom)); }
    .global-suggestions { inset-inline: 0 auto; width: min(320px, 80vw); }
    body .topbar-actions { flex-direction: row; align-items: center; gap: var(--tf-space-2); }
    body .topbar-actions .global-search { flex: 1 1 144px; width: auto; }
    body .topbar-actions .global-search input { width: 100%; height: var(--tf-control-size); padding-block: 0; }
    body .topbar-actions:has(.header-display-controls) .global-search { flex-basis: 100%; }
    .mobile-bottom-nav {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        min-height: 64px;
        padding: var(--tf-space-1);
        border-radius: var(--tf-radius-card);
        gap: 2px;
    }
    .mobile-bottom-nav a { padding: 4px 2px; min-width: 0; min-height: 52px; text-align: center; border-radius: var(--tf-radius-control); }
    body .mobile-bottom-nav small { font-size: 10px; line-height: 1.25; overflow-wrap: anywhere; }
    body .mobile-bottom-nav a.active { background: var(--tf-selected); color: var(--tf-action); }
    .mobile-bottom-nav .mobile-add { margin: 0 auto; border-radius: var(--tf-radius-control); min-width: 44px; min-height: 44px; }
    body :is(.workspace-card,.dash-card) { padding: var(--tf-card-padding); }
    body .ledger-summary { gap: var(--tf-space-2); grid-template-columns: repeat(2,minmax(0,1fr)); }
    body .ledger-summary .summary-stat { padding: var(--tf-space-2); }
    body .ledger-summary strong { font-size: clamp(11px, 8.5cqi, 24px); }
    body .backup-reminder { margin-block: var(--tf-space-3); }
    #financeModal .finance-modal-sheet {
        max-height: calc(100dvh - env(safe-area-inset-top) - var(--tf-space-4));
        padding: 0;
        scroll-padding-block-start: var(--tf-space-6);
    }
    #financeModal .finance-modal-body { padding-block-end: max(var(--tf-space-4), env(safe-area-inset-bottom)); }
    #financeModal .entry-actions { position: static; }
}
@media print {
    body :is(.workspace-card,.dash-card,.record-card,.summary-stat,.standing-metric,.glass,.panel,.public-policy,.finance-table th) {
        background: #fff !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        color: #162b25;
    }
}

/* Keep the Quick Add sheet scrollable without showing a scrollbar track. */
#financeModal .finance-modal-sheet { scrollbar-width: none; }
#financeModal .finance-modal-sheet::-webkit-scrollbar { display: none; }
.record-shortcut-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--tf-space-3); margin-block-end: var(--tf-space-4); }
.record-shortcut-row .section-tabs { flex: 1 1 auto; margin: 0; }
.record-shortcut-row > .btn { margin-inline-start: auto; min-height: var(--tf-control-size); }
.record-heading-actions,.record-sort-arrows { display: flex; align-items: center; gap: var(--tf-space-1); }
.record-sort-arrows .sort-step { min-width: var(--tf-control-size); min-height: var(--tf-control-size); }
.record-sort-arrows .sort-step:disabled { opacity: .4; cursor: default; }
.ledger-row-link { color: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: .18em; }
.transaction-detail-section { padding-block-start: var(--tf-space-4); margin-block-start: var(--tf-space-4); border-block-start: 1px solid var(--tf-border); }
.transaction-detail .form-actions > form { margin: 0; }
.transaction-history details { padding-block: var(--tf-space-2); margin-block: 0; }
.notification-tabs a { display: inline-flex; align-items: center; gap: var(--tf-space-2); }
.notification-groups { gap: var(--tf-space-3); margin-block-end: var(--tf-space-4); }
.notification-group { margin: 0; scroll-margin-block-start: var(--tf-space-4); }
.notification-list { list-style: none; padding: 0; margin: 0; }
.notification-item { border-inline-start: 3px solid var(--tf-border); padding-inline-start: var(--tf-space-3); margin-block: var(--tf-space-3); }
.notification-item.notification-urgent { border-inline-start-color: var(--tf-danger); }
.notification-item.notification-backup { border-inline-start-color: var(--tf-warning); }
.workspace-card .notification-link { color: var(--tf-text-primary); display: flex; justify-content: space-between; align-items: center; gap: var(--tf-space-3); padding-block: var(--tf-space-2); text-decoration: none; }
.notification-link:hover strong { text-decoration: underline; }
.notification-link small { display: block; margin-block-start: var(--tf-space-1); }
.notification-item form { margin-block: var(--tf-space-2); }

.dashboard-main-charts .dashboard-calculator { display: flex; flex-direction: column; }
.dashboard-main-charts .calculator-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.dashboard-main-charts .calculator-keys { flex: 1; max-block-size: 360px; grid-auto-rows: minmax(44px, 1fr); }
body .dashboard :is(.due-card,.credit-widget,.investment-widget) { padding: var(--tf-space-4); }
.dashboard :is(.due-card,.credit-widget,.investment-widget) :is(.credit-metrics,.investment-types,.utilization-line,.investment-footer) { margin-block-start: var(--tf-space-3); }
.dashboard :is(.credit-title-value,.investment-total) { font-size: clamp(19px, 7cqi, 28px); }
.dashboard-feature-value { font-size: 1.15rem; font-weight: 700; }
.dashboard-feature-trend { display: flex; align-items: end; gap: 3px; block-size: 28px; }
.dashboard-feature-trend i { flex: 1; min-block-size: 1px; background: var(--tf-action); border-radius: 3px 3px 0 0; }

.record-shortcut-actions,.record-filter-row { display: flex; align-items: end; flex-wrap: wrap; gap: var(--tf-space-3); }
.record-shortcut-actions { margin-inline-start: auto; }
.record-filter-row label { flex: 1 1 140px; min-inline-size: 0; }
.record-filter-row :is(input,select) { margin-block-end: 0; }
.record-filter-row .btn { min-block-size: var(--tf-control-size); }
.finance-record-grid { align-items: start; margin-block-end: var(--tf-space-4); }
.finance-record-grid > :is(.workspace-card,.record-card) { margin: 0; min-inline-size: 0; }
.finance-record-grid > .empty-state { grid-column: 1 / -1; margin: 0; }
.calendar-agenda .finance-record-grid { margin-block-end: 0; }
.calendar-agenda-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--tf-space-2); text-decoration: none; color: var(--tf-text-primary); }
.calendar-agenda-item:hover { border-color: var(--tf-action); }
.calendar-agenda-item small { display: block; }
.calendar-agenda-amount { margin-inline-start: auto; text-align: end; }
.reconciliation-identity { overflow-wrap: anywhere; }
.reconciliation-status { font-weight: 600; }

.finance-workspace .record-shortcut-row {
    padding: var(--tf-space-3) var(--tf-space-4);
    border: 1px solid var(--tf-border);
    border-radius: var(--tf-radius-card);
    background: var(--tf-surface);
    box-shadow: var(--tf-shadow-card);
}
.finance-workspace .record-shortcut-row .section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tf-space-2);
    min-inline-size: 0;
}
.finance-workspace .section-tabs a { min-block-size: var(--tf-control-size); padding: var(--tf-space-2) var(--tf-space-3); align-content: center; }
.finance-workspace .section-tabs a[aria-current="page"] { background: var(--tf-selected); color: var(--tf-action); border-color: var(--tf-action); }
.finance-workspace .finance-section-nav { margin-block-end: var(--tf-space-4); }
.finance-section-title,.finance-filter-card h2 { margin: 0 0 var(--tf-space-3); font-size: 1.1rem; }
.finance-workspace .finance-filter-card { padding: var(--tf-space-4); }
.finance-workspace .finance-section-filter { margin-block-end: var(--tf-space-4); }
.finance-workspace .summary-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: var(--tf-space-3); }
.finance-workspace .summary-stat strong,.finance-record-metrics dd {
    white-space: normal;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}
.finance-workspace .finance-record-grid { align-items: stretch; }
.finance-workspace .finance-record-grid .section-heading > :is(h2,h3),.category-grid h2 { margin: 0; }
.finance-workspace .finance-record-grid :is(h2,h3) { overflow-wrap: anywhere; }
.finance-workspace .finance-record-grid > :is(.workspace-card,.record-card) { padding: var(--tf-space-4); }
.finance-record-metrics {
    margin: var(--tf-space-3) 0;
    padding: var(--tf-space-3);
    border-radius: var(--tf-radius-control);
    background: var(--tf-surface-muted);
}
.finance-record-metrics dd { margin: var(--tf-space-1) 0 0; font-weight: 700; }
.finance-workspace .finance-value-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--tf-space-2); padding-block: var(--tf-space-2); border-block-end: 1px solid var(--tf-border); }
.finance-workspace .finance-value-row strong { font-variant-numeric: tabular-nums; }
.finance-workspace .report-chart-data { margin-block-end: 0; }
.finance-workspace .calendar-agenda { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 4fr); align-items: start; gap: var(--tf-space-4); }
.calendar-agenda-date { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tf-space-2); }
.finance-workspace .calendar-agenda-date h2 { margin: 0; }
.finance-workspace .calendar-agenda-overdue,.finance-workspace .balance-record-review { border-inline-start: 3px solid var(--tf-warning); }
.category-group > summary { display: flex; align-items: center; gap: var(--tf-space-2); }
.category-grid .record-card h2 { font-size: 1rem; }
.category-grid .record-heading-actions { margin-inline-start: auto; }
@media (max-width: 820px) {
    .finance-workspace .calendar-agenda { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
    .finance-workspace .record-shortcut-row > nav { flex-basis: 100%; }
    .finance-workspace .record-shortcut-row { padding: var(--tf-space-3); }
    .finance-workspace .summary-stat strong { font-size: 1.05rem; }
}
