
    /* --- GLOBAL SCROLLBAR THEME --- */
::-webkit-scrollbar {
    width: 5px;  /* Thin width */
    height: 5px; /* Thin height for horizontal scrolling */
}

::-webkit-scrollbar-track {
    background: transparent; /* Seamless blend with dark background */
}

::-webkit-scrollbar-thumb {
    background: var(--orange-accent); /* The nice orange color */
    border-radius: 10px; /* Rounded pill shape */
}

::-webkit-scrollbar-thumb:hover {
    background: #ffaa33; /* Slightly brighter on interaction */
}

        /* --- THEME --- */
        :root {
            --bg-dark: #121212; --card-bg: #1E1E1E; --panel-bg: #222222; --input-bg: #383838;
            --border-color: #434343; --text-primary: #E0E0E0; --text-secondary: #9E9E9E;
            --orange-accent: #ff9200; --danger-color: #ff5252; --success-color: #4caf50;
        }
        * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; outline: none; }
        body { 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
            margin: 0; background-color: var(--bg-dark); color: var(--text-primary); 
            height: 100vh; overflow: hidden; display: flex; flex-direction: column;
            /* 1. Prevent "Pull-to-refresh" and "Bounce" scroll effects */
            overscroll-behavior: none;
            
            /* 2. Prevent selecting text (like a real app UI) */
            -webkit-user-select: none; /* Safari */
            user-select: none;
            
            /* 3. Remove the "Blue Flash" when tapping buttons on Android/iOS */
            -webkit-tap-highlight-color: transparent;
            
            /* 4. Disable browser zoom gestures via CSS */
            touch-action: pan-x pan-y;
        }
        
        /* Re-enable text selection ONLY for input fields (so users can edit text) */
        input, textarea {
            -webkit-user-select: text;
            user-select: text;
        }

        /* --- UI ELEMENTS --- */
