/* SamePage Budget visual system. Adjust the light, dark, and accent tokens here. */
:root {
    --topbar-height: 72px;

    /* Typography scale: adjust these values to resize the entire interface. */
    --font-size-14: 14px;
    --font-size-19: 19px;
    --font-size-8: 8px;
    --font-size-11: 11px;
    --font-size-9: 9px;
    --font-size-page-title: clamp(28px, 3.2vw, 39px);
    --font-size-12: 12px;
    --font-size-10: 10px;
    --font-size-16: 16px;
    --font-size-15: 15px;
    --font-size-18: 18px;
    --font-size-23: 23px;
    --font-size-13: 13px;
    --font-size-21: 21px;
    --font-size-budget-title: clamp(22px, 2.4vw, 30px);
    --font-size-summary-value: clamp(19px, 2vw, 25px);
    --font-size-7: 7px;
    --font-size-20: 20px;
    --font-size-17: 17px;
    --font-size-30: 30px;
    --font-size-table-body: 12px;
    --font-size-table-header: 10px;
    --font-size-table-secondary: 10px;
    --font-size-details-label: 11px;
    --font-size-details-body: 12px;
    --font-size-details-small: 10px;
    --font-size-details-title: 21px;
    --font-size-details-placeholder: 16px;
    /* End typography scale. */
    color-scheme: light;
    --bg: #f5f0e6;
    --surface: #fffdf8;
    --surface-soft: #f1ece2;
    --surface-raised: #fffefa;
    --text: #403a34;
    --text-soft: #71685e;
    --muted: #968b7d;
    --border: #e7dfd2;
    --border-strong: #d5cabb;
    --accent: #75866a;
    --accent-hover: #627456;
    --accent-soft: #e8eee3;
    --accent-ink: #536449;
    --accent-on-button: #fffdf8;
    --green: #718c68;
    --green-soft: #e8eee3;
    --amber: #a77a3d;
    --amber-soft: #f5ead7;
    --blue: #8b9180;
    --blue-soft: #eceee7;
    --red: #b96f62;
    --red-soft: #f6e8e3;
    --danger-button-text: #fffdf8;
    --shadow: 0 14px 36px rgba(72, 57, 38, .075), 0 2px 7px rgba(72, 57, 38, .035);
    --shadow-pop: 0 22px 65px rgba(65, 49, 31, .19), 0 3px 12px rgba(65, 49, 31, .07);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --detail-width: 390px;
    --chart-empty: #e9e1d5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #24251f;
    --surface: #2d2e27;
    --surface-soft: #35362e;
    --surface-raised: #393a32;
    --text: #f2eee5;
    --text-soft: #d0c8b9;
    --muted: #aaa08f;
    --border: #49483d;
    --border-strong: #5b594b;
    --accent: #a8b99a;
    --accent-hover: #bdcbae;
    --accent-soft: #3c4938;
    --accent-ink: #d1dfc6;
    --accent-on-button: #24251f;
    --green: #a8c49a;
    --green-soft: #354536;
    --amber: #e0bd80;
    --amber-soft: #4a4030;
    --blue: #b2b99e;
    --blue-soft: #3a4036;
    --red: #e49a8a;
    --red-soft: #4a3430;
    --danger-button-text: #30231f;
    --shadow: 0 14px 36px rgba(0, 0, 0, .23), 0 2px 7px rgba(0, 0, 0, .13);
    --shadow-pop: 0 22px 65px rgba(0, 0, 0, .48), 0 3px 12px rgba(0, 0, 0, .22);
    --chart-empty: #45463c;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: var(--font-size-14); line-height: 1.45; transition: background .2s ease, color .2s ease; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 72%, white); outline-offset: 2px; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; }
.topbar { height: 72px; padding: 0 clamp(20px, 4vw, 58px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 20; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--accent-on-button); background: var(--accent); box-shadow: 0 5px 12px color-mix(in srgb, var(--accent) 27%, transparent); }
.brand-mark svg { width: 28px; height: 28px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.brand-copy b { font-size: var(--font-size-19); letter-spacing: -.8px; font-weight: 770; }
.brand-copy small { font-size: var(--font-size-8); font-weight: 800; letter-spacing: 2.7px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 17px; }
.cloud-save-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--font-size-11); color: var(--muted); font-weight: 600; }
.cloud-save-status i { width: 7px; height: 7px; border-radius: 50%; background: #39a888; box-shadow: 0 0 0 3px color-mix(in srgb, #39a888 14%, transparent); }
.cloud-save-status i.save-error { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.main-content { width: 100%; max-width: 1660px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 58px) 30px; }
.screen { min-height: calc(100vh - 72px); position: relative; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 48px 0 30px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: var(--font-size-9); font-weight: 800; letter-spacing: 1.65px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font-size: var(--font-size-page-title); letter-spacing: -1.45px; line-height: 1.13; font-weight: 760; }
.heading-subtitle { margin: 10px 0 0; color: var(--text-soft); font-size: var(--font-size-14); }
.heading-actions, .budget-actions, .section-controls, .list-toolbar-right { display: flex; align-items: center; gap: 9px; }
.button { min-height: 39px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: var(--font-size-12); font-weight: 680; letter-spacing: -.05px; text-decoration: none; white-space: nowrap; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0) scale(.98); }
.button-primary { color: var(--accent-on-button); background: var(--accent); box-shadow: 0 5px 13px color-mix(in srgb, var(--accent) 21%, transparent); }
.button-primary:hover { background: var(--accent-hover); box-shadow: 0 7px 17px color-mix(in srgb, var(--accent) 28%, transparent); }
.button-secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.button-secondary:hover, .button-outline:hover { background: var(--surface-soft); border-color: var(--accent); }
.button-quiet { min-height: 34px; padding: 0 9px; color: var(--text-soft); background: transparent; border-color: transparent; }
.button-quiet:hover { background: var(--surface-soft); color: var(--text); }
.button-small { min-height: 29px; padding: 0 10px; border-radius: 7px; font-size: var(--font-size-10); }
.button-outline { color: var(--text-soft); background: transparent; border-color: var(--border); }
.button-outline.active, .button-outline:focus { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.button-danger { color: var(--danger-button-text); background: var(--red); }
.button-danger-ghost { color: var(--red); background: transparent; border-color: transparent; }
.button-danger-ghost:hover { background: var(--red-soft); }
.button-icon { font-size: var(--font-size-16); line-height: 1; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-soft); transition: .16s ease; }
.icon-button:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-button svg { width: 17px; height: 17px; }
.icon-button.small { width: 30px; height: 30px; border-radius: 8px; }
.icon-button.subtle { border-color: transparent; background: transparent; }
.icon-button.subtle:hover { background: var(--surface-soft); border-color: var(--border); }
.sun-icon { display: none; }
:root[data-theme="light"] .moon-icon { display: block; }
:root[data-theme="light"] .sun-icon { display: none; }
:root[data-theme="dark"] .moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: block; }

/* Budget project list */
.list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.search-field { height: 39px; width: min(390px, 100%); padding: 0 11px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field svg { width: 16px; height: 16px; flex: 0 0 auto; }
.search-field input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: var(--font-size-12); }
.search-field input::placeholder { color: var(--muted); }
kbd { padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: var(--font-size-10); }
.list-toolbar-right { color: var(--muted); font-size: var(--font-size-11); }
.budget-date-filters { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; }
.budget-date-filter { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: var(--font-size-11); white-space: nowrap; }
.budget-date-filter input { width: 145px; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); background: var(--surface); font: inherit; font-size: var(--font-size-11); font-weight: 500; }
.budget-date-filter input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compact-select { min-height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); background: var(--surface); font-size: var(--font-size-11); }
.budget-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 25px 0 50px; }
.pinned-budgets-section { margin: 22px 0 4px; padding: 0 18px 2px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.pinned-budgets-section details > summary { min-height: 56px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; color: var(--text); }
.pinned-budgets-section details > summary::-webkit-details-marker { display: none; }
.pinned-section-title { font-size: var(--font-size-15); font-weight: 750; letter-spacing: -.2px; }
.pinned-budget-count { min-width: 22px; height: 22px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 20px; background: var(--surface); color: var(--text-soft); font-size: var(--font-size-10); font-weight: 750; }
.pinned-section-chevron { margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .18s ease; }
.pinned-budgets-section details:not([open]) .pinned-section-chevron { transform: rotate(-90deg); }
.pinned-budget-grid { padding: 0 0 18px; }
.pinned-budget-card { background: var(--surface); }

.budget-card { min-height: 164px; position: relative; overflow: visible; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 5px rgba(15, 22, 42, .025); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.budget-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 14px 0 0 14px; background: var(--card-accent, var(--accent)); }
.budget-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.budget-card-main { display: flex; width: 100%; min-height: 162px; padding: 21px 23px; flex-direction: column; align-items: flex-start; text-align: left; border: 0; border-radius: inherit; background: transparent; }
.budget-card-kicker { color: var(--muted); font-size: var(--font-size-8); font-weight: 800; letter-spacing: 1.5px; }
.budget-card-main strong { max-width: calc(100% - 15px); margin-top: 19px; overflow-wrap: anywhere; color: var(--text); font-size: var(--font-size-19); font-weight: 720; letter-spacing: -.45px; }
.budget-card-open { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: var(--font-size-10); font-weight: 700; }
.budget-card-open b { font-size: var(--font-size-15); font-weight: 500; transition: transform .15s ease; }
.budget-card:hover .budget-card-open b { transform: translateX(4px); }
.budget-card:has(.budget-card-menu:not([hidden])) { z-index: 20; }
.budget-card-menu-wrap { position: absolute; top: 13px; right: 13px; z-index: 3; }
.budget-card-menu-button { font-size: var(--font-size-18); letter-spacing: 1px; }
.budget-card-menu, .more-menu { min-width: 170px; padding: 5px; position: absolute; top: 35px; right: 0; z-index: 15; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); box-shadow: var(--shadow-pop); }
.budget-card-menu button, .more-menu button { display: block; width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text-soft); text-align: left; font-size: var(--font-size-11); }
.budget-card-menu button:hover, .more-menu button:hover { background: var(--surface-soft); color: var(--text); }
.menu-danger { color: var(--red) !important; }
.empty-state { padding: 52px 20px 90px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty-state .eyebrow { margin-top: 8px; }
.empty-state h2 { margin: 0 0 8px; color: var(--text); font-size: var(--font-size-23); letter-spacing: -.7px; }
.empty-state > p:not(.eyebrow) { margin: 0 0 20px; color: var(--text-soft); font-size: var(--font-size-13); }
.empty-illustration { width: 150px; height: 120px; margin-bottom: 10px; position: relative; }
.empty-orbit { position: absolute; border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 50%; transform: rotate(-23deg); }
.orbit-one { width: 140px; height: 73px; left: 5px; top: 22px; }
.orbit-two { width: 112px; height: 97px; left: 19px; top: 10px; transform: rotate(42deg); border-style: dashed; }
.empty-wallet { width: 66px; height: 49px; position: absolute; left: 42px; top: 34px; border-radius: 10px; background: var(--accent); box-shadow: 0 12px 22px color-mix(in srgb, var(--accent) 25%, transparent); transform: rotate(-5deg); }
.empty-wallet::before { content: ""; width: 30px; height: 11px; position: absolute; right: -4px; top: 14px; border: 2px solid rgba(255,255,255,.8); border-radius: 5px; background: var(--accent); }
.empty-wallet span { width: 14px; height: 3px; position: absolute; left: 12px; border-radius: 3px; background: rgba(255,255,255,.55); }
.empty-wallet span:nth-child(1) { top: 13px; }.empty-wallet span:nth-child(2) { top: 21px; width: 25px; }.empty-wallet span:nth-child(3) { top: 29px; width: 20px; }
.spark-one, .spark-two { position: absolute; color: var(--accent); font-size: var(--font-size-18); }.spark-one { top: 8px; right: 24px; }.spark-two { bottom: 8px; left: 14px; font-size: var(--font-size-21); color: #c58a37; }
.no-results { padding: 55px 20px; display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--text-soft); font-size: var(--font-size-12); }.no-results strong { color: var(--text); font-size: var(--font-size-15); }
.app-footer { display: flex; justify-content: space-between; padding: 22px 0 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--font-size-10); }


