/* Block standard text selection but allow it in inputs */
body { 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background-color: #f3f4f6; color: #1f2937; margin: 0; padding: 0; display: flex; height: 100vh; overflow: hidden; font-size: 0.95rem; 
    -webkit-user-select: none;
    user-select: none;
    position: relative; 
}
input, select, textarea {
    -webkit-user-select: text;
    user-select: text;
    min-width: 0; 
}

/* Layout & Smooth Sidebar Animation */
.sidebar { 
    position: fixed; 
    left: 0; 
    top: 0;
    height: 100%;
    width: 350px; 
    max-width: 85vw;
    background: #ffffff; 
    flex-shrink: 0; 
    overflow-x: hidden; 
    overflow-y: auto; 
    z-index: 2000; 
    box-shadow: 5px 0 25px rgba(0,0,0,0.15); 
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}
.sidebar.hidden { 
    transform: translateX(-100%); 
    box-shadow: none; 
}
.sidebar-inner { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    height: 100%;
    padding-top: 50px; 
    box-sizing: border-box; 
}

/* Top Left Menu Button */
#mobile-menu-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2001; 
    background: #1f2937;
    color: white;
    border: none;
    border-radius: 6px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background 0.2s, transform 0.1s;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
#mobile-menu-btn:hover { background: #111827; }
#mobile-menu-btn:active { transform: scale(0.95); }
#mobile-menu-btn:focus { outline: none; }

/* Smooth scroll with forced overscroll bounce on mobile */
.main-content { 
    flex: 1; padding: 0 40px 20px 40px; overflow-y: auto; scrollbar-gutter: stable; position: relative; 
    background-color: #f3f4f6; scroll-behavior: smooth; 
    -webkit-overflow-scrolling: touch; overscroll-behavior-y: auto;
}

.dash-header-wrap { display: flex; justify-content: space-between; align-items: center; margin: 5px 0; flex-wrap: wrap; gap: 10px; }
.dash-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex-shrink: 0; max-width: 100%; }
.dash-title-row h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }

.date-badge-btn { background-color: #d1fae5 !important; color: #065f46 !important; border: 2px solid #10b981 !important; border-radius: 4px !important; font-weight: bold !important; font-size: 1rem !important; padding: 6px 15px !important; white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: background 0.2s; display: inline-flex; align-items: center; justify-content: center;}
.date-badge-btn:hover { background-color: #a7f3d0 !important; }

.budget-header-controls { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; flex-shrink: 0; }
.budget-header-controls button { height: 36px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }

@media (min-width: 601px) {
    .expense-input { color: #dc2626 !important; }
}

.mobile-only { display: none !important; }

.item-desc-content { padding-right: 15px; }

/* Dashboard Desktop Padding for Date */
.day-wrapper { padding-left: 8px; }

@media (max-width: 768px) {
    .dash-header-wrap { flex-direction: column; align-items: stretch; gap: 8px; }
    .dash-title-row { width: 100%; justify-content: space-between; }
    .budget-header-controls { width: 100%; justify-content: space-between; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
}

@media (max-width: 600px) {
    .mobile-only { display: block !important; }
    .lock-icon { display: none !important; } 
    
    .main-content { padding: 0 8px 10px 8px; }
    .ebucks-layout { flex-direction: column; }
    
    .summary-dashboard { flex-direction: row !important; flex-wrap: nowrap !important; justify-content: space-between; padding: 10px 5px !important; gap: 4px !important; border-radius: 8px !important; max-width: 100% !important;}
    .summary-box { padding: 0; }
    .summary-box h3 { font-size: 0.55rem !important; margin-bottom: 2px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.3px;}
    .summary-box .amount { font-size: 0.85rem !important; }
    
    .dash-title-row h1 { font-size: 1rem !important; display: none;} 
    .date-badge-btn { padding: 4px 8px !important; font-size: 0.8rem !important; }
    
    .budget-header-controls { gap: 4px !important; scrollbar-width: none; }
    .budget-header-controls::-webkit-scrollbar { display: none; }
    .budget-header-controls button { padding: 6px 2px !important; font-size: 0.75rem !important; flex: 1; justify-content: center; height: 32px;}
    
    body { font-size: 0.8rem; }
    table { font-size: 0.75rem; }
    input[type="text"], input[type="month"], input[type="password"], select { padding: 4px 2px; font-size: 0.75rem;}
    h2 { font-size: 1.1rem; }
    
    .val-input { font-size: 1.05rem !important; padding: 4px !important; font-weight: 700; color: #111827; }
    .table-input { padding: 4px 2px !important; font-size: 0.8rem !important; }
    
    .tag-excluded, .tag-ebucks, .day-badge, .tag-saving { padding: 2px 4px !important; font-size: 0.65rem !important; margin-left: 2px !important; }

    #main-budget-table { table-layout: fixed; width: 100%; border-spacing: 0; }
    
    #main-budget-table th { padding: 4px 2px; }
    #main-budget-table .section-header td { padding: 8px 2px !important; }
    
    #main-budget-table .collapsible-row td { position: relative; padding: 0 !important; vertical-align: middle; height: 1px; }
    
    #main-budget-table th:nth-child(1) { width: 40%; }
    #main-budget-table th:nth-child(2), #main-budget-table th:nth-child(3), #main-budget-table th:nth-child(4) { width: 20%; }
    
    .collapsible-content { 
        white-space: normal; 
        word-break: break-word; 
        position: relative !important; 
        padding: 6px 2px; 
        box-sizing: border-box;
        height: 100%;
        display: flex;
        align-items: center;
        z-index: 1; 
    }

    .item-desc-content { padding-right: 0 !important; }
    /* Removes padding next to the day button so it hugs the text box */
    .day-wrapper { padding-left: 1px !important; }

    .num-col .collapsible-content {
        justify-content: flex-end;
        text-align: right;
    }
    
    #main-budget-table tfoot td { padding: 4px !important; height: auto; }
    #main-budget-table tfoot td.num-col { padding-right: 6px !important; }
    #main-budget-table tfoot tr { font-size: 0.85rem !important; }

    .planner-hide-mobile { display: none !important; }
    .planner-show-mobile { display: table-cell !important; }
    .planner-table th, .planner-table td { padding: 4px 2px !important; font-size: 0.75rem; }
    
    /* Ensure Planner columns are strictly sized for right-alignment */
    .planner-table th:nth-child(2) { width: 65%; }
    .planner-table th:nth-child(7) { width: 35%; text-align: right; padding-right: 6px;}

    #planner-body .num-col input { padding: 2px; font-size: 0.9rem !important;}
    
    .add-row-btn-planner { padding: 4px 2px !important; font-size: 0.75rem !important; }

    .floating-side-panel {
        top: auto !important;
        bottom: 20px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        border-radius: 8px;
    }

    .mobile-btn-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
    }
    .mobile-btn-grid #add-category-btn { grid-column: 1 / 2; min-width: 0 !important; font-size: 0.8rem; padding: 10px 4px !important;}
    .mobile-btn-grid #copy-month-btn { grid-column: 2 / 3; min-width: 0 !important; font-size: 0.8rem; padding: 10px 4px !important;}
    .mobile-btn-grid #clear-actuals-btn { grid-column: 1 / 3; width: 100%; min-width: 0 !important; padding: 10px !important; margin: 0 !important;}

    .planner-drag-mobile-hide { display: none !important; }

    .summary-wrapper { 
        gap: 6px; 
        padding: 0 0 5px 55px; 
    }
    .summary-arrow-btn { padding: 0 2px; font-size: 1rem; }

    .sash-badge {
        position: absolute !important;
        top: 50% !important;
        left: 0 !important;
        transform: translateY(-50%) rotate(-30deg) !important;
        width: auto !important; 
        min-width: 60px !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 2px 6px !important;
        font-size: 0.5rem !important;
        opacity: 0.7 !important; 
        pointer-events: none !important; 
        text-transform: uppercase !important;
        border-radius: 4px !important;
        letter-spacing: 0.5px !important;
        font-weight: 900 !important;
        box-shadow: none !important;
        transform-origin: left center !important;
        z-index: 0 !important; 
    }

    /* Sticky Save Mobile Override */
    .edit-actions-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 15px;
        background: white;
        border-top: 1px solid #e5e7eb;
        z-index: 100;
        display: flex;
        gap: 10px;
        box-sizing: border-box;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .edit-actions-container button {
        flex: 1;
        padding: 12px;
        font-size: 1.05rem;
    }
    #view-edit {
        padding-bottom: 80px; 
    }

    /* Back Button Text Hiding on Mobile */
    .nav-back-btn .back-text { display: none; }
    .nav-back-btn { padding: 8px !important; }
}

.planner-show-mobile { display: none !important; }

.planner-table { table-layout: fixed; width: 100%; border-spacing: 0; }

h1, h2, h3 { color: #111827; }
.panel { padding: 20px; border-bottom: 2px solid #e5e7eb; }
.panel-title { 
    font-size: 0.75rem !important; 
    font-weight: bold; 
    margin-bottom: 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af !important;
}

input[type="text"], input[type="month"], input[type="password"], select { width: 100%; padding: 8px; border: 1px solid #d1d5db; border-radius: 4px; box-sizing: border-box; font-family: inherit; }

input[inputmode="decimal"], input[type="password"] { text-align: right; }
input[type="text"]:focus, input[type="month"]:focus, input[type="password"]:focus, select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }

#edit-name { text-align: left !important; }
#edit-name::placeholder { color: #9ca3af; font-style: italic; font-weight: normal; }

.val-input { font-size: 1.15rem; font-weight: 700; padding: 6px; color: #111827; }

.table-input { width: 100%; min-width: 0; padding: 4px 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; text-align: right; box-sizing: border-box; transition: border-color 0.2s, background-color 0.2s; margin: 0; }
.table-input:focus { outline: none; border-bottom: 2px solid #3b82f6; background-color: #f9fafb; }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #d1d5db; transition: .3s; border-radius: 9999px; }
.toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.toggle-switch input:checked + .toggle-slider { background-color: #10b981; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

.locked-input { 
    background-color: transparent !important; 
    border-color: transparent !important; 
    cursor: pointer !important; 
    box-shadow: none !important; 
    padding-right: 0 !important; 
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    opacity: 1 !important; 
}

button { background: #2563eb; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: background 0.2s; display: flex; align-items: center; gap: 8px; justify-content: center;}
button:hover:not(:disabled) { background: #1d4ed8; }
button.danger { background: #ef4444; }
button.danger:hover:not(:disabled) { background: #b91c1c; }
button.secondary { background: #6b7280; }
button.secondary:hover:not(:disabled) { background: #4b5563; }
button.success { background: #10b981; }
button.success:hover:not(:disabled) { background: #059669; }
button:disabled { background: #9ca3af !important; cursor: not-allowed !important; opacity: 0.6 !important; }

/* Inline Clear Buttons */
.inline-clear-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none;
    color: #9ca3af;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    transition: color 0.2s;
}
.inline-clear-btn:hover { color: #4b5563; }
.inline-clear-btn:focus { outline: none; }

.round-btn { border-radius: 50%; width: 26px; height: 26px; padding: 0; display: inline-flex; justify-content: center; align-items: center; font-size: 14px; flex-shrink: 0; }

.nav-container { display: flex; flex-direction: column; gap: 8px; }
button.nav-btn { 
    width: 100%; 
    justify-content: flex-start; 
    padding: 10px 15px; 
    background: transparent; 
    color: #1f2937; 
    border-radius: 6px; 
    border: none; 
    font-weight: 600; 
    font-size: 0.95rem; 
    transition: all 0.2s;
}
button.nav-btn:hover, button.nav-btn:active { 
    background: #e0f2fe; 
    color: #1d4ed8; 
}
button.template-btn { 
    background: transparent; 
    color: #4b5563; 
    border: 1px dashed #d1d5db; 
}
button.template-btn:hover { 
    background: #f3f4f6; 
    color: #1f2937;
}

table { width: 100%; border-collapse: collapse; margin-bottom: 5px; background: #ffffff;}
td { padding: 10px; text-align: left; border-bottom: 1px solid #e5e7eb; }

/* Sticky Header solid background fix with explicitly removed vertical borders */
th { 
    padding: 10px; 
    text-align: left; 
    border-bottom: 2px solid #e5e7eb; 
    background-color: #f9fafb; 
    font-weight: 600; 
    color: #4b5563; 
    position: sticky; 
    top: 0; 
    z-index: 10; 
    background-clip: padding-box;
    border-left: none !important;
    border-right: none !important;
    outline: none !important;
}

th.num-col, td.num-col { text-align: right; width: 18%; }

#main-budget-table tfoot td.num-col { padding-right: 18px; }

.collapsible-row {
    transition: background 0.2s, transform 0.2s ease-out;
}
.collapsible-row td {
    transition: all 0.4s ease-out;
}
.collapsible-content {
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, transform 0.4s ease-out;
    max-height: 200px;
    opacity: 1;
    overflow: hidden;
    transform: translateY(0);
}
.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    padding: 0 !important; 
    border: none !important;
}

.collapsed td, .collapsed th {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
    line-height: 0 !important;
    height: 0 !important;
}

.bg-white { background-color: #ffffff; }
.bg-grey { background-color: #f8fafc; }

.planner-month-header { background-color: #e5e7eb; border-top: 2px solid #d1d5db; cursor: pointer; transition: background 0.2s; }
.planner-month-header:hover { background-color: #d1d5db; }

.planner-swiped-bg { background-color: #eff6ff !important; }

.clickable-row { cursor: pointer; -webkit-touch-callout: none; }
.clickable-row:hover { background-color: #f0f9ff; }

.drag-handle { cursor: grab; color: #9ca3af; padding-right: 8px; display: inline-flex; align-items: center; justify-content: center; user-select: none; touch-action: none; width: 18px;}
.drag-handle:active { cursor: grabbing; }

.multi-select-cb { transform: scale(1.3); margin-right: 10px; cursor: pointer; }

.floating-drag-clone { position: fixed; pointer-events: none; z-index: 9999; background: white; box-shadow: 0 10px 25px rgba(0,0,0,0.15); opacity: 0.95; border-collapse: collapse; }
.drag-placeholder td, .drag-placeholder div { background: #eff6ff !important; border: 2px dashed #3b82f6 !important; padding: 15px !important; text-align: center; color: #3b82f6; font-weight: bold; }

.add-row-btn { background: transparent; border: 2px dashed #d1d5db; color: #6b7280; padding: 8px 15px; border-radius: 6px; justify-content: flex-start; cursor: pointer; font-weight: 600; transition: all 0.2s; display: inline-flex;}
.add-row-btn:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }

.tag-excluded { background-color: #fee2e2; color: #dc2626; padding: 2px 6px; border-radius: 4px; margin-left: 5px; font-weight: 600; font-size: 0.75rem; }
.tag-ebucks { background-color: #d1fae5; color: #059669; padding: 2px 6px; border-radius: 4px; margin-left: 5px; font-weight: 600; font-size: 0.75rem; }
.tag-saving { background-color: #dbeafe; color: #2563eb; padding: 2px 6px; border-radius: 4px; margin-left: 5px; font-weight: 600; font-size: 0.75rem; }
.day-badge { background-color: #e5e7eb; color: #4b5563; padding: 2px 6px; border-radius: 4px; margin-left: 5px; font-weight: bold; font-size: 0.75rem; }

.ebucks-layout { display: flex; gap: 30px; }
.ebucks-col { flex: 1; background: #ffffff; padding: 20px 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border: 1px solid #e5e7eb; }
.checklist-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid #f3f4f6; position: relative; transition: transform 0.2s ease-out;}
.checklist-item.min-spend-row { background-color: #f3f4f6; border-radius: 6px; padding: 8px 10px; margin-top: 8px; border-bottom: none; border: 1px solid #d1d5db; }
.pts { font-weight: bold; color: #059669; min-width: 40px; text-align: right; }
.ebucks-total-row { display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 2px solid #e5e7eb; margin-top: 15px; }
.ebucks-total-row h3 { margin: 0; font-size: 1.1rem; color: #1f2937; }
.pts-total { font-weight: bold; font-size: 1.3rem; }

.cl-desc { border: none; background: transparent; font-size: inherit; font-family: inherit; width: 100%; font-weight: inherit; color: inherit; margin-right: 10px; cursor: text; }
.cl-desc:focus { outline: none; border-bottom: 1px solid #3b82f6; }
.cl-pts { border: none; background: transparent; font-size: inherit; font-family: inherit; width: 50px; font-weight: bold; color: #059669; text-align: right; cursor: text; margin-right:15px; }
.cl-pts:focus { outline: none; border-bottom: 1px solid #3b82f6; }

.summary-wrapper {
    display: flex;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: transparent !important; 
    padding: 0 0 5px 60px; 
    margin-bottom: 5px;
    align-items: stretch;
    justify-content: center;
}

.summary-dashboard { 
    flex: 1; 
    display: flex; gap: 15px; background-color: #1f2937; color: white; padding: 15px 20px; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); cursor: pointer; user-select: none;
    max-width: 1200px;
}

.summary-arrow-btn {
    background: transparent;
    color: #9ca3af;
    border: none;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: stroke 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.summary-arrow-btn svg { stroke: #9ca3af; transition: stroke 0.2s ease; }
.summary-arrow-btn:hover svg { stroke: #1f2937; }
.summary-arrow-btn:active { transform: scale(0.9); }
.summary-arrow-btn:focus, .summary-arrow-btn:active {
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.summary-box { flex: 1; text-align: center; }
.summary-box h3 { margin: 0 0 5px 0; font-size: 0.85rem; color: #9ca3af; text-transform: uppercase; }
.summary-box .amount { font-size: 1.3rem; font-weight: bold; }

.section-header { background-color: #e5e7eb; font-weight: bold; color: #1f2937; transition: background 0.2s; cursor: pointer; border-top: 2px solid #d1d5db; }
.section-header:hover { background-color: #d1d5db; }
.subtotal-row td { background-color: #f9fafb; font-weight: bold; border-top: 2px solid #d1d5db; }
.positive { color: #059669; font-weight: bold; }
.negative { color: #dc2626; font-weight: bold; }
.ebucks-item { color: #059669; font-weight: 500; }

.view-section { display: none; animation: fadeIn 0.3s ease; }
.active-view { display: block !important; min-height: calc(100vh + 1px); padding-bottom: 50px; }
.padded-view { padding-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.edit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cc-box { background: #fffbeb; padding: 15px; border-radius: 8px; border: 1px solid #fde68a; margin-bottom: 20px; }
.cc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }

/* Edit Menu Cards */
#view-edit {
    background-color: #f3f4f6;
}
.edit-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}
.edit-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
}
.edit-input {
    font-size: 1.1rem;
    color: #111827 !important;
    font-weight: 600;
    width: 100%;
    border: none !important;
    border-bottom: 1px solid #d1d5db !important;
    border-radius: 0 !important;
    padding: 8px 0 !important;
    background: transparent !important;
    margin-bottom: 15px;
    box-sizing: border-box;
}
.edit-input:focus {
    outline: none;
    border-bottom: 2px solid #3b82f6 !important;
    box-shadow: none !important;
}

.edit-actions-container {
    display: flex;
    gap: 10px;
}

.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:1000; align-items:center; justify-content:center; }
.modal-content { background:white; border-radius:8px; max-width:420px; width:90%; padding:25px; text-align:center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.month-list-item:hover { background-color: #f3f4f6; }

.swipe-pill { position: fixed; right: -120px; transform: translateY(-50%); padding: 8px 20px; border-radius: 25px; font-weight: bold; color: white; background: #ef4444; cursor: pointer; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: right 0.2s ease-out; display: flex; align-items: center; justify-content: center; }
.swipe-pill.show { right: 15px; }

.floating-side-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 220px;
    background: #ffffff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 900;
    display: flex;
    flex-direction: column;
}

.tq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px;}
.tq-btn { background-color: #f3f4f6; color: #1f2937; border: 2px solid #d1d5db; border-radius: 8px; padding: 15px; font-size: 1.05rem; font-weight: bold; cursor: pointer; transition: all 0.2s; text-align: center; display: flex; align-items: center; justify-content: center; min-height: 80px; width: 100%; box-sizing: border-box; }
.tq-btn:hover { background-color: #e5e7eb; border-color: #9ca3af; }

@media (prefers-color-scheme: dark) {
    body, .main-content { background-color: #111827; color: #f3f4f6; }
    h1, h2, h3, .panel-title, .dash-title-row h1, .val-input { color: #ffffff !important; }
    
    .sidebar, .panel, table, .ebucks-col, .modal-content, .bg-white, 
    #quick-add-cat-container, .edit-card, .floating-side-panel { 
        background: #1f2937 !important; 
        border-color: #374151 !important; 
    }
    
    th, .section-header, .bg-grey, .checklist-item.min-spend-row, .planner-month-header { 
        background-color: #374151 !important; 
        color: #f3f4f6 !important; 
        border-color: #4b5563 !important; 
    }
    
    .clickable-row:hover, .section-header:hover, .planner-month-header:hover, .month-list-item:hover { 
        background-color: #374151 !important; 
    }
    
    td, th, .panel, .ebucks-total-row, .checklist-item, .date-picker-list, .floating-side-panel, [style*="border-top: 1px solid #e5e7eb"] { 
        border-color: #374151 !important; 
    }
    
    input[type="text"], input[type="month"], input[type="password"], select, .table-input:focus, .edit-input:focus { 
        background-color: #374151 !important; 
        color: #f3f4f6 !important; 
        border-color: #4b5563 !important; 
    }
    .table-input { color: #f3f4f6 !important; }
    #edit-name::placeholder { color: #6b7280; }
    .locked-input { color: #f3f4f6 !important; -webkit-text-fill-color: #f3f4f6 !important; }
    
    button.secondary { background: #374151; color: #d1d5db; border-color: #4b5563; }
    button.secondary:hover:not(:disabled) { background: #4b5563; }
    button.nav-btn, .tq-btn { background: transparent; color: #f3f4f6; border: none; }
    button.nav-btn:hover, .tq-btn:hover { background: #4b5563; border-color: #6b7280; color: #e0f2fe; }
    #mobile-menu-btn { background: #374151; color: #f3f4f6; }
    #mobile-menu-btn:hover { background: #4b5563; }
    button.template-btn { border-color: #4b5563; color: #d1d5db; }
    button.template-btn:hover { background: #374151; color: #f3f4f6; }
    
    .clear-btn, .inline-clear-btn { background: transparent !important; color: #9ca3af !important; }
    .clear-btn:hover, .inline-clear-btn:hover { color: #f3f4f6 !important; }

    .date-badge-btn { background-color: #064e3b !important; color: #a7f3d0 !important; border-color: #059669 !important; }
    .date-badge-btn:hover { background-color: #065f46 !important; }
    .summary-dashboard { background-color: #0f172a; border-top: 1px solid #1e293b; }
    .day-badge { background-color: #4b5563; color: #f3f4f6; }
    .cc-box { background: #422006; border-color: #713f12; }
    .drag-placeholder td, .drag-placeholder div { background: #1e3a8a !important; border-color: #3b82f6 !important; }
    .floating-drag-clone { background: #1f2937 !important; }

    .summary-arrow-btn { background: transparent !important; border: none; color: #6b7280 !important; }
    .summary-arrow-btn svg { stroke: #6b7280; }
    .summary-arrow-btn:hover svg { stroke: #f3f4f6 !important; }
    
    [style*="color: #4b5563"], [style*="color:#4b5563"], 
    [style*="color: #1f2937"], [style*="color:#1f2937"],
    .ebucks-total-row h3 { 
        color: #d1d5db !important; 
    }
    [style*="background: #f3f4f6"], [style*="background-color: #f3f4f6"] {
        background-color: #1f2937 !important;
    }
    [style*="background: #f9fafb"] {
        background-color: #374151 !important;
    }

    .edit-actions-container {
        background: #1f2937 !important;
        border-color: #374151 !important;
    }
}

.no-transition * {
  transition: none !important;
}

#main-budget-table th {
  top: 90px; 
}

@media (max-width: 600px) {
    .item-name-input.long-desc {
        font-size: 0.7rem !important; 
        letter-spacing: -0.3px;
    }
}