/* --- UPDATED HEADER FOR IPHONE NOTCH --- */
.app-header {
    background-color: var(--card-bg); 
    
    /* 1. Add Safe Area Insets to standard padding */
    padding-top: calc(env(safe-area-inset-top) + 15px);
    padding-bottom: 15px;
    padding-left: calc(env(safe-area-inset-left) + 15px); /* Landscape safety */
    padding-right: calc(env(safe-area-inset-right) + 15px);

    display: flex; 
    align-items: center; 
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color); 
    
    /* 2. Remove fixed height, allow it to grow */
    height: auto; 
    min-height: 60px; 
    
    flex-shrink: 0; 
    z-index: 10;
}
        .header-left { 
            display: flex; align-items: center; gap: 15px; 
            flex: 1; min-width: 0; margin-right: 10px;
        }

        .app-title { 
            font-weight: bold; font-size: 1.1em; letter-spacing: 0.5px; 
            display: block; 
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        
        .back-btn { 
            background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; 
            cursor: pointer; padding: 8px 12px; color: var(--text-secondary); 
            display: none; transition: 0.2s;
        }
        .back-btn:hover { background-color: #2a2a2a; border-color: var(--orange-accent); color: #fff; }

        .action-btn { 
            background-color: var(--orange-accent); color: #000; border: none; border-radius: 8px; 
            font-weight: bold; cursor: pointer; padding: 8px 16px; font-size: 0.9em; height: 38px;
            display: flex; align-items: center; gap: 8px; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .action-btn:hover { background-color: #ffaa33; transform: translateY(-2px); }
        /* Ensure the secondary action button doesn't stretch weirdly */
        .action-btn.secondary {
            border: 1px solid var(--border-color);
            background: var(--input-bg);
            color: var(--text-primary);
        }
        .action-btn.secondary:hover { background-color: rgba(255, 146, 0, 0.1); }

        /* --- CARDS --- */
        .grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
        
.list-item-card {
    background-color: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 25px 15px; display: flex; flex-direction: column; align-items: center; gap: 10px;
    text-align: center; cursor: pointer; transition: all 0.2s ease; position: relative;
    
    /* --- ADD THESE TWO LINES --- */
    touch-action: pan-y;           /* Allows scrolling but prevents horizontal swipe interference */
    -webkit-touch-callout: none;   /* Disables iOS magnifying glass/menu on long press */
}
        .list-item-card:hover { 
            background-color: rgba(255, 255, 255, 0.05); transform: translateY(-3px); 
            border-color: var(--orange-accent); 
        }
        .list-item-card:active { transform: scale(0.98); }

        .card-icon { font-size: 2em; color: var(--text-secondary); margin-bottom: 5px; transition: 0.2s; }
        .list-item-card:hover .card-icon { color: var(--orange-accent); transform: scale(1.0); }
        .card-title { font-weight: 600; color: var(--text-primary); }
        .card-sub { font-size: 0.8em; color: var(--text-secondary); }

.card-settings-btn {
    position: absolute; 
    top: 10px; 
    right: 10px;
    
    /* 1. Force a square shape */
    width: 32px;
    height: 32px;
    padding: 0; /* Remove padding that distorts dimensions */
    
    /* 2. Center the icon perfectly inside */
    display: flex;
    align-items: center;
    justify-content: center;
    
    background: transparent; 
    border: none; 
    color: var(--text-secondary);
    font-size: 1.1em; 
    cursor: pointer; 
    border-radius: 50%;
    transition: 0.2s; 
    z-index: 5;
}
        .card-settings-btn:hover { background-color: rgba(255,255,255,0.1); color: var(--text-primary); }

        /* --- FORMS --- */
        .form-group { margin-bottom: 15px; width: 100%; }
        .form-label { display: block; color: var(--text-secondary); font-size: 0.8em; margin-bottom: 5px; }
        .form-control, select.form-control { 
            width: 100%; padding: 12px; background: var(--input-bg); border: 1px solid var(--border-color);
            color: white; border-radius: 8px; font-size: 1em; transition: 0.2s;
        }
        .form-control:focus { border-color: var(--orange-accent); }

        /* --- CATEGORY MANAGER STYLES --- */
        .cat-manager-container { display: flex; flex-direction: column; gap: 15px; height: 100%; overflow: hidden; }
        .cat-add-row { display: flex; gap: 10px; margin-bottom: 5px; flex-shrink: 0; }
        
        .cat-add-btn { 
            background: var(--orange-accent); color: black; border: none; border-radius: 8px; font-weight: bold; padding: 0 20px; cursor: pointer; 
            transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .cat-add-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(255, 146, 0, 0.3); background-color: #ffaa33; }
        .cat-add-btn:active { transform: scale(0.95); }

        .cat-list-scroll { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; padding-right: 5px; }


        .cat-item { 
            background: var(--input-bg); padding: 12px 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;
            border: 1px solid transparent; transition: all 0.2s ease;
        }
        .cat-item:hover { border-color: var(--orange-accent); background-color: rgba(255,255,255,0.08); transform: translateX(0px); }
        .cat-name { font-weight: 500; }
        .cat-actions { display: flex; gap: 15px; }
        .cat-action-icon { cursor: pointer; color: var(--text-secondary); font-size: 0.9em; transition: 0.2s; }
        .cat-action-icon:hover { color: var(--text-primary);  }
        .cat-action-icon.del:hover { color: var(--danger-color); }

        /* --- DATE PICKER --- */
        .date-input-custom-wrapper { 
            display: flex; align-items: center; justify-content: space-between; padding: 0 12px;
            border: 1px solid var(--border-color); border-radius: 8px; background-color: var(--input-bg);
            color: var(--text-primary); height: 42px; width: 100%; position: relative; cursor: pointer;
        }
        .date-input-custom-wrapper:hover {
    border-color: #666; 
    background-color: #444; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transform: translateY(0px); /* Optional: tiny pop effect like inputs */
}
        .formatted-date-text { flex-grow: 1; font-size: 0.9em; }
        .calendar-trigger-icon { color: var(--orange-accent); font-size: 1.1em; }
        .visually-hidden-date-input { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor:pointer; }

        /* --- VIEWS --- */
        .view-container { flex-grow: 1; position: relative; overflow: hidden; }
        .view-page {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; padding: 10px; overflow-y: auto;
            /* ADD THIS LINE FOR SMOOTH IOS SCROLLING */
            -webkit-overflow-scrolling: touch;
            transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s; background-color: var(--bg-dark);
        }
        .view-page.hidden { pointer-events: none; opacity: 0; transform: translateX(50px); z-index: 0; }
        .view-page.active { opacity: 1; transform: translateX(0); z-index: 1; }

        /* --- LEDGER --- */
        .ledger-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; background: var(--card-bg); padding: 15px; border-radius: 12px; border: 1px solid var(--border-color); margin-bottom: 7px; margin-top : 15px; }
        .sum-box { text-align: center; }
        .sum-label { font-size: 0.7em; color: var(--text-secondary); text-transform: uppercase; }
        .sum-val { font-size: 1.1em; font-weight: bold; margin-top: 5px; }
        .sum-val.in { color: var(--success-color); } .sum-val.out { color: var(--danger-color); }

/* Find and replace your .filter-bar CSS with this */
.filter-bar {
    display: flex;              /* 1. Align in a row */
    flex-direction: row;        /* 2. Force horizontal direction */
    flex-wrap: nowrap;          /* 3. CRITICAL: Prevent stacking/wrapping */
    overflow-x: auto;           /* 4. Allow horizontal scrolling */
    gap: 10px;                  /* Space between buttons */
    padding-bottom: 5px;        /* Space for scrollbar (if visible) */
    
    /* Drag-to-scroll cursors */
    cursor: grab;
    user-select: none;
    
    /* Smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch; 
    
    /* Optional: Hide the ugly scrollbar */
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari */
.filter-bar::-webkit-scrollbar {
    display: none; 
}

/* Ensure buttons don't get squashed */
.filter-btn {
    flex: 0 0 auto;             /* Prevent buttons from shrinking */
    white-space: nowrap;        /* Keep text on one line */
}

/* Active state while dragging */
.filter-bar.dragging {
    cursor: grabbing;
}
        
        
        
        
        .trans-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 80px; }
.trans-row {
            background-color: var(--panel-bg); 
            padding: 15px; 
            border-radius: 10px; 
            display: flex;
            justify-content: space-between; 
            align-items: center; 
            border-left: 4px solid transparent;
            transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother animation */
            cursor: pointer; /* Indicates interactivity */
        }
        
        .trans-row:hover {
            
            /*border-color: #666; */
            /*background-color: #444; */
            /*box-shadow: 0 2px 8px rgba(0,0,0,0.2)*/
            
            
            background-color: #2c2c2c;
            border-color: #666;
            transform: translateY(-0px) scale(0.995); 
            box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
        }
        
        .trans-row.in { border-left-color: var(--success-color); } 
        .trans-row.out { border-left-color: var(--danger-color); }
        .t-left { display: flex; flex-direction: column; gap: 4px; }
        .t-desc { font-weight: 500; }
        .t-meta { font-size: 0.75em; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        /* --- UPDATED BADGE STYLE --- */
.t-cat-badge {
    padding: 3px 8px; /* Slightly more padding */
    border-radius: 6px; /* Softer corners */
    display: inline-flex;
    align-items: center;
    font-size: 0.99em;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
    
    /* Transitions for hover effects if needed */
    transition: all 0.2s ease;
}
        .t-amount { font-weight: bold; /*font-family: monospace; font-size: 1.1em;*/ /* NEW: Prevents line breaks */
    white-space: nowrap; 
    
    /* NEW: Prevents the amount from being squashed by long descriptions */
    flex-shrink: 0; 
    
    /* Optional: Adds a little breathing room from the description */
    margin-left: 10px;}

        /* --- BOTTOM SHEETS --- */
        .bottom-sheet-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6);
            z-index: 100; opacity: 0; pointer-events: none; transition: 0.3s;
            display: flex; align-items: flex-end; justify-content: center;
        }
        .bottom-sheet-overlay.active { opacity: 1; pointer-events: auto; }
        
        .bottom-sheet {
            background-color: var(--card-bg); width: 100%; max-width: 600px; 
            border-radius: 25px 25px 0 0; padding: 25px; 
            transform: translateY(100%); transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); 
            display: flex; flex-direction: column; gap: 15px;
            border-top: 1px solid #333; box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
            max-height: 85vh;
        }
        /* NEW: Scrollable Middle Content */
.sheet-scroll-content {
    flex: 1;           /* Takes all available middle space */
    overflow-y: auto;  /* Enables scrolling */
    overflow-x: hidden;
    min-height: 0;     /* Critical for nested flex scrolling */
    
    /* Visual tweaks to prevent scrollbar from hitting edge tight */
    padding-right: 5px; 
    margin-right: -5px; 
    
    /* Add spacing between form elements inside */
    display: flex;
    flex-direction: column;
    gap: 15px; 
}
/* Optional: Hide Scrollbar in sheet for cleaner look */
.sheet-scroll-content::-webkit-scrollbar {
    width: 4px;
}
.sheet-scroll-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}
        .bottom-sheet-overlay.active .bottom-sheet { transform: translateY(0); }
        
        .bs-header { display: flex; justify-content: space-between; align-items: center; /*border-bottom: 1px solid var(--border-color); padding-bottom: 15px;*/ margin-bottom: 5px; flex-shrink: 0; }
        .bs-title { font-weight: bold; font-size: 1.2em; color: var(--text-primary); }
        .bs-close { background: none; border: none; color: var(--text-secondary); font-size: 1.5em; cursor: pointer; }
        .bs-content-dynamic { display: flex; flex-direction: column; gap: 10px; }

        .bs-btn {
            background: var(--input-bg); color: var(--text-primary); border: none; padding: 15px;
            border-radius: 12px; font-size: 1em; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 15px;
            transition: 0.2s;
        }
        .bs-btn:hover { background: #444; } 
        .bs-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .bs-btn.delete { color: var(--danger-color); }
        .bs-btn.create { color: var(--orange-accent); font-weight: bold; }
        .bs-btn.copy { color: #5dade2; }

        /* --- SWEET ALERT --- */
        .swal2-popup { 
            background: var(--card-bg) !important; color: var(--text-primary) !important; 
            border: 1px solid var(--border-color); border-radius: 25px !important; 
        }
        .swal2-title { color: var(--text-primary) !important; }
        .swal2-html-container { color: var(--text-secondary) !important; }
        .swal2-confirm { background-color: var(--danger-color) !important; border-radius: 12px !important; }
        .swal2-cancel { background-color: var(--input-bg) !important; color: #fff !important; border-radius: 12px !important; }
        .swal2-input { color: #333 !important; }




.fab {
            width: auto; 
            height: 48px; 
            border-radius: 10px; /* Slightly tighter radius */
            border: none; 
            cursor: pointer;
            display: flex; 
            align-items: center; 
            justify-content: center; 
            gap: 8px; 
            
            /* FONT FIXES */
            font-family: inherit; /* Uses the nice app font */
            font-size: 0.95rem;
            font-weight: 600; /* Semi-bold is cleaner than bold */
            letter-spacing: 0.5px; /* Improves readability */
            
            padding: 0 20px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
            color: white; 
            transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
            user-select: none;
        }

        .fab:hover { 
            transform: translateY(-3px); 
            box-shadow: 0 6px 20px rgba(0,0,0,0.6);
        }
        
        .fab:active { transform: scale(0.96); }

        .fab.in { background: var(--success-color); } 
        .fab.out { background: var(--danger-color); }
        
        /* Icon adjustment inside button */
        .fab i { font-size: 1.1em; }
        
        .hidden { display: none !important; }

        /* --- INPUTS & SEARCH --- */
        .form-control:hover { border-color: #666; background-color: #444; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
        .search-wrapper { 
    position: relative; 
    width: 100%; 
}
        #catSearch, #placeSearch, #sourceSearch { padding-right: 35px; } 
.search-clear-btn {
    position: absolute; 
    right: 12px; 
    top: 50%; 
    transform: translateY(-50%);
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    cursor: pointer; 
    font-size: 1.1em; 
    padding: 5px; 
    border-radius: 50%; 
    transition: 0.2s;
    
    /* Always show this button when the search bar is open */
    display: block; 
}
        .search-clear-btn:hover { 
    color: var(--danger-color); /* Red on hover to indicate 'remove/close' */
    background-color: rgba(255,255,255,0.1); 
    transform: translateY(-50%) scale(1.1); /* slight pop on hover */
}
        .search-clear-btn.visible { display: block; animation: fadeIn 0.2s; }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        /* --- INPUT TRIGGER (Matches Date Picker Style) --- */
        .input-trigger {
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            padding: 0 12px; /* Exact match to date-picker */
            border: 1px solid var(--border-color); 
            border-radius: 8px; 
            background-color: var(--input-bg);
            color: var(--text-primary); 
            height: 42px; /* Exact match to date-picker */
            width: 100%; 
            cursor: pointer;
            transition: 0.2s;
        }

        /* Hover Effect: Matches .form-control and standard inputs */
        .input-trigger:hover {
            border-color: #666; 
            background-color: #444; 
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }
        
        .input-trigger:active {
            background-color: #3a3a3a;
        }

        .input-trigger i { 
            color: var(--text-secondary); 
            transition: 0.2s;
        }
        
        .input-trigger:hover i {
            color: var(--text-primary);
        }

        /* --- CATEGORY/PLACE/SOURCE SELECT SHEET --- */
        #bsCatSelectOverlay, #bsPlaceSelectOverlay, #bsSourceSelectOverlay { z-index: 150 !important; }
        .bs-cat-item {
            display: flex; align-items: center; justify-content: space-between;
            width: 100%; padding: 15px; background: var(--input-bg); border: none;
            border-radius: 12px; color: var(--text-primary); font-size: 1em;
            margin-bottom: 8px; cursor: pointer; transition: 0.2s;
        }
        .bs-cat-item:hover { background-color: #444; }
        .cat-content-left { display: flex; align-items: center; gap: 10px; }
        
        /* --- Z-INDEX FIXES --- */
        #bsCatOverlay, #bsPlaceOverlay, #bsSourceOverlay {
            z-index: 160 !important; 
        }
        
        
        
        /* --- Add to <style> --- */

/* Transaction Type Switcher - UPDATED */
.txn-switch-container {
    display: flex;
    background-color: var(--input-bg);
    padding: 4px;
    border-radius: 10px;
    gap: 5px;
    
    /* NEW: Makes the container stretch to fill the header width */
    flex: 1; 
    /* NEW: Adds spacing so it doesn't touch the close (X) button */
    margin-right: 15px; 
}

.txn-switch-btn {
    flex: 1; /* Makes buttons share the width equally */
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 15px 10px; /* Reduced side padding slightly to fit small screens */
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    
    /* NEW: Forces text to stay on one line */
    white-space: nowrap; 
    
    /* NEW: Centers icon and text perfectly */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


.txn-switch-btn.active.in {
    background-color: var(--success-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.txn-switch-btn.active.out {
    background-color: var(--danger-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 82, 82, 0.4);
}
/* --- TRANSACTION SWITCH HOVER --- */
.txn-switch-btn:hover {
    background-color: rgba(255, 255, 255, 0.08); /* Subtle highlight */
    color: var(--text-primary);
}

/* Ensure active states override the hover */
.txn-switch-btn.active.in:hover {
    background-color: var(--success-color);
    opacity: 0.9;
}
.txn-switch-btn.active.out:hover {
    background-color: var(--danger-color);
    opacity: 0.9;
}
/* --- APP FOOTER --- */
/* --- UPDATED FOOTER FOR IPHONE HOME BAR --- */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    
    /* Add Safe Area to bottom padding */
    padding: 15px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 15px);
    
    z-index: 90;
    display: flex;
    justify-content: center;
}

/* Container to limit width on large screens */
.footer-content {
    width: 100%;
    max-width: 800px; 
    display: flex;
    gap: 15px;
}

/* New Button Style (Replaces FAB) */
.footer-btn {
    flex: 1; /* Makes buttons equal width (50% each) */
    height: 50px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px;
    
    font-size: 1em;
    font-weight: bold;
    color: white;
    transition: transform 0.1s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.footer-btn:active { transform: scale(0.98); }
.footer-btn.in { background: var(--success-color); } 
.footer-btn.out { background: var(--danger-color); }

/* Ensure the list has enough space at bottom so items aren't hidden behind footer */
.trans-list { padding-bottom: 100px !important; }

/* Remove the old FAB styles if you want to clean up, or just ignore them */
        
        /* --- SEARCH BAR UPDATES --- */

/* --- UPDATED: SEARCH BAR ANIMATION --- */
.sticky-search-container {
    padding: 0 20px;
    background-color: var(--bg-dark);
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    
    /* Hidden State */
    max-height: 0;
    opacity: 0;
    transform: translateY(-15px) scale(0.98); /* Start slightly above and smaller */
    overflow: hidden;
    visibility: hidden;
    
    /* THE BOUNCE ANIMATION */
    /* cubic-bezier(tension, friction) - this creates the bounce/pop effect */
    transition: 
        max-height 0.4s ease,
        opacity 0.3s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        visibility 0.4s;
}

.sticky-search-container.active {
    padding: 4px 20px;
    max-height: 80px; 
    opacity: 1;
    transform: translateY(0) scale(1); /* Land perfectly */
    visibility: visible;
}

/* --- NEW: Header Search Button --- */
.header-search-btn {
    background: transparent;
    border: none; /* No circle/border */
    color: var(--text-secondary);
    
    /* Keep size for a good click target, but no visual box */
    width: 40px; 
    height: 40px;
    
    cursor: pointer;
    display: none; /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    font-size: 1.2em; /* Slightly larger icon */
    margin-left: 10px;
    transition: color 0.2s ease;
}

.header-search-btn:hover,
.header-search-btn.active {
    background: transparent;
    color: var(--orange-accent);
}



/* 2. Position the search icon */
.search-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none; /* Let clicks pass through */
    font-size: 0.9em;
}

/* 3. Add padding to input so text doesn't overlap icon */
#mainSearch {
    padding-left: 40px; 
    padding-right: 40px; /* Space for the X button */
}
/* --- FIX: Force Input Sheet on Top --- */
#bsInputOverlay {
    z-index: 200 !important; /* Higher than Options Sheet (100) and Selectors (150) */
}
/* --- SWEETALERT DISPLAY FIX --- */
/* Prevents SweetAlert from collapsing the app body */
body.swal2-height-auto {
    height: 100vh !important;
}
#bsDeleteOverlay {
    z-index: 210 !important; /* Highest priority */
}


/* --- LARGE SCREEN FOOTER ADJUSTMENTS --- */
@media (min-width: 768px) {
    .app-footer {
        justify-content: flex-end; /* Align content to the right */
        padding-right: 30px; /* Spacing from the right edge */
    }

    .footer-content {
        width: auto; /* Stop stretching to full width */
        max-width: none; /* Remove the 800px limit */
    }

    .footer-btn {
        flex: none; /* Disable automatic flex stretching */
        width: 150px; /* Set your specific width */
    }
    
    /* Always show checkbox on Desktop */
    .t-select-box {
        display: flex !important; 
        opacity: 0.3; /* Faint outline by default */
    }

    /* Hover effect on the row makes the checkbox clearer */
    .trans-row:hover .t-select-box {
        opacity: 1;
        border-color: var(--text-primary);
    }
    
    /* Ensure selected state is always fully visible */
    .trans-row.selected-mode .t-select-box {
        opacity: 1 !important;
    }
}



/* --- LEDGER VIEW LAYOUT FIXES --- */

/* 1. Remove default padding so Search Bar sits flush against the header */
#view-ledger {
    padding: 0 !important;
}



/* 3. New Wrapper to restore padding for the rest of the content */
.ledger-content-wrapper {
    padding: 0 9px 20px 9px; /* Top Right Bottom Left */
}


/* --- RESPONSIVE FORM GROUP --- */
.responsive-group {
    display: flex;
    gap: 10px;
}

/* On Mobile: Stack vertically */
@media (max-width: 600px) {
    .responsive-group {
        flex-direction: column;
        gap: 0; /* We rely on the form-group margin-bottom instead */
    }
}


/* --- CUSTOM DATE PICKER STYLE --- */
.calendar-container {
    padding: 0 10px 20px 10px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-title {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-primary);
}

.calendar-nav-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    border-color: var(--orange-accent);
    color: var(--orange-accent);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 10px;
}

.weekday-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px; /* Spacing between days */
}

.calendar-day {
    aspect-ratio: 1; /* Keeps them perfect circles */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
    user-select: none;
}

.calendar-day:hover {
    background-color: #333;
}

.calendar-day.muted {
    color: #444;
    pointer-events: none; /* Disable clicking empty days */
}

.calendar-day.today {
    border: 1px solid var(--orange-accent);
    color: var(--orange-accent);
}

.calendar-day.selected {
    background-color: var(--orange-accent);
    color: #000;
    font-weight: bold;
    border: none; /* Remove border if it was today */
}



/* --- LEDGER COUNT BADGE --- */
.ledger-count-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px; /* Space between lines and text */
    margin: 5px 0 15px 0; /* Spacing top/bottom */
    
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* The lines on the left and right */
.ledger-count-badge::before,
.ledger-count-badge::after {
    content: '';
    height: 1px;
    background-color: var(--border-color);
    flex-grow: 1; /* Stretches to fill space */
}

/* --- DYNAMIC ANIMATED DATE HEADER --- */
.dynamic-date-overlay {
    position: sticky;
    top: 15px; /* Float near top */
    z-index: 50; /* Above everything */
    display: flex;
    justify-content: center;
    
    /* Overlay Magic: Negative margin pulls content up so this sits on top */
    margin-bottom: -40px; 
    pointer-events: none; /* Let clicks pass through to list */
    
    /* Fade in/out based on scroll */
    opacity: 0; 
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.dynamic-date-overlay.visible {
    opacity: 1;
    transform: translateY(0);
}

.date-pill-anim {
    background: rgba(30, 30, 30, 0.95);
    color: var(--orange-accent);
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(4px);
    
    /* Default State */
    transform: translateY(0);
    opacity: 1;
    
    /* Transition for Exiting (Moving Up) */
    transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

/* State: Exit Up (Hidden at Top) */
.date-pill-anim.exit-up {
    transform: translateY(-30px); /* Move up out of view */
    opacity: 0;
}

/* Animation: Enter From Top */
.date-pill-anim.enter-from-top {
    animation: bounceInTop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bounceInTop {
    0% { transform: translateY(-30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* The Pop Effect Class */
.date-pill-anim.pop {
    transform: scale(1.2);
    background: var(--orange-accent);
    color: #000;
}


/* --- STICKY DATE HEADER --- */
.date-separator {
    position: static !important; /* Disable sticky pushing */
    margin-top: 15px;
    margin-bottom: 5px;
    opacity: 0.6;
}

/* NEW RULE: When Search Bar is Active, push the date header down */
/* The '+' selects the immediate next sibling (.ledger-content-wrapper) */
#ledgerSearchBar.active + .ledger-content-wrapper .date-separator {
    top: 65px; /* Search Bar Height (~50px) + original spacing (15px) */
}

.date-pill {
    /*font-size: 0.7em; */
    background: transparent;
    /*border: 1px solid var(--border-color);*/
}


/* --- TIME PICKER BOTTOM SHEET --- */
.time-picker-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px; /* Visible height */
    position: relative;
    background: var(--card-bg);
    margin-bottom: 10px;
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

/* The Highlight Bar (Selection Indicator) */
.time-picker-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 40px;
    transform: translateY(-50%);
    background: rgba(255, 146, 0, 0.1); /* Orange Tint */
    border-top: 1px solid var(--orange-accent);
    border-bottom: 1px solid var(--orange-accent);
    pointer-events: none; /* Let clicks pass through */
    z-index: 0;
}

/* Columns */
.tp-col {
    flex: 1;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    text-align: center;
    padding: 80px 0; /* Padding creates space for top/bottom items to center */
    z-index: 1;
    cursor: grab; /* Indicates draggable */
    user-select: none; /* Prevents text highlighting while dragging */
}
.tp-col:active {
    cursor: grabbing; /* Closed hand while dragging */
}

/* Hide Scrollbars */
.tp-col::-webkit-scrollbar { display: none; }
.tp-col { -ms-overflow-style: none; scrollbar-width: none; }

/* Time Items */
.tp-item {
    height: 40px; /* Matches highlight height */
    line-height: 40px;
    font-size: 1.2em;
    color: var(--text-secondary);
    scroll-snap-align: center;
    transition: color 0.2s, transform 0.2s;
    cursor: pointer;
}

/* Active item (Handled by JS intersection observer or center logic) */
.tp-item.active {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 1.3em;
}

/* --- CALENDAR ANIMATIONS --- */
@keyframes calSlideNext {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes calSlidePrev {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes calFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.anim-next { animation: calSlideNext 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
.anim-prev { animation: calSlidePrev 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
.anim-fade { animation: calFadeIn 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards; }


/* Hide number input arrows (Chrome, Safari, Edge, Opera) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide number input arrows (Firefox) */
input[type=number] {
    -moz-appearance: textfield;
}


/* --- LIST ITEM ANIMATIONS --- */
@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.animate-enter {
    animation: fadeInUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}
/* --- PAGE TITLE ANIMATION --- */
@keyframes titleSlideIn {
    from { 
        opacity: 0; 
        transform: translateX(-15px); /* Start slightly to the left */
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

.title-anim {
    animation: titleSlideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* --- SCROLLABLE OPTIONS MENU --- */
#bsDynamicContent {
    flex: 1;              /* Takes up all remaining space */
    overflow-y: auto;     /* Enables scrolling */
    overflow-x: hidden;   /* Prevents horizontal scroll */
    min-height: 0;        /* Critical for flexbox scrolling */
    
    display: flex;
    flex-direction: column;
    gap: 10px;            /* Adds space between buttons */
    
    padding: 5px 2px;     /* Slight padding to prevent cut-off shadows */
    margin-bottom: 0px;  /* Space at the very bottom */
}

/* Optional: Make the scrollbar look nice inside this specific menu */
#bsDynamicContent::-webkit-scrollbar {
    width: 4px;
}
#bsDynamicContent::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}



/* --- NEW: FILTER ICON BUTTON --- */
.filter-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px; /* Square shape matching other inputs height */
    height: 42px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0; /* Prevents squashing */
}

/* Active state (when filters are applied) */
.filter-icon-btn.has-filters {
    background-color: rgba(255, 146, 0, 0.15);
    border-color: var(--orange-accent);
    color: var(--orange-accent);
    position: relative;
}

/* Optional: Little dot to show activity */
.filter-icon-btn.has-filters::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--orange-accent);
    border-radius: 50%;
}

.filter-icon-btn:hover {
    background-color: #444;
    border-color: #666;
    color: var(--text-primary);
}

/* --- ACTIVE FILTER CHIPS (Inside Sheet) --- */
.af-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--input-bg);
    padding: 12px 15px;
    border-radius: 10px;
    border-left: 3px solid var(--orange-accent);
    margin-bottom: 8px;
}
.af-label { font-size: 0.8em; color: var(--text-secondary); margin-bottom: 2px; text-transform: uppercase; }
.af-value { font-size: 1em; color: var(--text-primary); font-weight: 500; }


/* --- ACTIVE FILTER REMOVE BUTTON --- */
.af-remove-btn {
    background: transparent;
    border: none;
    color: var(--danger-color); /* Red color */
    font-size: 1.4em;
    cursor: pointer;
    padding: 0 0 0 15px; /* Spacing from text */
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.af-remove-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.af-remove-btn:active {
    transform: scale(0.9);
}


/* --- EXIT ANIMATION --- */
@keyframes slideOutFade {
    0% { 
        opacity: 1; 
        transform: translateX(0); 
        max-height: 100px; /* Arbitrary max-height for smooth collapse */
        margin-bottom: 8px;
        padding: 12px 15px;
    }
    100% { 
        opacity: 0; 
        transform: translateX(50px); /* Slide right */
        max-height: 0;
        margin-bottom: 0;
        padding: 0 15px; /* Keep horizontal padding to prevent jerky width change */
        border: none;
    }
}

.animate-exit {
    animation: slideOutFade 0.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none; /* Prevent double clicks */
}


/* --- DRAG & DROP STYLES --- */

/* 1. The Placeholder (Empty space left behind) */
.sortable-ghost {
    opacity: 0.15;
    background: rgba(255, 146, 0, 0.05);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}

/* 2. The Dragged Item (Floating Clone) */
/* 2. The Dragged Item (Floating Clone) */
.sortable-fallback {
    position: fixed !important; /* <--- ENSURE THIS IS FIXED */
    z-index: 9999 !important;
    opacity: 0.95 !important;
    background: var(--panel-bg);
    border: 1px solid var(--orange-accent);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    
    /* SCALE & ROTATE */
    transform: scale(1.0) rotate(5deg) !important; 
    
    /* ANIMATION */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    pointer-events: none; 
    cursor: grabbing;
}

/* 3. Hide original item */
.sortable-drag {
    opacity: 0;
}


/* --- INSTANT LONG PRESS FEEDBACK --- */
/* This targets the item immediately when the 500ms timer ends, before dragging starts */
.list-item-card.sortable-chosen:not(.sortable-ghost) {
    transform: scale(1.05) rotate(5deg); /* Matches your drag style */
    border-color: var(--orange-accent);
    background-color: #2a2a2a; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    z-index: 10;
}


/* --- MANUAL LONG PRESS POP --- */
/* This forces the card to pop exactly when the timer ends */
.list-item-card.long-press-pop {
    transform: scale(1.05) rotate(5deg);
    border-color: var(--orange-accent);
    background-color: #2a2a2a;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    z-index: 100;
    transition: transform 0.1s; /* Smooth snap */
}


/* --- ADD THIS TO YOUR CSS --- */

/* Immediate "Pop" effect when long-press timer ends (before moving) */
.sortable-chosen-mode {
    border-color: var(--orange-accent) !important;
    background-color: #2a2a2a !important; /* Slightly lighter bg */
    transform: scale(1.05); /* Pop effect */
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 100; /* Ensure it sits above others */
}

/* --- ADD THIS TO YOUR CSS --- */

/* This class applies INSTANTLY when the long-press timer ends */
.sortable-chosen {
    border-color: var(--orange-accent) !important;
    background-color: #2a2a2a !important;
    transform: scale(1.05); /* Pop effect */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); /* Lift effect */
    z-index: 100; /* Ensure it sits on top */
    transition: transform 0.1s ease; /* Smooth pop */
}








/* --- ADD/UPDATE THIS IN YOUR CSS ---****************************************** */

/* 1. Ensure the shine doesn't spill outside the rounded corners */
.list-item-card {
    position: relative; 
    overflow: hidden !important; /* Critical for the glass effect */
}

/* 2. The Card State on Long Press */
.sortable-chosen {
    border-color: var(--orange-accent) !important;
    background-color: #2a2a2a !important;
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 100;
}

/* 3. The "Glassy Shine" Element */
.sortable-chosen::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; /* Start far left */
    width: 100%;
    height: 100%;
    
    /* The Shine Gradient: Transparent -> White Tint -> Transparent */
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    
    transform: skewX(-25deg); /* Tilt it diagonally */
    pointer-events: none; /* Let touches pass through */
    
    /* The Animation Trigger */
    animation: glassyShine 0.75s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* 4. The Animation Keyframes */
@keyframes glassyShine {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}



/* --- HEADER BUTTON ENTRY ANIMATION --- */
@keyframes headerBtnPop {
    0% { 
        opacity: 0; 
        transform: scale(0.8) translateY(5px); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.header-pop-enter {
    animation: headerBtnPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}


/* --- APP VERSION FOOTER --- */
.version-footer-fixed {
    position: absolute; 
    bottom: 15px;
    right: 15px;
    font-size: 0.75em;
    color: var(--text-secondary);
    opacity: 0.4;
    pointer-events: none; /* Allows scrolling/clicking through it */
    z-index: 0; /* Behind other interactive elements if they overlap */
}

/* --- SMART FOOTER LAYOUT --- */

/* 1. Make the Books Page a Flex Container */
#view-books {
    display: flex !important; /* Override default block display */
    flex-direction: column;
}

/* 2. The Smart Footer Style */
.version-footer-smart {
    margin-top: auto;      /* CRITICAL: Pushes footer to bottom if space exists */
    align-self: flex-end;  /* Aligns the element itself to the right */
    
    padding: 10px 5px;
    font-size: 0.75em;
    color: var(--text-secondary);
    opacity: 0.4;
    
    /* Ensure it doesn't shrink/hide in complex layouts */
    flex-shrink: 0;
}



/* --- FOOTER ENTRY ANIMATIONS --- */

/* 1. The Footer Container (Slides up from off-screen) */
.footer-enter {
    animation: footerSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes footerSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 2. The Buttons (Pop in with "Parallax" delay) */
.footer-btn-enter {
    animation: btnPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0; /* Start invisible */
    transform: translateY(20px) scale(0.9); /* Start lower and smaller */
}

@keyframes btnPopIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}


.swal2-container {
    z-index: 20000 !important; /* Higher than Login (9999) */
}
/* --- UPDATE TOAST NOTIFICATION --- */
.update-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px); /* Start hidden below */
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--orange-accent);
    color: #fff;
    padding: 10px 20px;
    border-radius: 50px; /* Pill shape */
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 20001 !important;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    white-space: nowrap;
}

.update-toast.show {
    transform: translateX(-50%) translateY(0); /* Slide Up */
}

.update-toast-text {
    font-size: 0.9em;
    color: var(--text-primary);
}

.update-toast-btn {
    background: var(--orange-accent);
    color: #000;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85em;
    cursor: pointer;
    transition: transform 0.2s;
}
.update-toast-btn:active { transform: scale(0.95); }

.update-toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
    display: flex; 
    align-items: center;
}
.update-toast-close:hover { color: #fff; }


/* --- LOGIN PAGE STYLES --- */
.login-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-dark);
    z-index: 9999; 
    display: none; 
    align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px); /* Nice blur effect behind */
}
.login-container.active { display: flex; }