/* Ownership tabs keep personal and shared lists distinct, including each tab's pinned section. */
.budget-list-tabs { min-height: 43px; margin-top: 6px; display: flex; align-items: stretch; gap: 22px; border-bottom: 1px solid var(--border); }
.budget-list-tab { min-height: 43px; padding: 0 2px 10px; position: relative; display: inline-flex; align-items: center; gap: 8px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: var(--font-size-12); font-weight: 650; cursor: pointer; }
.budget-list-tab:hover { color: var(--text); }
.budget-list-tab.active { border-bottom-color: var(--accent); color: var(--accent-ink); }
.budget-list-tab:disabled { opacity: .5; cursor: not-allowed; }
.budget-list-tab span { min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 20px; color: var(--text-soft); background: var(--surface-soft); font-size: var(--font-size-9); font-weight: 700; }
.budget-list-tab.active span { color: var(--accent-ink); background: var(--accent-soft); }
.budget-card-sharing-meta { margin-top: 6px; color: var(--muted); font-size: var(--font-size-10); line-height: 1.35; overflow-wrap: anywhere; }
.budget-view-permission-note { margin: -2px 0 14px; padding: 10px 13px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; color: var(--text-soft); background: var(--surface-soft); font-size: var(--font-size-12); font-weight: 400; line-height: 1.45; }
.budget-view-permission-note strong { font-weight: 700; }
.budget-view-permission-note[hidden] { display: none; }

