/* One scroll area per reading surface; headers and closing controls stay reachable. */
#chatLedgerPanel.ledger-pro { top: max(8px, env(safe-area-inset-top)) !important; bottom: auto !important; height: calc(var(--vvh, 100dvh) - 16px) !important; max-height: calc(var(--vvh, 100dvh) - 16px) !important; }
#chatLedgerPanel.ledger-pro .ledger-drawer-header { flex: 0 0 auto; min-height: 58px !important; box-sizing: border-box; }
#chatLedgerPanel.ledger-pro .ledger-drawer-body { overflow-y: auto !important; overflow-x: hidden !important; min-height: 0; overscroll-behavior-y: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#chatLedgerPanel.ledger-pro .ledger-drawer-body > * { flex-shrink: 0; }
#chatLedgerPanel.ledger-pro #chatLedgerContent { flex: none !important; overflow: visible !important; max-height: none !important; min-height: 100px; }
#chatLedgerPanel .finance-category-rows { max-height: none; overflow: visible; }
#chatLedgerPanel .ledger-fab { position: fixed !important; right: 24px !important; bottom: max(24px, env(safe-area-inset-bottom)) !important; }
#chatDrawer, #chatListDrawer { display: flex; flex-direction: column; max-height: calc(var(--vvh, 100dvh) - 24px) !important; }
#chatDrawer .chat-drawer-header, #chatListDrawer .recentSheet__controls, #chatDrawerActions { flex-shrink: 0; }
#chatDrawerBody, #chatListDrawerBody, #anchorLockContentScroll { min-height: 0 !important; overflow-y: auto !important; touch-action: pan-y; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
#chatDrawerBody { max-height: none !important; flex: 1 1 auto; }
body.anchor-chat.modal-open .chat-input-bar { visibility: hidden !important; pointer-events: none !important; }
#chatDrawerBody .chat-drawer-text, #anchorLockDetailBody { overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
#quickActionsSheetPanel, .quick-actions-sheet-panel { touch-action: pan-y !important; overscroll-behavior-y: contain; overflow-y: auto !important; }
.quick-actions-sheet-drag { touch-action: none !important; }
.quick-actions-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 2; background: var(--ui-bg, #fff); }
.comfort-close { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 26px; cursor: pointer; }
#overlay-root #anchorLockPanel { display:flex; flex-direction:column; top:max(8px, env(safe-area-inset-top)) !important; bottom:auto !important; height:calc(var(--vvh, 100dvh) - 16px) !important; max-height:calc(var(--vvh, 100dvh) - 16px) !important; overflow:hidden; }
#anchorLockPanel .lock-panel__header, #anchorLockPanel .lock-panel__input-section { flex:0 0 auto; }
#anchorLockPanel #anchorLockContentScroll { flex:1 1 auto; min-height:0 !important; overflow-y:auto !important; }
#anchorLockPanel #anchorLockContentScroll.is-detail-mode { display:block !important; }
#anchorLockPanel #anchorLockDetailWrap, #anchorLockPanel .lock-detail-content, #anchorLockPanel .lock-detail__read-wrap { height:auto !important; max-height:none !important; min-height:0 !important; overflow:visible !important; }
#anchorLockPanel #anchorLockDetailBody { cursor:text; user-select:text; white-space:pre-wrap; overflow-wrap:anywhere; }
#anchorLockPanel #anchorLockDetailEditWrap { flex-direction:column; min-height:300px; }
#anchorLockPanel #anchorLockDetailEdit { min-height:220px; height:40dvh; max-height:none; width:100%; overflow-y:auto; font-size:16px; box-sizing:border-box; }
#anchorLockPanel .lock-detail__edit-actions { position:sticky; bottom:0; background:var(--ui-bg,#fff); padding:12px 0; flex:0 0 auto; }
#anchorLockPanel #anchorLockAddInput { min-height:88px; height:100px; max-height:20dvh; overflow-y:auto; font-size:16px; }
#anchorLockLoadStatus { color:#64748b; font-size:12px; padding:0 4px; }
#anchorLockPanel button:disabled { opacity:.55; cursor:wait; }
@media(max-width:600px){#overlay-root #anchorLockPanel { width:calc(100vw - 16px) !important; max-width:calc(100vw - 16px) !important; left:8px !important; right:8px !important; margin:0 !important; border-radius:22px; }}
#ledgerEditModal { position: absolute !important; inset: 0 !important; z-index: 1300 !important; overflow-y: auto; align-items: safe center; padding: 16px; box-sizing: border-box; background: transparent !important; overscroll-behavior: contain; }
#ledgerEditModal .ledger-edit-modal-backdrop, #ledgerDeleteConfirmBackdrop { background: rgba(15,23,42,.18) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
#ledgerDeleteConfirmWrap { background: transparent !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
#ledgerEditModal { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
#ledgerDeleteConfirmWrap .ledger-delete-confirm-msg { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 38dvh; overflow-y: auto; font-size: 15px; line-height: 1.6; }
body.anchor-chat #ledgerEditModal .ledger-edit-modal-panel { position: relative; inset: auto; width: 100%; max-height: calc(var(--vvh, 100dvh) - 48px); overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box; }
#ledgerEditModal .ledger-edit-modal-title, #ledgerEditModal .ledger-edit-actions { flex: 0 0 auto; }
#ledgerEditModal .ledger-edit-form { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 3px; }
.chat-sheet-header, .finance-sheet__header { flex-shrink: 0; }
#chatSheetFormBody, #chatSheetBodyScroll { min-height: 0; }
#chatSheetBodyScroll { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid #3569df; outline-offset: 3px; }
@media(max-width:600px) { #chatLedgerPanel.ledger-pro { width: calc(100vw - 16px) !important; right: 8px !important; left: 8px !important; border-radius: 22px !important; } #sheetCategory, #sheetDate, #sheetNote, #ledgerEditCategory, #ledgerEditDate, #ledgerEditNote, #ledgerFinanceSearch, #ledgerCategoryFilter { font-size:16px; } }
@media(prefers-reduced-motion:reduce) { .overlay-modal, .chat-drawer, .chat-sheet-panel, .quick-actions-sheet-panel { transition: none !important; scroll-behavior: auto !important; } }
@media(max-width:600px) { #chatDrawer, #chatListDrawer { left: 8px !important; right: 8px !important; width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; } }
@media(max-width:600px) { body.anchor-chat #chatLedgerPanel.ledger-pro { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; left: 8px !important; right: 8px !important; } }
@media(max-width:600px) { body.anchor-chat #overlay-root #overlay-layer-ledger #chatLedgerPanel.ledger-pro { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; left: 8px !important; right: 8px !important; } }