.login-card {
    background: var(--card-bg);
    padding: 35px 30px;
    border-radius: 24px;
    width: 100%; max-width: 360px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.login-icon {
    width: 60px; height: 60px;
    background: rgba(255, 146, 0, 0.15);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px auto;
    font-size: 1.8em; color: var(--orange-accent);
}

.login-brand {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* --- SWITCH ANIMATION --- */
.mode-switch-anim {
    animation: switchContent 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes switchContent {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
    50% {
        opacity: 0;
        transform: scale(0.95) translateY(5px);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.login-card .form-group {
    text-align: left !important;
}

/* --- TRANSACTION ATTRIBUTION FOOTER --- */
.t-footer {
    font-size: 0.7em;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
    text-align: right;
    display: flex;
    /*justify-content: flex-end;*/
    align-items: center;
    gap: 5px;
    opacity: 0.7;
}
.t-footer i { font-size: 0.9em; }


/* REPORT TYPE PILLS */
#reportTypeBar .filter-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

#reportTypeBar .filter-btn:hover {
    background: #444;
    color: var(--text-primary);
}

#reportTypeBar .filter-btn.active {
    background: var(--orange-accent);
    color: #000;
    font-weight: bold;
    border-color: var(--orange-accent);
    box-shadow: 0 2px 8px rgba(255, 146, 0, 0.4);
}


/* Add this to your existing button styles */
button:active, .bs-btn:active {
    transform: scale(0.98); /* Slight shrink effect */
    opacity: 0.8;
}


/* DRAG TO SCROLL CURSORS */
#pdfScrollContainer {
    cursor: grab; /* Shows an open hand */
    cursor: -webkit-grab;
}

#pdfScrollContainer.grabbing {
    cursor: grabbing; /* Shows a closed hand when dragging */
    cursor: -webkit-grabbing;
}


/* --- SEARCH BOX STYLES --- */
.sheet-search-wrapper {
    position: relative;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.sheet-search-input {
    padding-left: 35px;
    padding-right: 35px; /* Space for Clear Button */
    border-radius: 12px;
    background: #181818;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.sheet-search-input:focus {
    background: #4b4b4b;
    border-color: var(--orange-accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sheet-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
    font-size: 1.1em;
    padding: 5px; /* Increase touch target */
    display: none; /* Hidden by default */
    transition: color 0.2s;
}
.sheet-search-clear:hover { color: var(--danger-color); }

/* --- ANIMATIONS --- */
@keyframes fadeInUpRaw {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-item {
    animation: fadeInUpRaw 0.25s ease forwards;
}

/* --- FIXED HEIGHT CONTAINER (Prevents Jumping) --- */
.sheet-list-fixed {
    height: 50vh; /* Fixed height: occupies 50% of screen height */
    overflow-y: auto;
    padding-right: 5px; /* Prevent scrollbar overlapping content */
}


/* --- COLOR PICKER STYLES --- */
.color-picker-container {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    overflow-x: auto; /* Horizontal scroll if needed */
    scrollbar-width: none; /* Hide scrollbar Firefox */
}
.color-picker-container::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome */

.color-swatch {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    flex-shrink: 0;
}

.color-swatch.active {
    transform: scale(1.1);
    border-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Checkmark for active state */
.color-swatch.active::after {
    content: '\f00c'; /* FontAwesome Check */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Update your existing .color-swatch CSS or add this below it */
.color-swatch:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5); /* Semi-transparent white border on hover */
}


/* --- UPDATED LINK BADGE STYLES --- */
.account-link-badge {
    position: absolute;
    bottom: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    z-index: 5;
    transition: transform 0.2s;
    border: 2px solid rgba(255,255,255,0.2); /* Ring to make color pop */
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.account-link-badge:hover { transform: scale(1.15); }

/* SOURCE (Parent) -> Bottom Right */
.account-link-badge.source {
    right: 10px;
    /* Background color will be set dynamically via JS */
}

/* TARGET (Child) -> Bottom Left */
.account-link-badge.target {
    left: 10px;
    right: auto;
    /* Background color will be set dynamically via JS */
}


/* --- BULK SELECTION STYLES --- */

/* 1. When the LIST has this class, show ALL checkboxes */
.trans-list.bulk-mode .t-select-box,
.trans-row.selected-mode .t-select-box {
    display: flex !important;
    animation: fadeIn 0.2s;
}

/* 2. Selected Row Styling (Visual Feedback) */
.trans-row.selected-mode {
    background-color: rgba(255, 146, 0, 0.15) !important; /* Stronger highlight */
    border-color: var(--orange-accent);
}

/* Checkbox (Hidden by default, shown in selection mode) */
.t-select-box {
    display: none; 
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    margin-right: 15px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer; /* Hand cursor for desktop */
}

.trans-row.selection-active .t-select-box {
    display: flex; /* Show when selection mode is active */
}

/* Active Checkbox State */
/* 3. Checkbox State inside a selected row */
.trans-row.selected-mode .t-select-box {
    background-color: var(--orange-accent);
    border-color: var(--orange-accent);
    color: #000;
}

/* BULK ACTION BAR (Floating Bottom) */
.bulk-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-top: 1px solid var(--orange-accent);
    padding: 10px 15px 20px 15px; /* Adjusted padding */
    z-index: 95;
    
    /* Changed from row to column to fit header */
    display: flex;
    flex-direction: column; 
    gap: 10px;
    
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

.bulk-action-bar.active {
    transform: translateY(0);
}

/* New Header Row inside Bulk Bar */
.bulk-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bulk-count-display {
    font-weight: bold;
    color: var(--orange-accent);
    font-size: 1.1em;
}

.bulk-select-all-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bulk-select-all-btn:active { background: #444; }

/* Action Buttons Row */
.bulk-actions-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}


.bulk-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
    cursor: pointer;
    opacity: 0.8;
    transition: 0.2s;
}

.bulk-btn:hover { opacity: 1; transform: translateY(-2px); color: var(--orange-accent); }
.bulk-btn.delete:hover { color: var(--danger-color); }

.bulk-count-badge {
    background: var(--orange-accent);
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 5px;
}

/* --- GEAR ROTATION ANIMATION --- */

/* 1. Add smooth transition to the gear icon */
.fa-gear {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* 2. Rotate when hovering the icon directly */
.fa-gear:hover {
    transform: rotate(180deg);
}

/* 3. (Optional but recommended) Rotate when hovering the buttons containing the gear */
/* This covers the Header Settings button and the Book/Account card settings */
#headerSettingsBtn:hover .fa-gear,
.card-settings-btn:hover .fa-gear {
    transform: rotate(180deg);
}