/* Share dialog: clear recipient rows with inline role controls. */
.share-dialog { width: min(94vw, 590px); }
.share-add-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px auto; align-items: end; gap: 10px; }
.share-add-row .form-field { margin-bottom: 0; }
.share-add-button { min-height: 38px; white-space: nowrap; }
.share-dialog-error { margin: 10px 0 0; color: var(--red); font-size: var(--font-size-10); line-height: 1.45; }
.share-dialog-error[hidden] { display: none; }
.share-list-heading { margin-top: 22px; padding: 0 0 9px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); color: var(--text-soft); font-size: var(--font-size-11); }
.share-list-heading > span { min-width: 21px; height: 21px; padding: 0 6px; display: grid; place-items: center; border-radius: 20px; color: var(--muted); background: var(--surface-soft); font-size: var(--font-size-9); font-weight: 700; }
.share-list { display: flex; flex-direction: column; }
.share-list-row { min-height: 58px; padding: 9px 0; display: grid; grid-template-columns: minmax(0, 1fr) 112px 65px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.share-person { min-width: 0; display: flex; align-items: center; gap: 9px; }
.share-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; color: var(--accent-ink); background: var(--accent-soft); font-size: var(--font-size-11); font-weight: 750; }
.share-person-email { min-width: 0; color: var(--text); font-size: var(--font-size-11); overflow-wrap: anywhere; }
.share-role-control { min-width: 0; }
.share-role-control select { width: 100%; min-height: 34px; padding: 0 7px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-soft); background: var(--surface); font-size: var(--font-size-10); }
.share-remove-button { min-height: 33px; padding: 0 6px; border: 0; border-radius: 6px; color: var(--red); background: transparent; font-size: var(--font-size-10); font-weight: 650; }
.share-remove-button:hover { background: var(--red-soft); }
.share-list-empty { padding: 23px 10px; color: var(--muted); font-size: var(--font-size-11); text-align: center; }
.sr-only { width: 1px; height: 1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Budget workspace header and summary metrics */
.budget-view-header { min-height: 90px; padding: 23px 0 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; z-index: 10; }
.budget-title-wrap { display: flex; align-items: center; gap: 15px; min-width: 0; }
.budget-title-wrap h1 { max-width: min(56vw, 700px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-budget-title); }
.budget-title-wrap .eyebrow { margin-bottom: 5px; }
.back-button { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 10px; color: var(--text-soft); background: var(--surface); }
.back-button:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.back-button svg { width: 18px; height: 18px; }
.budget-actions { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.budget-view-wrap, .budget-export-wrap, .budget-more-wrap { position: relative; flex: 0 0 auto; }
.budget-actions .more-menu { top: 42px; right: 0; min-width: 205px; }
.budget-actions .more-menu button { min-height: 38px; }
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin: 3px 0 22px; }
.summary-card { min-height: 105px; padding: 14px 17px 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 5px rgba(15,22,42,.018); }
.summary-card-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-soft); font-size: var(--font-size-10); font-weight: 650; }
.summary-card-top b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; font-size: var(--font-size-13); font-weight: 600; }
.income-summary .summary-card-top b { color: var(--green); background: var(--green-soft); }
.planned-summary .summary-card-top b { color: var(--blue); background: var(--blue-soft); }
.remaining-summary .summary-card-top b { color: var(--accent); background: var(--accent-soft); }
.pending-summary .summary-card-top b { color: var(--amber); background: var(--amber-soft); }
.account-summary .summary-card-top b { color: var(--accent); background: var(--accent-soft); }
.summary-card > strong { display: block; margin: 6px 0 3px; color: var(--text); font-size: var(--font-size-summary-value); font-weight: 760; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.summary-card > small { color: var(--muted); font-size: var(--font-size-9); }
.negative-value { color: var(--red) !important; }

/* The table and inspector remain visible together on wide screens. */
.workspace-layout { display: grid; grid-template-columns: minmax(0, 1fr) 6px var(--detail-width); align-items: stretch; gap: 0; min-height: 580px; }
.tables-column { min-width: 0; padding-right: 21px; }
.resize-handle { width: 6px; margin: 0; position: relative; cursor: col-resize; border-radius: 4px; background: transparent; touch-action: none; }
.resize-handle::after { content: ""; width: 2px; position: absolute; top: 0; bottom: 0; left: 2px; border-radius: 4px; background: var(--border); transition: background .15s ease; }
.resize-handle:hover::after, .resize-handle:focus-visible::after { background: var(--accent); }
.details-panel { min-width: 0; min-height: 560px; padding: 21px 20px; align-self: stretch; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 12px rgba(25,35,55,.025); }
.details-panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.details-panel-heading h2 { margin: 0; font-size: var(--font-size-14); letter-spacing: -.15px; }
.details-panel-heading > span { color: var(--muted); font-size: var(--font-size-9); }
.mobile-details-back { display: none; }
.data-section { margin-bottom: 22px; min-width: 0; }
.section-heading { min-height: 56px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; }
.section-title-wrap { display: flex; align-items: center; gap: 10px; }
.section-symbol { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; font-size: var(--font-size-16); font-weight: 700; }
.income-symbol { color: var(--green); background: var(--green-soft); }
.items-symbol { color: var(--blue); background: var(--blue-soft); }
.section-title-wrap h2 { margin: 0 0 2px; color: var(--text); font-size: var(--font-size-15); letter-spacing: -.25px; }
.section-title-wrap p { margin: 0; color: var(--muted); font-size: var(--font-size-9); }
.section-controls { gap: 5px; flex: 0 0 auto; }
.view-toggle { min-height: 30px; padding: 0 9px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); background: var(--surface); font-size: var(--font-size-9); }
.view-toggle > span:first-child { color: var(--accent); font-size: var(--font-size-13); }
.view-toggle i { font-style: normal; color: var(--muted); }
.view-toggle:hover, .view-toggle.active { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.table-card { overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.table-container { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.data-table { width: 100%; min-width: 690px; border-collapse: separate; border-spacing: 0; text-align: left; font-size: var(--font-size-10); }
.data-table thead { position: sticky; top: 0; z-index: 2; }
.data-table th { height: 37px; padding: 0 9px; border-bottom: 1px solid var(--border); color: var(--muted); background: var(--surface-soft); font-size: var(--font-size-8); font-weight: 750; letter-spacing: .25px; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { padding-left: 11px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 12px; }
.data-table td { height: 51px; max-width: 210px; padding: 7px 9px; border-bottom: 1px solid var(--border); color: var(--text-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-row { transition: background .13s ease; }
.data-row:hover td { background: var(--surface-soft); }
.data-row.row-current td { background: var(--accent-soft); }
.data-row.row-multi-selected td { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.data-row.row-current.row-multi-selected td { background: var(--accent-soft); }
.drag-column, .drag-cell { width: 27px; min-width: 27px; padding-right: 0 !important; }
.select-column, .select-cell { width: 31px; min-width: 31px; padding: 0 3px !important; text-align: center; }
.drag-handle { width: 20px; height: 28px; padding: 0; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: var(--font-size-16); line-height: 1; cursor: grab; touch-action: none; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--accent); background: var(--accent-soft); }
.drag-handle:active { cursor: grabbing; }
.row-select-checkbox { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.select-cell { display: none; }
.select-mode .select-cell { display: table-cell; }
.select-mode .drag-cell { display: none; }
.table-sort-button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; color: inherit; background: transparent; font-size: var(--font-size-8); font-weight: inherit; white-space: nowrap; }
.table-sort-button:hover, .table-sort-button.sort-active { color: var(--accent-ink); }
.table-sort-button span { color: var(--muted); font-size: var(--font-size-10); }
.table-sort-button:disabled { opacity: .5; cursor: not-allowed; }
.name-cell { min-width: 120px; }
.row-name-button { max-width: 100%; padding: 0; display: block; overflow: hidden; border: 0; color: var(--text); background: transparent; font-size: var(--font-size-10); font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.row-name-button:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.row-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: var(--font-size-8); font-weight: 450; white-space: nowrap; }
.amount-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount-cell strong { color: var(--text); font-size: var(--font-size-10); font-weight: 700; }
.date-cell { white-space: nowrap; }
.tag-pill { max-width: 120px; padding: 4px 7px; display: inline-flex; align-items: center; gap: 5px; overflow: hidden; border-radius: 5px; color: var(--text-soft); background: color-mix(in srgb, var(--tag-color) 12%, var(--surface)); font-size: var(--font-size-8); white-space: nowrap; text-overflow: ellipsis; }
.tag-pill i, .legend-name i, .group-title > i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--tag-color); }
.untagged-label { color: var(--muted); }
.status-select { max-width: 88px; min-height: 25px; padding: 0 19px 0 7px; border: 1px solid transparent; border-radius: 6px; background-position: right 5px center; font-size: var(--font-size-8); font-weight: 700; text-transform: capitalize; cursor: pointer; }
.status-select:focus-visible { outline-offset: 1px; }
.status-pending { color: var(--amber); background-color: var(--amber-soft); }
.status-partial { color: var(--blue); background-color: var(--blue-soft); }
.status-cleared { color: var(--green); background-color: var(--green-soft); }
.table-search-row { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; }
.table-search { height: 33px; width: min(340px, 100%); }
.table-search input { font-size: var(--font-size-10); }
.text-button { padding: 5px 7px; border: 0; border-radius: 6px; color: var(--accent-ink); background: transparent; font-size: var(--font-size-10); font-weight: 650; }
.text-button:hover { background: var(--accent-soft); }
.filter-button { position: relative; }
.filter-button > i { width: 6px; height: 6px; position: absolute; top: 3px; right: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.bulk-toolbar { min-height: 35px; padding: 5px 8px; margin: 0 0 8px; display: flex; align-items: center; gap: 4px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); border-radius: 8px; background: var(--accent-soft); }
.bulk-toolbar > b { margin: 0 5px 0 2px; color: var(--accent-ink); font-size: var(--font-size-9); }
.bulk-spacer { flex: 1; }
.bulk-toolbar .button { min-height: 25px; font-size: var(--font-size-9); }
.table-no-matches { padding: 27px 12px; color: var(--muted); text-align: center; font-size: var(--font-size-10); }
.table-no-matches button { border: 0; color: var(--accent-ink); background: transparent; font-weight: 700; }
.empty-table-state { min-height: 125px; padding: 25px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-table-state strong { color: var(--text); font-size: var(--font-size-11); }
.empty-table-state > span { max-width: 270px; margin: 5px 0 8px; color: var(--muted); font-size: var(--font-size-9); }
.empty-table-state .text-button { font-size: var(--font-size-9); }
.empty-table-icon { width: 25px; height: 25px; margin-bottom: 8px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: var(--font-size-15); }

/* Collapsible tag groups and charts */
.tag-groups { display: flex; flex-direction: column; gap: 7px; }
.tag-group { overflow: hidden; border: 1px solid var(--border); border-left: 3px solid var(--group-color); border-radius: 9px; background: var(--surface); }
.tag-group > summary { min-height: 39px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text); background: color-mix(in srgb, var(--group-color) 8%, var(--surface)); cursor: pointer; list-style: none; }
.tag-group > summary::-webkit-details-marker { display: none; }
.group-title { display: inline-flex; align-items: center; gap: 8px; font-size: var(--font-size-9); font-weight: 720; }
.group-title > i { background: var(--group-color); }
.group-title small { min-width: 17px; height: 17px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 5px; color: var(--text-soft); background: var(--surface); font-size: var(--font-size-8); }
.group-total-wrap { margin-left: auto; display: inline-flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.group-total-wrap > strong { font-size: var(--font-size-10); font-variant-numeric: tabular-nums; }
.group-total-wrap > small { color: var(--text-soft); font-size: var(--font-size-9); font-variant-numeric: tabular-nums; }
.tag-group > summary > b { color: var(--muted); font-size: var(--font-size-12); transition: transform .16s ease; }
.tag-group:not([open]) > summary > b { transform: rotate(-90deg); }
.group-table-wrap { overflow-x: auto; }
.group-table-wrap .data-table { border-top: 1px solid var(--border); }
.spending-breakdown { margin: 28px 0 40px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.breakdown-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; padding-bottom: 17px; border-bottom: 1px solid var(--border); }
.breakdown-heading .eyebrow { margin-bottom: 5px; }
.breakdown-heading h2 { margin: 0 0 4px; font-size: var(--font-size-16); letter-spacing: -.4px; }
.breakdown-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: var(--font-size-9); }
.breakdown-total { color: var(--text-soft); font-size: var(--font-size-10); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.breakdown-content { min-height: 174px; padding: 20px 8px 5px; display: flex; align-items: center; gap: clamp(20px, 6vw, 80px); }
.chart-empty { width: 100%; padding: 32px 12px; color: var(--muted); font-size: var(--font-size-10); text-align: center; }
.chart-visual-wrap { width: 190px; min-width: 190px; position: relative; display: flex; align-items: center; justify-content: center; }
.donut-chart { width: 150px; height: 150px; display: grid; place-items: center; border-radius: 50%; background: var(--chart-background, var(--chart-empty)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.02); }
.donut-hole { width: 98px; height: 98px; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 5px rgba(20,25,45,.06); }
.donut-hole strong { max-width: 85px; overflow: hidden; color: var(--text); font-size: var(--font-size-14); font-weight: 750; letter-spacing: -.5px; text-overflow: ellipsis; white-space: nowrap; }
.donut-hole span { margin-top: 2px; color: var(--muted); font-size: var(--font-size-8); }
.chart-center-caption { position: absolute; top: calc(100% + 4px); left: 0; right: 0; display: flex; justify-content: center; gap: 5px; color: var(--muted); font-size: var(--font-size-8); }
.chart-center-caption strong { color: var(--text-soft); }
.chart-legend { min-width: 0; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; }
.legend-row { min-height: 33px; display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); font-size: var(--font-size-9); }
.legend-name { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--text-soft); white-space: nowrap; text-overflow: ellipsis; }
.legend-name i { width: 8px; height: 8px; background: var(--legend-color); }
.legend-row > strong { color: var(--text); font-size: var(--font-size-9); font-variant-numeric: tabular-nums; }
.legend-row > small { color: var(--muted); font-size: var(--font-size-8); text-align: right; }

/* Details inspector: all edits are drafts until the Save action. */
.details-content { min-width: 0; }
.details-placeholder { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.placeholder-icon { width: 44px; height: 44px; margin-bottom: 14px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: var(--accent-soft); font-size: var(--font-size-21); }
.details-placeholder h3 { margin: 0 0 6px; color: var(--text); font-size: var(--font-size-14); letter-spacing: -.25px; }
.details-placeholder p { max-width: 240px; margin: 0; color: var(--muted); font-size: var(--font-size-10); line-height: 1.65; }
.details-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 18px 0 4px; }
.details-heading .eyebrow { margin-bottom: 5px; font-size: var(--font-size-8); }
.details-heading h2 { max-width: 260px; margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: var(--font-size-19); letter-spacing: -.55px; line-height: 1.25; }
.details-status-dot { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.status-dot-partial { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.status-dot-cleared { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.editing-indicator { margin-top: 5px; padding: 4px 6px; border-radius: 5px; color: var(--accent-ink); background: var(--accent-soft); font-size: var(--font-size-7); font-weight: 800; letter-spacing: .9px; }
.details-meta { margin: 7px 0 17px; color: var(--muted); font-size: var(--font-size-9); }
.details-meta span { padding: 0 4px; }
.details-fields { display: flex; flex-direction: column; gap: 10px; }
.detail-readonly { min-width: 0; padding: 9px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--border); }
.detail-readonly > span { color: var(--muted); font-size: var(--font-size-9); }
.detail-readonly > strong { max-width: 65%; color: var(--text-soft); font-size: var(--font-size-10); font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.detail-emphasis > strong { color: var(--text); font-size: var(--font-size-16); letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.detail-tag-value { display: inline-flex; align-items: center; gap: 6px; }
.detail-tag-value i { width: 7px; height: 7px; border-radius: 50%; background: var(--tag-color); }
.detail-form-field { display: flex; flex-direction: column; gap: 5px; }
.detail-form-field > span { color: var(--text-soft); font-size: var(--font-size-9); font-weight: 650; }
.detail-form-field input, .detail-form-field select, .detail-form-field textarea { width: 100%; min-height: 35px; padding: 8px 9px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); background: var(--surface-soft); font-size: var(--font-size-10); }
.detail-form-field textarea { min-height: 66px; resize: vertical; line-height: 1.5; }
.detail-form-field input:focus, .detail-form-field select:focus, .detail-form-field textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.detail-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-computed { padding: 10px 11px; border-radius: 8px; background: var(--surface-soft); }
.detail-computed span { display: block; color: var(--muted); font-size: var(--font-size-8); }
.detail-computed strong { display: block; margin-top: 2px; color: var(--text); font-size: var(--font-size-12); font-variant-numeric: tabular-nums; }
.details-edit-actions { margin-top: 20px; padding-top: 13px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); }
.details-edit-actions .button-primary { flex: 1; }
.edit-hint { margin: 9px 0 0; color: var(--muted); font-size: var(--font-size-8); text-align: center; }
.details-record-footer { margin-top: 25px; padding-top: 11px; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--font-size-8); }
.details-mobile-header { display: none; }

/* Undo toast and modal surfaces. */
.toast { min-height: 48px; padding: 9px 12px 9px 15px; position: fixed; left: 50%; bottom: 23px; z-index: 60; display: flex; align-items: center; gap: 13px; border: 1px solid var(--border-strong); border-radius: 11px; color: var(--text); background: var(--surface-raised); box-shadow: var(--shadow-pop); transform: translateX(-50%); font-size: var(--font-size-12); animation: toast-in .2s ease-out; }
.toast button { padding: 6px 8px; border: 0; border-radius: 5px; color: var(--accent-ink); background: var(--accent-soft); font-size: var(--font-size-11); font-weight: 700; }
.toast button:last-child { padding: 3px 6px; color: var(--muted); background: transparent; font-size: var(--font-size-16); }
@keyframes pop-in { from { opacity: 0; transform: translateY(5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.app-dialog { width: min(94vw, 680px); max-height: min(88vh, 820px); padding: 24px; overflow: auto; border: 1px solid var(--border-strong); border-radius: 16px; color: var(--text); background: var(--surface); box-shadow: var(--shadow-pop); }
.app-dialog::backdrop { background: rgba(17, 22, 37, .48); backdrop-filter: blur(3px); }
.compact-dialog { width: min(94vw, 445px); }
.app-dialog form { margin: 0; }
.dialog-heading { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading .eyebrow { margin-bottom: 6px; }
.dialog-heading h2 { margin: 0 0 5px; font-size: var(--font-size-20); letter-spacing: -.6px; }
.dialog-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: var(--font-size-10); line-height: 1.5; }
.dialog-close { width: 29px; height: 29px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 7px; color: var(--muted); background: var(--surface-soft); font-size: var(--font-size-20); line-height: 1; }
.dialog-close:hover { color: var(--text); background: var(--border); }
.form-field { min-width: 0; margin-bottom: 13px; display: flex; flex-direction: column; gap: 6px; }
.form-field > span { color: var(--text-soft); font-size: var(--font-size-10); font-weight: 650; }
.form-field input, .form-field select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface-soft); font-size: var(--font-size-11); }
.form-field input:focus, .form-field select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-field input::placeholder { color: var(--muted); }
.form-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.dialog-actions { margin-top: 19px; padding-top: 14px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.dialog-actions > span { flex: 1; }
.tag-manager-layout { display: grid; grid-template-columns: minmax(160px, .85fr) minmax(250px, 1.15fr); gap: 18px; }
.tag-list-column { min-width: 0; }
.tag-list-heading { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: var(--font-size-10); font-weight: 700; }
.tag-list { max-height: 290px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.tag-list-item { min-height: 36px; padding: 5px 8px; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; color: var(--text-soft); background: transparent; text-align: left; font-size: var(--font-size-10); }
.tag-list-item:hover { background: var(--surface-soft); }
.tag-list-item.selected { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); color: var(--accent-ink); background: var(--accent-soft); }
.tag-list-item i { width: 9px; height: 9px; border-radius: 50%; background: var(--tag-color); }
.tag-list-empty { padding: 20px 8px; color: var(--muted); font-size: var(--font-size-9); text-align: center; }
.tag-editor { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.tag-editor-heading { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag-editor-heading > strong { color: var(--text); font-size: var(--font-size-11); }
.tag-preview { max-width: 130px; padding: 5px 8px; display: inline-flex; align-items: center; gap: 6px; overflow: hidden; border-radius: 6px; color: var(--text-soft); background: color-mix(in srgb, var(--tag-color, var(--accent)) 13%, var(--surface)); font-size: var(--font-size-8); white-space: nowrap; text-overflow: ellipsis; }
.tag-preview i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--tag-color, var(--accent)); }
.color-fieldset { padding: 0; margin: 15px 0 12px; border: 0; }
.color-fieldset legend { margin-bottom: 9px; color: var(--text-soft); font-size: var(--font-size-9); font-weight: 650; }
.color-palette { display: flex; flex-wrap: wrap; gap: 9px; }
.color-swatch { width: 24px; height: 24px; padding: 0; border: 3px solid var(--surface-soft); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--border-strong); }
.color-swatch.selected { box-shadow: 0 0 0 2px var(--accent); }
.field-error { margin: 0 0 8px; color: var(--red); font-size: var(--font-size-9); }
.tag-editor-actions { display: flex; align-items: center; gap: 5px; padding-top: 10px; border-top: 1px solid var(--border); }
.tag-editor-actions > span { flex: 1; }
.tag-editor-actions .button { min-height: 30px; padding: 0 8px; font-size: var(--font-size-9); }
.dialog-bottom-row { margin-top: 16px; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--font-size-8); }
.confirm-heading-group { min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.confirm-heading-group > div:last-child { min-width: 0; }
.confirm-mark { width: 32px; height: 32px; flex: 0 0 32px; margin: 1px 0 0; display: grid; place-items: center; border-radius: 9px; color: var(--red); background: var(--red-soft); font-weight: 800; }
#confirmDialog .dialog-heading { margin-bottom: 6px; }
#confirmDialog .dialog-actions { margin-top: 18px; }
#confirmDialog.confirm-with-alternate .dialog-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#confirmDialog.confirm-with-alternate .dialog-actions > button { min-width: 0; padding-left: 9px; padding-right: 9px; }
@media (max-width: 390px) {
    #confirmDialog.confirm-with-alternate .dialog-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #confirmDialog.confirm-with-alternate #confirmActionButton { grid-column: 1 / -1; }
}
#confirmDialog .dialog-heading h2 { font-size: var(--font-size-17); }

.visually-hidden { width: 1px; height: 1px; padding: 0; margin: -1px; position: absolute; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mobile-details-backdrop { display: none; }

/* Tablet layouts retain the table-first workflow and narrow the inspector. */
@media (max-width: 1180px) {
    :root { --detail-width: 340px; }
    .main-content { padding-left: 28px; padding-right: 28px; }
    .summary-grid { gap: 9px; }
    .summary-card { padding-left: 13px; padding-right: 13px; }
    .tables-column { padding-right: 15px; }
    .details-panel { padding: 18px 15px; }
    .data-table { min-width: 630px; }
}
@media (max-width: 900px) {
    :root { --topbar-height: 64px; }
    .topbar { height: 64px; }
    .main-content { padding-left: 22px; padding-right: 22px; }
    .screen { min-height: calc(100vh - 64px); }
    .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-layout { grid-template-columns: minmax(0, 1fr) 6px 310px; }
    .section-heading { align-items: flex-start; }
    .section-controls { flex-wrap: wrap; justify-content: flex-end; }
    .chart-legend { grid-template-columns: 1fr; }
    .breakdown-content { gap: 20px; }
}

/* Mobile: the details inspector becomes an accessible slide-over sheet. */
@media (max-width: 700px) {
    :root { --topbar-height: 60px; }
    .topbar { height: 60px; padding: 0 16px; }
    .brand-mark { width: 32px; height: 32px; }
    .brand-copy b { font-size: var(--font-size-17); }
    .topbar-actions { gap: 10px; }
    .cloud-save-status { font-size: var(--font-size-9); }
    .main-content { padding: 0 15px 28px; }
    .screen { min-height: calc(100vh - 60px); }
    .page-heading { padding: 32px 0 22px; align-items: flex-start; flex-direction: column; gap: 17px; }
    .page-heading h1 { font-size: var(--font-size-30); }
    .heading-subtitle { max-width: 360px; font-size: var(--font-size-12); }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .list-toolbar { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px 0; }
    .list-toolbar .search-field { width: 100%; }
    .budget-date-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .budget-date-filter { min-width: 0; }
    .budget-date-filter input { width: 100%; }
    .list-toolbar-right { justify-content: flex-end; }
    .budget-grid { grid-template-columns: 1fr; gap: 10px; padding: 17px 0 35px; }
    .pinned-budgets-section { margin-top: 16px; padding: 0 12px 1px; }
    .pinned-budget-grid { padding-bottom: 12px; }
    .budget-card { min-height: 118px; }
    .budget-card-main { min-height: 116px; padding: 16px 18px; }
    .budget-card-main strong { margin-top: 10px; font-size: var(--font-size-17); }
    .empty-state { padding: 36px 12px 65px; }
    .empty-state h2 { font-size: var(--font-size-21); }
    .app-footer { padding-top: 15px; gap: 10px; flex-direction: column; font-size: var(--font-size-9); }
    .budget-view-header { min-height: 76px; padding: 17px 0 13px; align-items: flex-start; }
    .budget-title-wrap { gap: 9px; }
    .budget-title-wrap .back-button { width: 34px; height: 34px; }
    .budget-title-wrap h1 { max-width: 48vw; font-size: var(--font-size-20); }
    .budget-title-wrap .eyebrow { font-size: var(--font-size-7); }
    .budget-actions { gap: 5px; }
    .budget-actions .button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
    .budget-actions .button-label { display: none; }
    .budget-actions .icon-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
    .budget-actions .more-menu button { min-height: 44px; padding: 0 12px; font-size: var(--font-size-12); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 15px; }
    .summary-card { min-height: 88px; padding: 10px 11px; }
    .summary-card > strong { margin-top: 6px; font-size: var(--font-size-19); }
    .summary-card > small { font-size: var(--font-size-8); }
    .workspace-layout { display: block; min-height: 0; }
    .tables-column { padding-right: 0; }
    .resize-handle { display: none; }
    .details-panel { width: min(92vw, 430px); height: 100dvh; min-height: 0; padding: 0 18px 26px; position: fixed; top: 0; right: 0; z-index: 51; overflow-y: auto; border: 0; border-left: 1px solid var(--border); border-radius: 16px 0 0 16px; background: var(--surface); box-shadow: var(--shadow-pop); transform: translateX(105%); transition: transform .24s cubic-bezier(.2,.8,.2,1); }
    .details-panel.mobile-open { transform: translateX(0); }
    .details-mobile-header { height: 60px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-size: var(--font-size-11); font-weight: 700; }
    .details-mobile-header .back-button { width: 32px; height: 32px; }
    .details-mobile-header .back-button svg { transform: rotate(180deg); }
    .details-panel .details-panel-heading { display: none; }
    .details-content { padding-bottom: 15px; }
    .details-placeholder { min-height: 50vh; }
    .mobile-details-backdrop { position: fixed; inset: 0; z-index: 50; display: block; background: rgba(12,17,30,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    .mobile-details-backdrop.visible { opacity: 1; pointer-events: auto; }
    .section-heading { min-height: 48px; margin-bottom: 7px; align-items: center; }
    .section-title-wrap { gap: 7px; }
    .section-symbol { width: 27px; height: 27px; }
    .section-title-wrap h2 { font-size: var(--font-size-13); }
    .section-title-wrap p { display: none; }
    .section-controls { gap: 3px; flex-wrap: nowrap; }
    .view-toggle { padding: 0 6px; min-height: 29px; gap: 4px; }
    .view-toggle-text { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .section-controls .button { padding: 0 7px; }
    .data-section { margin-bottom: 17px; }
    .table-card { border-radius: 9px; }
    .data-table { min-width: 620px; }
    .spending-breakdown { margin: 20px 0 40px; padding: 16px 13px; }
    .breakdown-heading { align-items: flex-start; flex-direction: column; gap: 7px; padding-bottom: 12px; }
    .breakdown-heading h2 { font-size: var(--font-size-15); }
    .breakdown-content { padding: 18px 0 5px; flex-direction: column; gap: 12px; }
    .chart-visual-wrap { min-height: 177px; }
    .chart-legend { width: 100%; grid-template-columns: 1fr; }
    .legend-row { min-height: 31px; }
    .toast { bottom: 17px; width: max-content; max-width: calc(100vw - 30px); font-size: var(--font-size-11); }
    .app-dialog { padding: 19px; }
    .share-add-row { grid-template-columns: minmax(0, 1fr) 105px; gap: 9px; }
    .share-add-button { grid-column: 1 / -1; width: 100%; }
    .share-list-row { grid-template-columns: minmax(0, 1fr) 88px 57px; gap: 7px; }
    .share-person { gap: 7px; }
    .share-avatar { width: 27px; height: 27px; flex-basis: 27px; }
    .share-person-email { font-size: var(--font-size-10); }
    .tag-manager-layout { grid-template-columns: 1fr; }
    .tag-list { max-height: 140px; }
    .tag-editor { padding: 12px; }
}
@media (max-width: 390px) {
    .main-content { padding-left: 11px; padding-right: 11px; }
    .budget-title-wrap h1 { max-width: 43vw; font-size: var(--font-size-18); }
    .budget-actions .button { width: 40px; min-width: 40px; min-height: 40px; height: 40px; padding: 0; }
    .summary-card > strong { font-size: var(--font-size-17); }
    .section-controls { gap: 2px; }
    .section-controls .icon-button { width: 27px; height: 27px; }
    .view-toggle { max-width: 83px; }
    .view-toggle-text { max-width: 42px; }
    .form-grid-two { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Field styling for the editable inspector and partial-payment inputs. */
.detail-field { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.detail-field > span { color: var(--text-soft); font-size: var(--font-size-9); font-weight: 650; }
.detail-field input, .detail-field select, .detail-field textarea { width: 100%; min-height: 35px; padding: 8px 9px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); background: var(--surface-soft); font-size: var(--font-size-10); }
.detail-field textarea { min-height: 68px; resize: vertical; line-height: 1.5; }
.detail-field input:focus, .detail-field select:focus, .detail-field textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.detail-field > small { color: var(--muted); font-size: var(--font-size-8); }
.money-input-wrap { position: relative; }
.money-input-wrap > b { position: absolute; top: 50%; left: 10px; z-index: 1; color: var(--muted); font-size: var(--font-size-10); font-weight: 550; transform: translateY(-50%); pointer-events: none; }
.money-input-wrap input { padding-left: 25px; font-variant-numeric: tabular-nums; }
.full-field { width: 100%; }
.detail-notes { display: block; }
.detail-notes p { margin: 7px 0 0; color: var(--text-soft); font-size: var(--font-size-10); line-height: 1.6; overflow-wrap: anywhere; }
.status-badge { padding: 4px 7px; display: inline-block; border-radius: 5px; font-size: var(--font-size-8); font-weight: 750; }
.status-badge.status-pending { color: var(--amber); background: var(--amber-soft); }
.status-badge.status-partial { color: var(--blue); background: var(--blue-soft); }
.status-badge.status-cleared { color: var(--green); background: var(--green-soft); }
.status-badge.status-readonly { font-size: var(--font-size-details-small); }

/* Keep long tables scrollable so their column headers stay in view. */
.table-container { max-height: 420px; overflow: auto; }
.data-table thead th { position: sticky; top: 0; z-index: 3; }
.group-table-wrap { max-height: 310px; overflow: auto; }
.data-row.drag-over td, .data-row.drag-target td { background: var(--accent-soft) !important; box-shadow: inset 0 2px var(--accent); }
.details-panel { position: sticky; top: calc(var(--topbar-height) + 18px); align-self: start; max-height: calc(100vh - var(--topbar-height) - 36px); overflow-y: auto; }
@media (max-width: 700px) { .details-panel { position: fixed; top: 0; max-height: 100dvh; overflow-y: auto; align-self: stretch; } }
.tag-group > summary, .data-row { -webkit-tap-highlight-color: transparent; }
@media (max-width: 700px) {
    .details-panel { visibility: hidden; transition: transform .24s cubic-bezier(.2,.8,.2,1), visibility 0s linear .24s; }
    .details-panel.mobile-open { visibility: visible; transition: transform .24s cubic-bezier(.2,.8,.2,1), visibility 0s; }
    body.details-open { overflow: hidden; }
}


/* Budget items expand vertically; only horizontal overflow is retained when necessary. */
.items-section .table-container { max-height: none; overflow-x: auto; overflow-y: clip; }
.items-section .tag-groups,
.items-section .tag-group,
.items-section .group-table-wrap { max-height: none; overflow: visible; }

/* Controls directly above each data table. */
.table-actionbar { min-height: 38px; margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.table-actionbar .button { min-height: 32px; }
.bulk-toolbar .table-select-all { margin: 0; }

/* The spending chart is displayed in a dedicated dialog rather than the workspace column. */
.breakdown-dialog { width: min(94vw, 760px); }
.breakdown-dialog-content { margin: 0; padding: 16px 18px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.breakdown-dialog-content .breakdown-heading { min-height: 0; padding: 0; border: 0; }
.breakdown-dialog-content .breakdown-content { padding-top: 17px; }
@media (max-width: 700px) {
    .table-actionbar { min-height: 35px; }
    .table-actionbar .button { padding: 0 9px; }
    .breakdown-dialog { padding: 18px 15px; }
    .breakdown-dialog-content { padding: 13px 10px; }
}

/* Row-level edit, duplicate, and delete actions replace the old inspector actions. */
.data-table { table-layout: fixed; }
.data-table-income { min-width: 680px; }
.data-table-items { min-width: 620px; }
.data-table col.drag-column { width: 27px; }
.data-table col.select-column { width: 31px; }
.data-table col.actions-column { width: 88px; }
.data-table-income col.name-column { width: 165px; }
.data-table-income col.amount-column { width: 100px; }
.data-table-income col.date-column { width: 91px; }
.data-table-income col.tag-column { width: 112px; }
.data-table-income col.status-column { width: 82px; }
.data-table-items col.name-column { width: 180px; }
.data-table-items col.amount-column { width: 105px; }
.data-table-items col.tag-column { width: 125px; }
.data-table-items col.status-column { width: 88px; }
.data-table th.name-column,
.data-table td.name-cell,
.data-table th.amount-column,
.data-table td.amount-cell,
.data-table th.date-column,
.data-table td.date-cell,
.data-table th.tag-column,
.data-table td.tag-cell,
.data-table th.status-column,
.data-table td.status-cell,
.data-table th.actions-column,
.data-table td.actions-cell { overflow: hidden; }
.data-table td.name-cell { min-width: 0; }
.data-table td.status-cell { white-space: nowrap; }
.data-table th.actions-column,
.data-table td.actions-cell { padding-left: 5px; padding-right: 7px; text-align: right; }
.row-action-controls { display: flex; align-items: center; justify-content: flex-end; gap: 3px; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .14s ease, visibility .14s ease; }
.row-action-button { width: 23px; height: 25px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid transparent; border-radius: 6px; color: var(--text-soft); background: transparent; font-size: var(--font-size-12); line-height: 1; }
.row-action-button:hover { color: var(--accent-ink); border-color: var(--border); background: var(--surface); }
.row-action-button.row-action-danger { color: var(--red); }
.row-action-button.row-action-danger:hover { border-color: var(--red-soft); background: var(--red-soft); }
@media (hover: hover) and (pointer: fine) {
    .data-row:hover .row-action-controls,
    .data-row:focus-within .row-action-controls,
    .data-row:focus-visible .row-action-controls { opacity: 1; visibility: visible; pointer-events: auto; }
}
@media (hover: none), (pointer: coarse) {
    .row-action-controls { opacity: 1; visibility: visible; pointer-events: auto; }
}
.data-table th.actions-column { color: var(--muted); font-size: var(--font-size-8); font-weight: 750; letter-spacing: .25px; text-align: right; }


/* Viewport-sticky table header used when a table scrolls behind the page viewport. */
.sticky-table-header-overlay {
    position: fixed;
    top: var(--topbar-height);
    z-index: 30;
    overflow: hidden;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-top: 0;
    box-shadow: 0 4px 12px rgba(20, 28, 48, .08);
    pointer-events: none;
}
.sticky-table-header-overlay .sticky-table-clone {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    text-align: left;
    font-size: var(--font-size-10);
    background: var(--surface-soft);
}
.sticky-table-header-overlay .sticky-table-clone th {
    height: 37px;
    padding: 0 9px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface-soft);
    font-size: var(--font-size-8);
    font-weight: 750;
    letter-spacing: .25px;
    white-space: nowrap;
}
.sticky-table-header-overlay .sticky-table-clone th:first-child { padding-left: 11px; }
.sticky-table-header-overlay .sticky-table-clone th:last-child { padding-right: 12px; }
.sticky-table-header-overlay .sticky-table-clone .table-sort-button { pointer-events: auto; }

/* Summary-card explanations: mouse hover and keyboard focus expose the same tooltip. */
.summary-card-top { gap: 8px; }
.summary-help {
    width: 20px;
    height: 20px;
    padding: 0;
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--muted);
    background: var(--surface);
    font-size: var(--font-size-10);
    font-weight: 800;
    line-height: 1;
    cursor: help;
}
.summary-help:hover,
.summary-help:focus-visible {
    color: var(--accent-ink);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.summary-help::after {
    content: attr(data-tooltip);
    width: min(275px, 72vw);
    padding: 10px 12px;
    position: absolute;
    top: calc(100% + 9px);
    right: -7px;
    z-index: 80;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--surface);
    background: var(--text);
    box-shadow: var(--shadow-pop);
    font-size: var(--font-size-12);
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
    pointer-events: none;
}
.summary-help:hover::after,
.summary-help:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Table typography is two pixels larger for row content and column headings. */
.data-table { font-size: var(--font-size-table-body); }
.data-table th,
.data-table th.actions-column,
.table-sort-button { font-size: var(--font-size-table-header); }
.table-sort-button span { font-size: var(--font-size-table-secondary); }
.row-name-button,
.amount-cell strong { font-size: var(--font-size-table-body); }
.row-subtext,
.tag-pill,
.status-select { font-size: var(--font-size-table-secondary); }
.sticky-table-header-overlay .sticky-table-clone { font-size: var(--font-size-table-body); }
.sticky-table-header-overlay .sticky-table-clone th { font-size: var(--font-size-table-header); }

/* The details inspector uses the same 16px inset on desktop and mobile. */
.details-panel { padding: 16px; }
.details-panel .details-panel-heading h2 { font-size: var(--font-size-16); }
.details-panel .button { font-size: var(--font-size-14); }
.details-panel .details-panel-heading > span { font-size: var(--font-size-details-small); }
.details-panel .details-placeholder h3 { font-size: var(--font-size-details-placeholder); }
.details-panel .details-placeholder p { font-size: var(--font-size-details-body); }
.details-panel .details-heading .eyebrow { font-size: var(--font-size-details-small); }
.details-panel .details-heading h2 { font-size: var(--font-size-details-title); }
.details-panel .details-meta { font-size: var(--font-size-details-label); }
.details-panel .detail-readonly > span,
.details-panel .detail-field > span { font-size: var(--font-size-details-label); }
.details-panel .detail-readonly > strong,
.details-panel .detail-field input,
.details-panel .detail-field select,
.details-panel .detail-field textarea,
.details-panel .detail-notes p { font-size: var(--font-size-details-body); }
.details-panel .detail-emphasis > strong { font-size: var(--font-size-18); }
.details-panel .detail-field > small,
.details-panel .edit-hint,
.details-panel .details-record-footer,
.details-panel .detail-computed span { font-size: var(--font-size-details-small); }
.details-panel .detail-computed strong { font-size: var(--font-size-14); }
.details-panel .status-badge { font-size: var(--font-size-details-small); }

/* Keep the tables full-height: the viewport-pinned headers do not need nested vertical scrolling. */
.table-container { max-height: none; overflow-x: auto; overflow-y: visible; }
.group-table-wrap { max-height: none; overflow-x: auto; overflow-y: visible; }

@media (prefers-reduced-motion: reduce) {
    .summary-help::after { transition: none; }
}

/* Separate the desktop details inspector from the resize divider. */
.details-panel { margin-left: 8px; }
@media (max-width: 700px) { .details-panel { margin-left: 0; } }


/* Quick-add links at the bottom of each table keep the add action reachable after scrolling. */
.table-bottom-add-wrap {
    display: flex;
    justify-content: flex-start;
    padding: 8px 2px 0;
}
.table-bottom-add {
    min-height: 32px;
    padding: 3px 7px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 7px;
    color: var(--accent-ink);
    background: transparent;
    font: inherit;
    font-size: var(--font-size-12);
    font-weight: 700;
    cursor: pointer;
    transition: background .14s ease, color .14s ease;
}
.table-bottom-add:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.table-bottom-add:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
.table-bottom-add span {
    font-size: var(--font-size-16);
    line-height: 1;
}

/* The read-only details view has a direct Edit action on desktop and mobile. */
.details-view-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}
.details-view-actions .button {
    min-width: 104px;
}
@media (max-width: 700px) {
    .table-bottom-add-wrap { padding-top: 6px; }
    .table-bottom-add { min-height: 36px; }
    .details-view-actions { margin-top: 16px; }
}


/* Version 1.0 refinements: interactive breakdown, viewport-safe help, and item allocation toggles. */
.summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.allocation-summary .summary-card-top .summary-help { flex: 0 0 auto; }
.summary-card-pair { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 4px; color: var(--text-soft); font-size: var(--font-size-11); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-card-pair > span { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; white-space: nowrap; }
.summary-card-pair strong { color: var(--text); font-size: var(--font-size-13); font-weight: 750; }
.allocation-summary > small { display: block; margin-top: 3px; }

/* Summary help is a real fixed-position tooltip so it cannot be clipped by mobile cards. */
.summary-help::after { display: none !important; }
.summary-tooltip {
    max-width: calc(100vw - 24px);
    padding: 10px 12px;
    position: fixed;
    z-index: 120;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--surface);
    background: var(--text);
    box-shadow: var(--shadow-pop);
    font-size: var(--font-size-12);
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    pointer-events: none;
}

/* The breakdown dialog chart is 1.5x its former 150px size and uses individually focusable slices. */
.breakdown-dialog { width: min(94vw, 900px); }
.breakdown-dialog-content .breakdown-content { align-items: flex-start; gap: clamp(28px, 6vw, 70px); }
.breakdown-dialog-content .chart-visual-wrap {
    width: 285px;
    min-width: 285px;
    min-height: 310px;
    padding-top: 22px;
    position: relative;
    overflow: visible;
}
.breakdown-dialog-content .donut-chart {
    width: 225px;
    height: 225px;
    overflow: visible;
    display: block;
    margin: 0 auto;
    border-radius: 0;
    background: none;
    box-shadow: none;
}
.chart-slice { cursor: pointer; transition: opacity .14s ease, filter .14s ease, stroke-width .14s ease; outline: none; }
.chart-slice:hover,
.chart-slice:focus-visible { opacity: .94; filter: brightness(1.13); stroke-width: 48px; }
.chart-slice-tooltip {
    min-width: 190px;
    max-width: min(255px, calc(100vw - 55px));
    padding: 9px 12px;
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transform: translateX(-50%);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--surface);
    background: var(--text);
    box-shadow: var(--shadow-pop);
    font-size: var(--font-size-11);
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
}
.chart-slice-tooltip strong { font-size: var(--font-size-12); font-weight: 750; }
.chart-slice-tooltip span { font-variant-numeric: tabular-nums; }
.chart-slice-tooltip small { color: color-mix(in srgb, var(--surface) 78%, transparent); font-size: var(--font-size-10); }
.breakdown-dialog-content .donut-hole {
    width: 146px;
    height: 146px;
    position: absolute;
    top: 164.5px;
    left: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.breakdown-dialog-content .donut-hole strong { max-width: 126px; font-size: var(--font-size-16); }
.breakdown-dialog-content .chart-center-caption { top: 283px; }

/* Boolean budget-item properties use accessible checkbox-backed switch controls. */
.detail-toggle-field {
    min-height: 55px;
    padding: 10px 11px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    cursor: pointer;
}
.detail-toggle-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.detail-toggle-copy strong { color: var(--text-soft); font-size: var(--font-size-details-label); font-weight: 700; }
.detail-toggle-copy small { color: var(--muted); font-size: var(--font-size-details-small); line-height: 1.35; }
.detail-toggle-field input[type="checkbox"] {
    width: 1px;
    height: 1px;
    margin: 0;
    position: absolute;
    opacity: 0;
}
.detail-toggle-track {
    width: 39px;
    height: 23px;
    flex: 0 0 auto;
    position: relative;
    border: 1px solid var(--border-strong);
    border-radius: 99px;
    background: var(--border-strong);
    transition: background .16s ease, border-color .16s ease;
}
.detail-toggle-track::after {
    content: "";
    width: 17px;
    height: 17px;
    position: absolute;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .16s ease;
}
.detail-toggle-field input:checked + .detail-toggle-track { border-color: var(--accent); background: var(--accent); }
.detail-toggle-field input:checked + .detail-toggle-track::after { transform: translateX(16px); }
.detail-toggle-field input:focus-visible + .detail-toggle-track { outline: 3px solid color-mix(in srgb, var(--accent) 72%, white); outline-offset: 2px; }

@media (max-width: 1180px) {
    .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card-pair { font-size: var(--font-size-10); }
    .summary-card-pair strong { font-size: var(--font-size-12); }
    .breakdown-dialog { width: min(94vw, 560px); }
    .breakdown-dialog-content .breakdown-content { align-items: center; gap: 14px; }
    .breakdown-dialog-content .chart-visual-wrap { width: min(285px, 86vw); min-width: 0; min-height: 310px; }
    .breakdown-dialog-content .donut-chart { width: min(225px, 70vw); height: min(225px, 70vw); }
    .breakdown-dialog-content .donut-hole { width: min(146px, 45vw); height: min(146px, 45vw); }
    .breakdown-dialog-content .chart-center-caption { top: 283px; }
}

/* Budget-wide notes dialog. Notes remain part of the budget project object. */
.budget-notes-dialog { width: min(94vw, 680px); }
.budget-notes-field { margin-bottom: 0; }
.budget-notes-textarea {
    width: 100%;
    min-height: 250px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface-soft);
    font: inherit;
    font-size: var(--font-size-14);
    line-height: 1.6;
    resize: vertical;
}
.budget-notes-textarea::placeholder { color: var(--muted); }
.budget-notes-textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 700px) {
    .budget-notes-dialog { padding: 19px; }
    .budget-notes-textarea { min-height: 220px; }
}

/* SamePage 2.0 cloud account controls */
.cloud-account-button { min-height: 32px; padding: 0 12px; border-radius: 8px; font-size: var(--font-size-10); }
.auth-dialog { width: min(94vw, 455px); }
.auth-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 19px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.auth-mode-switch button { min-height: 34px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: inherit; font-size: var(--font-size-10); font-weight: 700; }
.auth-mode-switch button.active { color: var(--accent-ink); background: var(--surface); box-shadow: 0 1px 4px rgba(20, 25, 45, .10); }
.auth-dialog .form-field { margin-bottom: 14px; }
.auth-dialog .form-field > span small { color: var(--muted); font-size: inherit; font-weight: 500; }
.auth-security-note { min-width: 0; color: var(--muted); font-size: var(--font-size-8); line-height: 1.4; }
.auth-error { margin: 2px 0 0; padding: 9px 10px; border: 1px solid var(--red-soft); border-radius: 7px; background: var(--red-soft); line-height: 1.45; }
.account-identity { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.account-avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; color: var(--accent-ink); background: var(--accent-soft); font-size: 18px; font-weight: 800; }
.account-identity > div:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.account-identity strong { overflow-wrap: anywhere; color: var(--text); font-size: var(--font-size-11); }
.account-identity span { color: var(--muted); font-size: var(--font-size-9); }
.account-identity span.account-plan-free, .account-identity span.account-plan-premium { width: fit-content; margin-top: 2px; padding: 3px 7px; border-radius: 999px; font-size: var(--font-size-8); font-weight: 800; letter-spacing: .45px; }
.account-identity span.account-plan-free { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.account-identity span.account-plan-premium { color: var(--accent-ink); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border)); }
.upgrade-dialog { width: min(94vw, 475px); }
.upgrade-feature-list { display: grid; gap: 11px; margin: 2px 0 17px; }
.upgrade-feature-list > div { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.upgrade-feature-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--accent-ink); background: var(--accent-soft); font-size: var(--font-size-14); font-weight: 800; }
.upgrade-feature-list > div > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upgrade-feature-list strong { color: var(--text); font-size: var(--font-size-10); }
.upgrade-feature-list small { color: var(--muted); font-size: var(--font-size-9); line-height: 1.4; }
.upgrade-coming-soon { margin: 0; padding: 10px 11px; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: var(--font-size-9); line-height: 1.5; }

.account-sync-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 1px 10px; color: var(--text-soft); font-size: var(--font-size-10); }
.account-sync-info strong { color: var(--accent-ink); font-size: var(--font-size-10); }
.account-help { margin: 4px 0 13px; color: var(--muted); font-size: var(--font-size-9); line-height: 1.55; }
.account-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 13px; border-top: 1px solid var(--border); }
.account-actions .button:last-child { margin-left: auto; }
@media (max-width: 700px) {
    .topbar { padding-left: 16px; padding-right: 16px; }
    .topbar-actions { gap: 9px; }
    .cloud-account-button { min-height: 31px; padding: 0 9px; }
    .cloud-save-status { font-size: 0; gap: 0; }
    .cloud-save-status i { width: 8px; height: 8px; }
}
@media (max-width: 390px) {
    .topbar-actions { gap: 7px; }
    .brand-copy b { font-size: 17px; }
    .cloud-account-button { font-size: 10px; }
}

/* SamePage 2.0.2 — dashboard overview styling. */
.budget-overview { display: block; width: 100%; box-sizing: border-box; }
.budget-overview-metrics { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.budget-progress-track { display: block !important; width: 100%; height: 16px !important; min-height: 16px; box-sizing: border-box; flex: none; }
.budget-progress-fill { display: block; height: 100% !important; min-height: 100%; }
.summary-grid { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

/* SamePage 2.0 — unified Budget Overview and compact three-card summary row. */
.budget-overview {
    margin: 3px 0 12px;
    padding: 19px 22px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 2px 7px rgba(15, 22, 42, .035);
}
.budget-overview-heading { margin-bottom: 16px; }
.budget-overview-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: var(--font-size-15);
    font-weight: 750;
    letter-spacing: -.2px;
}
.budget-overview-metrics {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 14px;
    padding-bottom: 17px;
}
.budget-overview-metric { min-width: 0; }
.budget-overview-planned { text-align: center; }
.budget-overview-remaining { text-align: right; }
.budget-overview-label {
    min-height: 21px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    color: var(--text-soft);
    font-size: var(--font-size-10);
    font-weight: 700;
    letter-spacing: .15px;
    text-transform: uppercase;
}
.budget-overview-planned .budget-overview-label { justify-content: center; }
.budget-overview-remaining .budget-overview-label { justify-content: flex-end; }
.budget-overview-metric > strong {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: clamp(22px, 2.5vw, 29px);
    font-weight: 780;
    letter-spacing: -.85px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.budget-overview-remaining > strong.negative-value { color: var(--red) !important; }
.budget-progress-track {
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
    box-shadow: inset 0 0 0 1px var(--border);
}
.budget-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .28s ease, background-color .2s ease;
}
.budget-progress-track.is-over-budget .budget-progress-fill { background: var(--red); }
.budget-progress-track.no-income-baseline .budget-progress-fill { background: var(--muted); }
.budget-progress-meta {
    min-height: 19px;
    margin-top: 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-soft);
    font-size: var(--font-size-10);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
#budgetProgressLabel { color: var(--muted); }
.budget-progress-meta > span:last-child { text-align: right; color: var(--muted); }
.budget-over-budget {
    margin-top: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--red);
    font-size: var(--font-size-10);
    font-weight: 650;
}
.budget-over-budget[hidden] { display: none; }
.budget-over-budget-copy { min-width: 0; }
.budget-over-budget-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid var(--red-soft);
    border-radius: 999px;
    color: var(--red);
    background: var(--red-soft);
    font-size: var(--font-size-9);
    font-weight: 750;
    white-space: nowrap;
}
.summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 22px;
}
.summary-grid .summary-card { min-width: 0; }

@media (max-width: 900px) {
    .budget-overview { padding: 17px 18px 15px; }
    .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .budget-overview {
        margin-top: 2px;
        margin-bottom: 10px;
        padding: 15px 13px 13px;
        border-radius: 12px;
    }
    .budget-overview-heading { margin-bottom: 13px; }
    .budget-overview-heading h2 { font-size: var(--font-size-14); }
    .budget-overview-metrics { gap: 5px; padding-bottom: 14px; }
    .budget-overview-label {
        min-height: 19px;
        gap: 4px;
        font-size: 8px;
        letter-spacing: 0;
    }
    .budget-overview-label .summary-help { width: 16px; height: 16px; font-size: 9px; }
    .budget-overview-metric > strong {
        margin-top: 4px;
        font-size: clamp(12px, 4.05vw, 19px);
        letter-spacing: -.55px;
    }
    .budget-progress-track { height: 13px; }
    .budget-progress-meta { margin-top: 8px; gap: 8px; font-size: var(--font-size-10); }
    .budget-over-budget { margin-top: 9px; align-items: flex-start; gap: 7px; font-size: 9px; }
    .budget-over-budget-badge { padding: 4px 7px; font-size: 8px; }
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
        margin-bottom: 15px;
    }
    .summary-grid .summary-card { min-height: 86px; padding: 9px 8px; }
    .summary-grid .summary-card-top { gap: 4px; font-size: 8px; }
    .summary-grid .summary-card-top .summary-help { width: 16px; height: 16px; font-size: 9px; }
    .summary-grid .summary-card > strong { margin-top: 6px; font-size: clamp(12px, 3.8vw, 17px); letter-spacing: -.45px; }
    .summary-grid .summary-card > small { font-size: 7px; line-height: 1.3; }
    .summary-grid .summary-card-pair { margin-top: 7px; gap: 4px; font-size: 8px; }
    .summary-grid .summary-card-pair > span { gap: 3px; }
    .summary-grid .summary-card-pair strong { font-size: 9px; }
}
@media (max-width: 390px) {
    .budget-overview { padding-left: 11px; padding-right: 11px; }
    .budget-overview-metrics { gap: 3px; }
    .budget-overview-label { gap: 3px; font-size: 7px; }
    .budget-overview-label .summary-help { width: 15px; height: 15px; }
    .budget-overview-metric > strong { font-size: clamp(11px, 3.7vw, 15px); letter-spacing: -.45px; }
    .summary-grid { gap: 6px; }
    .summary-grid .summary-card { padding-left: 7px; padding-right: 7px; }
    .summary-grid .summary-card-top { font-size: 7px; }
    .summary-grid .summary-card > strong { font-size: clamp(11px, 3.5vw, 14px); }
    .summary-grid .summary-card-pair { font-size: 7px; }
    .summary-grid .summary-card-pair strong { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .budget-progress-fill { transition: none; }
}


/* Budget date ranges for Timed budgets. */
.budget-title-content { min-width: 0; }
.budget-heading-line { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; row-gap: 2px; }
.budget-title-wrap h1 { max-width: min(56vw, 700px); }
.budget-header-date-range { display: inline-block; color: var(--text-soft); font-size: var(--font-size-12); font-weight: 500; line-height: 1.4; white-space: normal; }
.budget-header-date-range[hidden] { display: none; }
.budget-card-date-range { display: block; max-width: 100%; margin-top: 5px; overflow-wrap: anywhere; color: var(--text-soft); font-size: var(--font-size-12); font-weight: 500; line-height: 1.35; }
.budget-date-fields { margin-top: 2px; }
.budget-date-fields .form-field { margin-bottom: 7px; }
.budget-date-fields .form-field > span small { color: var(--muted); font-size: var(--font-size-9); font-weight: 500; }
.budget-date-range-hint { margin: 0 0 9px; color: var(--muted); font-size: var(--font-size-9); line-height: 1.45; }
.budget-date-range-error { margin: 0 0 8px; }
#budgetStartDateInput[aria-invalid="true"], #budgetEndDateInput[aria-invalid="true"] { border-color: var(--red); }
@media (max-width: 700px) {
    .budget-heading-line { column-gap: 7px; row-gap: 3px; }
    .budget-header-date-range { font-size: var(--font-size-12); }
}
@media (max-width: 390px) {
    .budget-date-fields { grid-template-columns: 1fr; gap: 0; }
    .budget-card-date-range { font-size: var(--font-size-11); }
}


/* Notes: preserve paragraph line breaks and expose note text through viewport-safe tooltips. */
.details-panel .detail-notes p { white-space: pre-wrap; overflow-wrap: anywhere; }
.row-name-line { min-width: 0; display: flex; align-items: center; gap: 6px; }
.row-name-line .row-name-button { min-width: 0; max-width: 100%; flex: 0 1 auto; }
.note-tooltip-trigger {
    width: 17px;
    height: 17px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 17px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: var(--font-size-9);
    font-weight: 800;
    line-height: 1;
    cursor: help;
}
.note-tooltip-trigger:hover,
.note-tooltip-trigger:focus-visible {
    color: var(--accent-ink);
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}
.budget-card-name-row {
    max-width: calc(100% - 15px);
    min-width: 0;
    margin-top: 19px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.budget-card-name-row strong { min-width: 0; max-width: 100%; margin-top: 0; }
.budget-card-note-indicator { flex: 0 0 18px; width: 18px; height: 18px; }
.summary-tooltip.note-tooltip-active {
    max-width: calc(100vw - 24px);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
@media (max-width: 700px) {
    .budget-card-name-row { margin-top: 10px; }
}


/* Filter/search result counts displayed above and below budget lists and tables. */
.filter-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--amber);
    font-size: var(--font-size-10);
    font-weight: 700;
    line-height: 1.45;
}
.filter-status-icon {
    display: block;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.filter-status[hidden] { display: none; }
.table-filter-status-top { margin: 3px 1px 8px; }
.table-filter-status-bottom { margin: 8px 1px 4px; }
.budget-filter-status-top { margin: 0 0 10px; }
.budget-filter-status-bottom { margin: -2px 0 8px; }
@media (max-width: 700px) {
    .table-filter-status-top { margin: 2px 0 7px; }
    .table-filter-status-bottom { margin: 7px 0 4px; }
    .budget-filter-status-top { margin-bottom: 8px; }
    .budget-filter-status-bottom { margin-bottom: 5px; }
}


/* Online-only account and connectivity gate. */
.app-access-gate { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.app-access-gate[hidden] { display: none !important; }
.app-access-card { width: min(100%, 440px); padding: clamp(25px, 5vw, 42px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-pop); text-align: center; }
.app-access-mark { width: 48px; height: 48px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 15px; color: var(--accent-ink); background: var(--accent-soft); font-size: 24px; font-weight: 750; }
.app-access-card .eyebrow { margin: 0 0 9px; color: var(--muted); font-size: var(--font-size-9); font-weight: 750; letter-spacing: .14em; }
.app-access-card h1 { margin: 0; color: var(--text); font-size: clamp(23px, 5vw, 29px); letter-spacing: -.035em; }
.app-access-card p:not(.eyebrow) { margin: 12px 0 22px; color: var(--text-soft); font-size: var(--font-size-12); line-height: 1.65; }
.app-access-card .button { min-width: 190px; }

.limit-dialog { width: min(94vw, 460px); }

/* Savings breakdowns */
.savings-summary { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:4px 0 22px; padding:20px 23px; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.savings-summary span,.savings-total span,.savings-unassigned span { color:var(--muted); font-size:var(--font-size-11); font-weight:650; }
.savings-summary strong { color:var(--text); font-size:var(--font-size-26); letter-spacing:-.6px; font-variant-numeric:tabular-nums; }
.savings-breakdown-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; padding:0 0 42px; }
.savings-breakdown-card { min-width:0; padding:21px; border:1px solid var(--border); border-radius:15px; background:var(--surface); box-shadow:0 2px 5px rgba(15,22,42,.025); }
.savings-card-heading,.savings-total,.savings-fund-top,.savings-unassigned { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.savings-card-heading h2 { margin:4px 0 0; font-size:var(--font-size-18); overflow-wrap:anywhere; }
.savings-card-heading .eyebrow { margin:0; }
.savings-total { align-items:flex-end; margin:22px 0 16px; padding-bottom:16px; border-bottom:1px solid var(--border); }
.savings-total strong { font-size:var(--font-size-24); font-variant-numeric:tabular-nums; }
.savings-funds-list { display:flex; flex-direction:column; gap:15px; }
.savings-fund { min-width:0; padding-bottom:14px; border-bottom:1px solid var(--border); }
.savings-fund-top > div { min-width:0; display:flex; flex-direction:column; gap:3px; }
.savings-fund-top strong { overflow-wrap:anywhere; }
.savings-fund-top small,.savings-goal-copy { color:var(--muted); font-size:var(--font-size-9); }
.savings-fund-balance { white-space:nowrap; font-variant-numeric:tabular-nums; }
.savings-progress { height:7px; margin-top:9px; overflow:hidden; border-radius:99px; background:var(--surface-soft); }
.savings-progress span { display:block; height:100%; border-radius:inherit; background:var(--accent); }
.savings-fund-trailing { display:flex; align-items:center; gap:3px; flex:0 0 auto; }
.savings-fund-menu-wrap { position:relative; flex:0 0 auto; }
.savings-fund-menu-button { width:30px; height:30px; padding:0; color:var(--muted); font-size:var(--font-size-18); font-weight:800; letter-spacing:1px; line-height:1; }
.savings-fund-menu { min-width:184px; padding:5px; position:absolute; top:calc(100% + 4px); right:0; z-index:30; border:1px solid var(--border); border-radius:10px; background:var(--surface-raised); box-shadow:var(--shadow-pop); }
.savings-fund-menu button { display:block; width:100%; min-height:36px; padding:0 10px; border:0; border-radius:7px; background:transparent; color:var(--text-soft); text-align:left; font-size:var(--font-size-11); white-space:nowrap; }
.savings-fund-menu button:hover { background:var(--surface-soft); color:var(--text); }
.savings-fund-menu button.danger-text:hover { color:var(--red) !important; background:var(--red-soft); }
.savings-fund:has(.savings-fund-menu:not([hidden])) { position:relative; z-index:25; }
.savings-unassigned { margin-top:15px; padding:12px 0; }
.savings-unassigned strong { font-variant-numeric:tabular-nums; }
.savings-card-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.savings-card-actions > .text-button { margin-left:auto; }
.savings-empty { grid-column:1/-1; padding:36px 20px; }
.savings-dialog { width:min(94vw,520px); }
.danger-text { color:var(--red) !important; }
@media(max-width:700px) { .savings-breakdown-grid { grid-template-columns:1fr; gap:12px; } .savings-summary { padding:16px; } .savings-summary strong { font-size:var(--font-size-22); } }


/* SamePage warm-home visual refresh — presentation only. */
body {
    background-image: radial-gradient(ellipse at 12% 0%, rgba(217, 183, 121, .13), transparent 34%),
                      radial-gradient(ellipse at 92% 18%, rgba(117, 134, 106, .08), transparent 32%);
}
:root[data-theme="dark"] body {
    background-image: radial-gradient(ellipse at 12% 0%, rgba(168, 185, 154, .08), transparent 34%),
                      radial-gradient(ellipse at 92% 18%, rgba(217, 183, 121, .045), transparent 32%);
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--surface) 94%, var(--bg));
    border-bottom-color: color-mix(in srgb, var(--border) 78%, transparent);
    box-shadow: 0 4px 14px -6px rgba(64, 50, 34, .18), 0 1px 3px rgba(64, 50, 34, .06);
}
.brand-mark {
    border-radius: 13px;
    box-shadow: 0 5px 13px color-mix(in srgb, var(--accent) 22%, transparent);
}
.brand-copy b { letter-spacing: -.65px; }
.main-content { max-width: 1680px; }
.page-heading { padding-top: 52px; padding-bottom: 31px; }
.page-heading h1,
.budget-title-content h1,
.dialog-heading h2,
.empty-state h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    letter-spacing: -.8px;
}
.page-heading h1 { font-size: clamp(30px, 3.2vw, 41px); }
.eyebrow { color: var(--accent-ink); letter-spacing: 1.8px; }
.heading-subtitle { max-width: 680px; line-height: 1.65; }
.button { border-radius: 11px; font-weight: 650; }
.button-primary { box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 19%, transparent); }
.button-secondary { background: color-mix(in srgb, var(--surface) 92%, var(--bg)); }
.icon-button, .search-field, .compact-select, .budget-date-filter input { border-radius: 11px; }
.list-toolbar {
    border-top-color: color-mix(in srgb, var(--border) 75%, transparent);
    border-bottom-color: color-mix(in srgb, var(--border) 75%, transparent);
}
.budget-grid { gap: 18px; }
.budget-card,
.summary-card,
.details-panel,
.table-card,
.savings-breakdown-card,
.savings-summary,
.pinned-budgets-section {
    border-color: color-mix(in srgb, var(--border) 88%, #d9c6a7);
    border-radius: 17px;
    box-shadow: 0 3px 12px rgba(72, 57, 38, .035);
}
.budget-card { background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 94%, var(--bg))); }
.budget-card::before { width: 4px; border-radius: 17px 0 0 17px; }
.budget-card-main { padding: 23px 25px; }
.budget-card-kicker { letter-spacing: 1.65px; }
.budget-card-open { color: var(--accent-ink); }
.summary-card { min-height: 112px; padding: 16px 18px 14px; background: color-mix(in srgb, var(--surface) 95%, var(--bg)); }
.summary-card-top { font-size: var(--font-size-11); }
.summary-card-top b { border-radius: 9px; }
.summary-card > strong { font-weight: 720; letter-spacing: -.55px; }
.budget-overview,
.budget-overview-metric { border-radius: 16px; }
.budget-overview { border-color: var(--border); background: color-mix(in srgb, var(--surface) 90%, var(--bg)); }
.section-symbol { border-radius: 11px; }
.section-title-wrap h2 { font-weight: 720; }
.details-panel { background: color-mix(in srgb, var(--surface) 96%, var(--bg)); }
.data-table th { background: color-mix(in srgb, var(--surface-soft) 88%, var(--bg)); letter-spacing: .45px; }
.data-table td { border-bottom-color: color-mix(in srgb, var(--border) 78%, transparent); }
.data-row:hover td { background: color-mix(in srgb, var(--accent-soft) 38%, var(--surface)); }
.app-dialog {
    border-radius: 20px;
    border-color: color-mix(in srgb, var(--border-strong) 80%, #d9c6a7);
    box-shadow: 0 24px 75px rgba(65, 49, 31, .20), 0 4px 14px rgba(65, 49, 31, .08);
}
.app-dialog::backdrop { background: rgba(49, 43, 34, .43); backdrop-filter: blur(4px); }
.dialog-close { border-radius: 9px; }
.form-field input, .form-field select, .form-field textarea { border-radius: 10px; }
.empty-state { position: relative; }
.empty-state .empty-illustration {
    filter: drop-shadow(0 8px 12px rgba(115, 94, 61, .08));
}
.empty-illustration::before {
    content: "";
    position: absolute;
    width: 128px;
    height: 94px;
    left: 11px;
    top: 13px;
    border-radius: 48% 52% 45% 55%;
    background: radial-gradient(circle at 35% 35%, #f7e8ca, #e8eee3 76%);
    opacity: .9;
}
.empty-wallet, .empty-orbit, .spark-one, .spark-two { z-index: 1; }
.empty-state h2 { font-size: clamp(25px, 3vw, 31px); }
.empty-state > p:not(.eyebrow) { max-width: 420px; line-height: 1.7; }
.savings-summary { background: linear-gradient(110deg, var(--surface), color-mix(in srgb, var(--green-soft) 42%, var(--surface))); }
.savings-breakdown-card { background: linear-gradient(155deg, var(--surface), color-mix(in srgb, var(--surface) 94%, var(--bg))); }
.savings-progress { background: color-mix(in srgb, var(--green-soft) 75%, var(--surface)); }
.savings-progress span { background: var(--green); }
.app-footer { border-top-color: color-mix(in srgb, var(--border) 75%, transparent); }
.toast { border-radius: 13px; }
:root[data-theme="dark"] .app-dialog { box-shadow: 0 24px 75px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .24); }
@media (max-width: 700px) {
    .page-heading { padding-top: 35px; }
    .budget-grid { gap: 12px; }
    .summary-card { border-radius: 13px; }
    .app-dialog { border-radius: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Primary navigation: desktop links with a compact mobile menu. */
.desktop-topbar-navigation {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 24px;
    margin-right: auto;
}
.topbar-nav-link,
.mobile-nav-link {
    min-height: 39px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: var(--font-size-12);
    font-weight: 680;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.topbar-nav-link:hover,
.mobile-nav-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}
.topbar-nav-link.active,
.mobile-nav-link.active {
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}
.mobile-nav-toggle,
.mobile-topbar-navigation { display: none; }
@media (max-width: 900px) {
    .desktop-topbar-navigation { gap: 2px; margin-left: 14px; margin-right: auto; }
    .topbar-nav-link { padding: 0 10px; font-size: var(--font-size-11); }
}
@media (max-width: 700px) {
    .desktop-topbar-navigation { display: none; }
    .mobile-nav-toggle { display: inline-grid; flex: 0 0 36px; width: 36px; height: 36px; }
    .mobile-nav-toggle svg { width: 19px; height: 19px; }
    .topbar-actions { gap: 8px; }
    .mobile-topbar-navigation {
        position: absolute;
        z-index: 40;
        top: calc(100%);
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        width: min(260px, calc(100vw - 30px));
        padding: 8px;
        border: 1px solid var(--border-strong);
        border-radius: 14px;
        background: var(--surface);
        box-shadow: 0 14px 34px rgba(55, 43, 28, .16);
    }
    .mobile-topbar-navigation[hidden] { display: none !important; }
    .mobile-nav-link { width: 100%; min-height: 44px; padding: 0 13px; text-align: left; }
}
:root[data-theme="dark"] .mobile-topbar-navigation {
    box-shadow: 0 14px 34px rgba(0, 0, 0, .34);
}
@media (max-width: 390px) {
    .topbar-actions { gap: 6px; }
    .mobile-nav-toggle { flex-basis: 34px; width: 34px; height: 34px; }
}


/* SamePage 2.0.32 — overflow trigger and mobile brand-group refinements. */
.savings-fund-top small,
.savings-goal-copy {
    font-size: 12px;
}
.savings-fund-trailing {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.savings-fund-balance {
    order: 0;
    flex: 0 0 auto;
    margin: 0 16px 0 0;
}
.savings-fund-trailing .savings-fund-menu-wrap {
    order: 1;
}
.savings-fund-menu-button,
.savings-breakdown-menu-button {
    border: 1px solid var(--border) !important;
}
.savings-breakdown-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}
.savings-breakdown-card:has(.savings-breakdown-menu:not([hidden])) {
    position: relative;
    z-index: 25;
}


/* Keep the mobile navigation toggle beside the brand mark on the left. */
.topbar-brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 0 auto;
}

/* Style only the three-dot trigger; menu item typography remains 11px. */
.savings-fund-menu-button {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
}

/* Keep each fund balance and its overflow control on one horizontal line. */
.savings-fund-top > .savings-fund-trailing {
    flex-direction: row;
}


/* SamePage 2.0.34 — draggable savings fund rows, matching budget row handles. */
.savings-fund {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.savings-fund-drag-handle {
    flex: 0 0 20px;
    margin-top: 1px;
}
.savings-fund-content {
    flex: 1 1 auto;
    min-width: 0;
}
.savings-fund.drag-over,
.savings-fund.drag-target {
    background: var(--accent-soft) !important;
    box-shadow: inset 0 2px var(--accent);
    border-radius: 6px;
}

/* Savings sharing — reuse the workspace tab and share-dialog visual language. */
.savings-list-tabs { margin-top: 10px; }
.savings-sharing-meta { margin: 6px 0 0; color: var(--muted); font-size: var(--font-size-10); line-height: 1.4; overflow-wrap: anywhere; }
.shared-savings-card { border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); }

/* Email ownership verification: reuse the existing cloud-account dialog and theme tokens. */
.verification-identity { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; min-width: 0; }
.verification-identity strong { overflow-wrap: anywhere; font-size: var(--font-size-12); }
.verification-mark { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; color: var(--accent-ink); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; }
.verification-mark svg { width: 23px; height: 23px; }
.verification-copy, .verification-status { margin: 0 0 14px; color: var(--muted); line-height: 1.55; font-size: var(--font-size-10); }
.auth-dialog .verification-code { min-height: 52px; text-align: center; font-size: 26px; font-weight: 600; letter-spacing: .36em; font-variant-numeric: tabular-nums; padding-left: calc(.36em + 10px); }
.auth-dialog .verification-code::placeholder { color: var(--muted); opacity: .5; }
.verification-status { overflow-wrap: anywhere; margin-top: 10px; }
.verification-delivery-error { color: var(--red); }
.verification-submit { width: 100%; min-height: 42px; }
.verification-resend { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 16px 0; font-size: var(--font-size-10); color: var(--muted); }
.verification-resend button:disabled { opacity: .6; cursor: default; }
.verification-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.verification-links button, .verification-resend button { min-height: 34px; }

/* Password recovery shares the existing authentication dialog and theme. */
.reset-forgot-row { display: flex; justify-content: flex-end; margin: -6px 0 12px; }
.reset-password-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.reset-password-field input { flex: 1; min-width: 0; width: 100%; }
.reset-password-field button { flex: 0 0 auto; min-height: 40px; }
.reset-back-row { margin-top: 16px; }
#passwordRecoveryPanel .auth-error { margin-bottom: 12px; }
#passwordRecoveryPanel [hidden] { display: none !important; }

.reset-form-field > label { color: var(--text-soft); font-size: var(--font-size-10); font-weight: 650; }
.reset-form-field > label small { color: var(--muted); font-size: inherit; font-weight: 500; }

/* CSP-compatible static palette and cached-page privacy guard. */
.color-swatch[data-color="#6c63d9"] { --swatch: #6c63d9; }
.color-swatch[data-color="#3985c9"] { --swatch: #3985c9; }
.color-swatch[data-color="#2b9b83"] { --swatch: #2b9b83; }
.color-swatch[data-color="#7b9b45"] { --swatch: #7b9b45; }
.color-swatch[data-color="#c58a37"] { --swatch: #c58a37; }
.color-swatch[data-color="#d16d55"] { --swatch: #d16d55; }
.color-swatch[data-color="#bd659c"] { --swatch: #bd659c; }
.color-swatch[data-color="#738095"] { --swatch: #738095; }
.color-swatch[data-color="#5b73c7"] { --swatch: #5b73c7; }
.color-swatch[data-color="#2f8f9d"] { --swatch: #2f8f9d; }
.color-swatch[data-color="#5e9c64"] { --swatch: #5e9c64; }
.color-swatch[data-color="#a2a93b"] { --swatch: #a2a93b; }
.color-swatch[data-color="#d58b3d"] { --swatch: #d58b3d; }
.color-swatch[data-color="#c65d75"] { --swatch: #c65d75; }
.color-swatch[data-color="#9466b4"] { --swatch: #9466b4; }
.color-swatch[data-color="#8a6f5a"] { --swatch: #8a6f5a; }
html.session-cache-guard body { display: none !important; }
html.session-cache-guard body, html.session-cache-guard body * { visibility: hidden !important; }
