/* Finance surfaces: compact, legible and explicit about what has been saved. */
.finance-entry-hint { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: #eef5ff; color: #28486b; line-height: 1.6; font-size: 13px; }
.finance-sheet__content .chat-sheet-row { display: block; margin-bottom: 18px; }
.finance-sheet__content label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
#sheetAmount { font-size: 30px; font-variant-numeric: tabular-nums; }
#sheetCategory, #sheetNote, #sheetDate, #ledgerEditCategory, #ledgerEditDate { width: 100%; box-sizing: border-box; min-height: 44px; padding: 11px 12px; border: 1px solid #dce1e8; border-radius: 10px; background: #fff; color: #172332; font: inherit; }
#sheetNote { resize: vertical; }
.finance-category-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.finance-category-chips button { padding: 7px 10px; border: 1px solid #dce6f0; border-radius: 18px; background: #f4f8fc; color: #314b65; font-size: 12px; cursor: pointer; }
.finance-category-chips button:hover { background: #e3effc; }
.finance-help { display: block; margin-top: 9px; color: #64748b; line-height: 1.5; font-size: 12px; }
.finance-saved-detail { line-height: 1.8; font-variant-numeric: tabular-nums; color: #334155; padding: 14px; }
#financeViewSaved { min-height: 44px; margin-bottom: 18px; }
.finance-ledger-filters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #edf0f5; }
.finance-ledger-filters label { display: grid; gap: 5px; font-size: 12px; color: #5c6878; min-width: 0; }
.finance-ledger-filters input { width: 100%; box-sizing: border-box; min-width: 0; height: 38px; border: 1px solid #dce1e8; border-radius: 9px; padding: 7px 9px; background: #fff; color: #172332; font-size: 13px; }
#ledgerResetFilters { align-self: end; height: 38px; border: 0; border-radius: 8px; background: #f1f5f9; color: #475569; padding: 0 9px; cursor: pointer; font-size: 12px; }
.finance-category-summary { margin: 16px 0 4px; }
.finance-category-summary h4 { margin: 0 0 8px; font-size: 14px; text-align: left; }
.finance-category-summary h4 small { margin-left: 8px; font-size: 11px; color: #64748b; font-weight: 400; }
.finance-category-summary button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 11px 2px; background: transparent; color: inherit; border: 0; border-bottom: 1px solid #edf0f5; cursor: pointer; font-size: 13px; text-align: left; }
.finance-category-summary button > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.finance-category-summary small { display: block; color: #64748b; font-size: 11px; margin-top: 3px; }
.finance-sheet__save-btn:disabled { opacity: .65; cursor: wait; }
.finance-bubble-row .finance-title { font-variant-numeric: tabular-nums; }
@media(max-width:480px) { .finance-ledger-filters { grid-template-columns: 1fr 1fr; } #ledgerResetFilters { grid-column: 1 / -1; height: 30px; } }
html[data-theme="dark"] .finance-entry-hint { background: #203248; color: #c1d6ee; }
html[data-theme="dark"] #sheetCategory, html[data-theme="dark"] #sheetNote, html[data-theme="dark"] #sheetDate, html[data-theme="dark"] #ledgerEditCategory, html[data-theme="dark"] #ledgerEditDate, html[data-theme="dark"] .finance-ledger-filters input { background: #202833; color: #edf2f7; border-color: #3a4655; }
html[data-theme="dark"] .finance-category-chips button, html[data-theme="dark"] #ledgerResetFilters { background: #28374a; color: #d6e3f2; border-color: #435167; }
html[data-theme="dark"] .finance-saved-detail { color: #d6e3f2; }

.finance-category-summary summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 8px 0; text-align: left; }
.finance-category-summary summary small { display: inline; margin-left: 6px; font-weight: 400; }
.finance-category-rows { max-height: 180px; overflow-y: auto; overscroll-behavior: contain; }
.finance-quick-ledger { min-height: 44px; border: 1px solid #dce6f0; padding: 0 13px; cursor: pointer; font: inherit; font-size: 13px; color: #28486b; background: #f4f8fc; }
body.anchor-chat #financeQuickLedger {width:auto !important;min-width:76px;height:42px !important;border-radius:14px !important;padding:0 16px !important;border:1px solid #d9e3f4 !important;background:linear-gradient(145deg,#fff,#edf3ff) !important;color:#355c99 !important;box-shadow:0 5px 16px #25497712 !important;font-weight:600;}
body.anchor-chat #sheetCategory, body.anchor-chat #ledgerEditCategory, body.anchor-chat #ledgerCategoryFilter {display:block;width:100%;min-width:0;box-sizing:border-box;height:44px;min-height:44px;padding:0 36px 0 12px;border:1px solid #dce3ee;border-radius:12px;background-color:#fff;color:#24354c;font:inherit;font-size:16px;appearance:auto;cursor:pointer;}
.finance-category-manager {font-size:12px;color:#64748b;margin-top:10px;text-align:left;}
.finance-category-manager summary {cursor:pointer;color:#4268ad;padding:8px 0;}
.finance-category-manager p {font-size:12px;line-height:1.6;}
.category-add-row {display:flex;gap:6px;}
.category-add-row input {width:100%;min-width:0;}
.finance-category-manager button {border:0;border-radius:8px;padding:8px;color:#45659a;background:#eef3fc;cursor:pointer;white-space:nowrap;}
.category-manage-list {max-height:180px;overflow-y:auto;overscroll-behavior:contain;}
.category-manage-list > div {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 0;}
.category-manage-list span {overflow-wrap:anywhere;}
.finance-ledger-filters > .finance-category-manager {grid-column:1 / -1;width:100%;}
body.anchor-chat select[hidden] {display:none !important;}
.category-picker {position:relative;min-width:0;font-size:14px;}
.category-picker > summary {list-style:none;cursor:pointer;padding:12px;border:1px solid #e1e6ef;border-radius:12px;background:#fff;color:#30445f;min-height:44px;box-sizing:border-box;overflow-wrap:anywhere;}
.category-picker > summary::-webkit-details-marker {display:none;}
.category-picker-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:10px 0;max-height:220px;overflow-y:auto;overscroll-behavior:contain;}
.category-picker:not([open]) .category-picker-grid {display:none;}
.category-picker-grid button {border:1px solid #e4e9f1;border-radius:10px;background:#f8faff;color:#52627b;padding:10px 5px;font-size:13px;min-height:42px;cursor:pointer;overflow-wrap:anywhere;}
.category-picker-grid button[aria-pressed="true"] {background:#eaf0fc;color:#315ca9;border-color:#afc3eb;}
.category-picker[open] > .category-picker-grid {position:absolute;left:0;top:calc(100% + 6px);width:min(300px,calc(100vw - 78px));box-sizing:border-box;z-index:40;padding:10px;background:#fff;border:1px solid #e2e8f2;border-radius:16px;box-shadow:0 8px 28px #20375720;grid-template-columns:repeat(3,minmax(0,1fr));}
.category-remove-confirm {display:block !important;border:1px solid #ead9c5;border-radius:12px;padding:10px !important;background:#fffbf6;}
.category-remove-confirm button {margin-right:8px;min-height:40px;}
.finance-category-manager button:disabled {opacity:.5;cursor:default;}
body.anchor-chat .chat-topbar-rightgroup {position:relative;}
body.anchor-chat #financeQuickLedger {position:absolute !important;top:calc(100% + 10px) !important;right:0 !important;min-width:54px !important;width:54px !important;height:30px !important;min-height:30px !important;border-radius:999px !important;padding:0 9px !important;font-size:11px !important;box-shadow:0 3px 10px #2549770d !important;}
body.anchor-chat .chat-topbar-center {position:absolute !important;left:50% !important;transform:translateX(-50%) !important;}
.category-picker > summary {position:relative;padding-right:32px;}
.category-picker > summary::after {content:"";position:absolute;right:14px;top:17px;width:7px;height:7px;border-right:1.5px solid #7c8da5;border-bottom:1.5px solid #7c8da5;transform:rotate(45deg);}
.category-picker[open] > summary::after {transform:rotate(225deg);top:20px;}
.finance-filter-category {min-width:0;}
.finance-filter-caption {display:flex;justify-content:space-between;align-items:center;min-height:22px;margin-bottom:6px;font-size:12px;color:#64748b;}
body.anchor-chat #ledgerResetFilters {grid-column:auto !important;width:auto !important;height:auto !important;min-height:22px !important;padding:0 4px !important;border:0;background:transparent;font-size:12px;color:#5876a5;}
.category-manage-launch {border:0;background:transparent;color:#5876a5;font-size:12px;cursor:pointer;padding:8px 0;justify-self:end;}
.finance-ledger-filters > .category-manage-launch {grid-column:1 / -1;margin-top:-4px;}
#financeCategoryDialog {width:min(400px,calc(100vw - 36px));max-height:min(560px,calc(100dvh - 48px));box-sizing:border-box;padding:0;border:1px solid #e2e7ef;border-radius:22px;background:#fff;color:#26364d;box-shadow:0 20px 64px #17294030;overflow:hidden;}
#financeCategoryDialog[open] {display:flex;flex-direction:column;}
#financeCategoryDialog::backdrop {background:#17203355;}
#financeCategoryDialog header {display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid #edf0f5;flex-shrink:0;}
#financeCategoryDialog h3 {margin:0;font-size:17px;}
#financeCategoryDialog header button {border:0;background:#f5f7fb;color:#63758d;font-size:24px;width:36px;height:36px;border-radius:50%;cursor:pointer;}
#financeCategoryDialog .finance-category-manager {margin:0;padding:16px 20px 20px;overflow-y:auto;min-height:0;overscroll-behavior:contain;}
#financeCategoryDialog .finance-category-manager > p:first-child {margin-top:0;}
#financeCategoryDialog .category-add-row input {box-sizing:border-box;min-height:42px;border:1px solid #e0e7ef;border-radius:10px;padding:10px;font-size:16px;}
#financeCategoryDialog .category-manage-list {max-height:none;overflow:visible;}
#financeCategoryDialog .category-manage-list > div {border-bottom:1px solid #f0f2f7;min-height:44px;}
html[data-theme="dark"] #financeCategoryDialog {background:#202b3b;color:#e0e8f4;border-color:#3c4b62;}
.finance-ledger-filters {align-items:start;}
.finance-ledger-filters > label {display:flex;flex-direction:column;gap:6px;font-size:12px;line-height:22px;color:#64748b;}
.finance-filter-caption {height:22px;line-height:22px;}
body.anchor-chat .finance-ledger-filters #ledgerFinanceSearch, body.anchor-chat .finance-ledger-filters .category-picker > summary {height:44px !important;min-height:44px !important;box-sizing:border-box;font-size:14px !important;line-height:20px !important;padding:11px 12px !important;border:1px solid #e1e6ef !important;border-radius:12px !important;}
body.anchor-chat .finance-ledger-filters .category-picker > summary {padding-right:32px !important;}
body.anchor-chat #ledgerResetFilters {font-size:12px;line-height:22px;}
@media(prefers-reduced-motion:reduce){.category-picker *,#financeCategoryDialog *,#anchorLockPanel * {transition:none !important;animation:none !important;}}
html[data-theme="dark"] .finance-quick-ledger { color: #d6e3f2; background: #28374a; border-color: #435167; }

.category-inline-create { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding-top: 10px; border-top: 1px solid #e6eaf1; }
.category-inline-create input { min-width: 0; width: 100%; box-sizing: border-box; height: 44px; border: 1px solid #dbe2ed; border-radius: 10px; padding: 8px; font-size: 16px; }
.category-inline-create p { grid-column: 1 / -1; margin: 0; font-size: 12px; color: #b42318; }
/* A single primary action after saving, with quieter ways to review or finish. */
body.anchor-chat #chatSheetSuccessBody { padding: 24px 24px 28px; text-align: center; overflow-y: auto; box-sizing: border-box; }
.finance-success-mark { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: #edf7f2; color: #26835b; }
.finance-success-mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.anchor-chat #chatSheetSuccessBody .chat-sheet-success-text { margin: 0; font-size: 16px; font-weight: 600; color: #26364d; }
.finance-saved-amount { margin: 16px 0 4px; font-size: 36px; font-weight: 650; letter-spacing: -1px; color: #172b45; font-variant-numeric: tabular-nums; }
body.anchor-chat #chatSheetSuccessBody .finance-saved-detail { margin: 0 0 24px; padding: 0; font-size: 13px; line-height: 1.6; color: #68778a; overflow-wrap: anywhere; }
body.anchor-chat #chatSheetSuccessBody .chat-sheet-success-actions { display: flex; flex-direction: column; gap: 10px; }
.finance-success-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body.anchor-chat #chatSheetSuccessBody button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 46px; height: auto; margin: 0; padding: 11px 12px; box-sizing: border-box; border: 1px solid #e3e8f1; border-radius: 14px; background: #f7f9fc; color: #47607f; font: inherit; font-size: 14px; line-height: 22px; font-weight: 500; box-shadow: none; cursor: pointer; }
body.anchor-chat #chatSheetSuccessBody #chatSheetAgainBtn { border-color: #3566d6; background: #3566d6; color: #fff; font-weight: 600; box-shadow: 0 4px 12px #3566d61a; }
body.anchor-chat #chatSheetSuccessBody #chatSheetAgainBtn span { font-size: 20px; font-weight: 400; }
body.anchor-chat #chatSheetSuccessBody button:active { transform: translateY(1px); }
body.anchor-chat #ledgerEditModal .ledger-edit-actions button { min-height: 44px; border-radius: 14px; font-size: 14px; box-shadow: none; }
body.anchor-chat #ledgerDeleteConfirmWrap .ledger-delete-confirm-actions { display: flex; gap: 10px; }
body.anchor-chat #ledgerDeleteConfirmWrap .ledger-delete-confirm-actions button { flex: 1; min-height: 44px; border-radius: 12px; font-size: 14px; }
@media(max-height:600px) { body.anchor-chat #chatSheetSuccessBody { padding: 16px 20px 20px; } .finance-success-mark { width: 36px; height: 36px; margin-bottom: 8px; } .finance-saved-amount { margin-top: 10px; font-size: 30px; } body.anchor-chat #chatSheetSuccessBody .finance-saved-detail { margin-bottom: 18px; } }
body.anchor-chat #chatSheetSave, body.anchor-chat #ledgerEditSave { background: #3566d6 !important; color: #fff !important; border-color: #3566d6 !important; border-radius: 14px !important; box-shadow: 0 4px 12px #3566d61a !important; }
body.anchor-chat #ledgerDeleteConfirmOk { color: #b73535; background: #fff2f1; border: 1px solid #f2d7d4; }
body.anchor-chat #ledgerDeleteConfirmCancel { color: #53657b; background: #f3f6fa; border: 1px solid #e6ebf2; }
body.anchor-chat #chatFinanceSheet { background: transparent !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.anchor-chat #chatFinanceSheet .finance-sheet__panel { border-radius: 22px !important; overflow: hidden; }
body.anchor-chat #chatFinanceSheet.finance-is-saved .finance-sheet__panel { top: 50% !important; bottom: auto !important; transform: translateY(-50%) !important; margin: 0 auto !important; width: calc(100% - 32px) !important; max-width: 420px !important; }
