/* ============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   Target: 90+ PageSpeed Score for mobile
   ============================================ */

/* 1. DISABLE HEAVY ANIMATIONS ON MOBILE */
@media (max-width: 768px) {

    /* Ensure dark theme has proper background when blobs are hidden */
    body:not(.light-theme) {
        background-color: #030014 !important;
        background-image: radial-gradient(ellipse at 30% 0%,
                rgba(139, 92, 246, 0.12) 0%,
                transparent 60%),
            radial-gradient(ellipse at 70% 100%,
                rgba(99, 102, 241, 0.08) 0%,
                transparent 50%) !important;
    }

    /* Remove animated blobs - major performance hit on mobile GPUs */
    .blob,
    .blob-1,
    .blob-2,
    .blob-3,
    .blob-4,
    .blob-5 {
        display: none !important;
    }

    /* Static gradient replacement for animated background */
    .animated-background {
        animation: none !important;
        background: radial-gradient(ellipse at 30% 0%,
                rgba(139, 92, 246, 0.12) 0%,
                transparent 60%),
            radial-gradient(ellipse at 70% 100%,
                rgba(99, 102, 241, 0.08) 0%,
                transparent 50%) !important;
    }

    /* Reduce backdrop-filter intensity (blur is expensive on mobile) */
    .sidebar,
    .modal-content,
    .sub-item,
    .stat-card,
    .service-card,
    .filter-chip,
    .neon-stat-card {
        -webkit-backdrop-filter: blur(6px) !important;
        backdrop-filter: blur(6px) !important;
    }

    /* Reduce shadow complexity */
    .sub-item,
    .stat-card,
    .service-card {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    }

    /* Faster transitions for snappier feel */
    .sub-item,
    .stat-card,
    .service-card,
    .nav-item,
    .filter-chip {
        transition-duration: 0.15s !important;
    }

    /* Disable hover transforms on touch devices (no hover on mobile) */
    .sub-item:hover,
    .stat-card:hover,
    .service-card:hover {
        transform: none !important;
    }

    /* VIP theme optimizations */
    .theme-vip .sub-item:hover {
        transform: none !important;
    }

    .theme-vip.vip-style-liquid .sub-item {
        animation: none !important;
        background: linear-gradient(125deg, #000, #1a0b2e) !important;
    }

    /* Disable grid scroll animation */
    .theme-vip.vip-atmos-cyber #vip-bg {
        animation: none !important;
    }

    /* Disable aurora animation */
    .theme-vip.vip-atmos-aurora #vip-bg::before {
        animation: none !important;
    }

    /* Disable dust float animation */
    .theme-vip.vip-atmos-luxury #vip-bg::after {
        animation: none !important;
    }
}

/* 2. REDUCED MOTION SUPPORT (Accessibility) */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .blob,
    .blob-1,
    .blob-2,
    .blob-3,
    .blob-4,
    .blob-5,
    .animated-background {
        display: none !important;
    }
}

/* 3. GPU ACCELERATION HINTS FOR SMOOTH SCROLLING */
.sub-list,
.services-grid,
.main-content,
.view {
    will-change: scroll-position;
    /* -webkit-overflow-scrolling: touch; - Deprecated/Non-standard */
}

/* Optimize transforms for GPU */
.sub-item,
.service-card,
.stat-card {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* 4. TOUCH TARGET SIZES (Minimum 44x44px for accessibility) */
@media (pointer: coarse) {

    .nav-item,
    .lang-btn,
    .theme-btn,
    .add-btn,
    .export-btn,
    .budget-quick,
    .close-modal,
    .close-btn,
    .mobile-menu-btn,
    .cal-nav-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Filter chips: only min-height, NOT min-width (to preserve horizontal scroll) */
    .filter-chip {
        min-height: 36px;
        padding: 6px 12px;
    }

    /* Category filter buttons in catalog */
    .category-filters .filter-chip,
    #category-filters button {
        min-height: 32px;
        min-width: auto !important;
        padding: 4px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Ensure clickable icons have proper tap areas */
    .sub-item .sub-actions button,
    .filter-scroll-btn {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 5. PREVENT LAYOUT SHIFT (CLS) */
/* Reserve space for common UI elements */
.logo-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
}

.sub-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
}

/* Font loading optimization */
body {
    font-display: swap;
}

/* 6. OPTIMIZE LARGE LIST RENDERING */
@media (max-width: 768px) {

    /* Simplify card borders */
    .sub-item::before,
    .sub-item::after {
        display: none !important;
    }

    /* Remove complex hover effects */
    .theme-vip.vip-style-holo .sub-item::before,
    .theme-vip.vip-style-luxury .sub-item::before {
        display: none !important;
    }
}

/* 7. SMOOTH SCROLLING (use native when possible) */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* 8. NO HORIZONTAL SCROLL */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.main-content,
.view,
.content-wrapper {
    overflow-x: hidden;
    max-width: 100%;
}

/* 9. PRO BADGE STYLING FIX (Override cached styles) */
body.simple-user-mode .channel-option.pro-lock {
    opacity: 0.8 !important;
}

/* Remove old overlapping badge */
body.simple-user-mode .channel-option.pro-lock::after {
    display: none !important;
}

.plan-badge {
    display: inline-flex !important;
    align-items: center !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    margin-left: 8px !important;
    vertical-align: middle !important;
    letter-spacing: 0.5px !important;
}

.plan-badge.pro {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: #000 !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.plan-badge.free {
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Light Theme Fix for Badge */
body.light-theme .plan-badge.free {
    background: rgba(0, 0, 0, 0.05) !important;
    color: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Light Theme Card Gradient */
body.light-theme .stat-card,
body.light-theme .sub-item,
body.light-theme .service-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.3) 100%) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.05) !important;
}

/* Ensure channel title doesn't wrap awkwardly */
.channel-details strong {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

/* ============================================
   COLLAPSIBLE PRO OFFERS (Catalog)
   ============================================ */
.pro-offers-carousel-wrapper {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 600px;
    opacity: 1;
    overflow: hidden;
    transform: translateY(0);
}

.pro-offers-section.collapsed .pro-offers-carousel-wrapper {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transform: translateY(-20px);
    pointer-events: none;
    visibility: hidden;
    /* Ensure GPU ignores it */
}

.pro-offers-section.collapsed {
    padding-bottom: 0;
}



/* 10. DESKTOP LAYOUT OPTIMIZATIONS (GRID) */
@media (min-width: 769px) {

    html,
    body {
        overflow-x: hidden !important;
        position: relative;
    }

    .sub-list,
    #top-expensive-list {
        display: grid;
        /* auto-fit will wrap cards to next line if they can't fit with at least 380px */
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
        gap: 20px;
        margin: 0;
        width: 100%;
        align-items: start;
        overflow-x: hidden !important;
        /* Block horizontal scroll on desktop */
    }

    /* Force 3 columns maximum if container is wide enough (>= 1400px) */
    @media (min-width: 1400px) {

        .sub-list,
        #top-expensive-list {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    .sub-list .sub-item,
    #top-expensive-list .sub-item {
        width: 100%;
        margin: 0;
        height: auto !important;
        /* Override inline height:100% to allow expansion */
        min-width: 0 !important;
        /* Remove fixed min-width to prevent horizontal overflow */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        position: relative;
        /* Ensure normal flow */
    }

    /* Ensure expanded item is above others if there's any visual overlap (e.g. shadows) */
    .sub-list .sub-item.expanded,
    #top-expensive-list .sub-item.expanded {
        z-index: 10;
        position: relative;
    }
}

/* ========================================
   11. DESKTOP CARD LAYOUT FIXES
   ======================================== */
@media (min-width: 769px) {

    /* Fix aggressive text truncation on desktop cards */
    .sub-item .sub-details h4 {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.3;
        max-width: none !important;
    }

    /* Ensure card names are fully visible */
    .sub-item .sub-details {
        min-width: 0;
        flex: 1;
    }

    /* Category text - no truncation */
    .sub-item .sub-category,
    .sub-item .sub-details span {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    /* Consistent card heights with flexbox */
    .sub-list .sub-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        min-height: unset !important;
        padding: 12px 16px 20px 16px !important;
        box-sizing: border-box;
    }

    /* Hide action-buttons when card is collapsed (removes empty space under price) */
    .sub-list .sub-item:not(.expanded) .action-buttons {
        display: none !important;
    }

    /* Price & Bell - position at top-right corner */
    .sub-list .sub-item .sub-right {
        align-self: flex-start !important;
        margin-top: 0 !important;
        flex-shrink: 0 !important;
    }

    /* COLLAPSED CARDS: position price absolutely so details can extend underneath */
    .sub-list .sub-item:not(.expanded) .sub-right {
        position: absolute !important;
        top: 12px !important;
        right: 16px !important;
        z-index: 5 !important;
    }

    /* COLLAPSED CARDS: details can use full width */
    .sub-list .sub-item:not(.expanded) .sub-details {
        padding-right: 110px !important;
        /* Space for price area on first line only */
    }

    /* EXPANDED CARDS: restore normal flow for sub-right */
    .sub-list .sub-item.expanded .sub-right {
        position: relative !important;
        top: auto !important;
        right: auto !important;
    }

    /* Details section - fill available space */
    .sub-list .sub-item .sub-details {
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Sub-left container (icon + details) */
    .sub-item .sub-left {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        flex: 1;
        min-width: 0;
    }

    /* Icon sizing */
    .sub-item .sub-icon,
    .sub-item .sub-icon-outer {
        flex-shrink: 0;
        width: 48px;
        height: 48px;
    }

    /* Right side (price + actions) - HIDE on Desktop */
    .sub-item .sub-right.mobile-sub-right {
        display: none !important;
    }

    /* Show the internal desktop price actions */
    .sub-item .desktop-price-actions {
        display: flex !important;
    }

    /* Price display */
    .sub-item .sub-price {
        font-size: 1.1rem;
        font-weight: 700;
        text-align: right;
        white-space: nowrap;
    }

    /* Action buttons container */
    .sub-item .action-buttons {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    /* Badges - show full text, display inline in one row */
    .sub-item .badge {
        white-space: nowrap;
        flex-shrink: 0;
        overflow: visible !important;
        text-overflow: clip !important;
        display: inline-flex !important;
    }

    /* Badges container - display in one row */
    .sub-item .sub-details .badges-container,
    .sub-item .sub-details .badge-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        align-items: center !important;
    }

    /* If badges are direct children of sub-details, make them inline */
    .sub-item .sub-details {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        min-width: 0 !important;
        padding-right: 0px !important;
        /* Ensure NO right padding from anywhere */
        flex: 1 !important;
        overflow: visible !important;
        /* FIXED: Allow content to overflow/wrap */
    }

    /* Category and badges row - optimize for maximum width with FLOW layout */
    /* Category and badges header - "Flow" layout via Class */
    .sub-item .sub-category-row {
        display: block !important;
        /* Block to occupy full width */
        width: 100% !important;
        padding: 0 !important;
        white-space: normal !important;
        /* Allow internal text wrapping */
        line-height: normal !important;
        margin-top: 2px !important;
    }

    /* Category Title - Inline */
    .sub-item .sub-category-row>p {
        display: inline !important;
        white-space: normal !important;
        float: none !important;
        margin-right: 8px !important;
        line-height: 1.5 !important;
    }

    /* Category badges container - Inline Wrapper */
    .sub-item .category-badges {
        display: inline !important;
        /* Use inline to flow naturally */
        white-space: normal !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Individual Badges - Flow like text */
    .sub-item .category-badges span {
        display: inline-flex !important;
        vertical-align: middle !important;
        margin-right: 4px !important;
        margin-bottom: 2px !important;
        font-size: 0.72rem !important;
        padding: 2px 6px !important;
        line-height: 1.1 !important;
        float: none !important;
    }

    /* Notes container - full width within its container */
    .sub-item .sub-note,
    .sub-item .notes-text {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* General paragraph text - show full */
    .sub-item .sub-details p:not(.notes-text) {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: 100%;
    }

    /* SPECIFIC OVERRIDE: Allow Category Name to shrink somewhat, but prefer wrapping over ellipsis vs badges */
    .sub-item .sub-details>div:has(.category-badges)>p {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex-shrink: 0 !important;
        /* Don't shrink aggressively, let it wrap if needed */
        max-width: 100%;
    }

    /* Comments/notes - truncate to 1 line, fit card width */
    .sub-item .notes-text {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }

    /* Target the span inside notes-text specifically */
    .sub-item .notes-text span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: inline !important;
    }

    /* When card is expanded - show full notes */
    .sub-item.expanded .notes-text {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .sub-item.expanded .notes-text span {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    /* Calendar day panel card fixes */
    .calendar-day-sub-item .sub-details h4 {
        max-width: none !important;
        white-space: normal !important;
    }

    /* ========================================
       DESKTOP CARD EXPANSION FIXES
       Use horizontal space efficiently
       ======================================== */

    /* When card is expanded - compact layout, sizes to content */
    .sub-item.expanded {
        flex-wrap: nowrap !important;
        min-height: unset !important;
        /* Let content determine height */
        padding-bottom: 22px !important;
        /* For progress bar */
        align-items: flex-start !important;
        /* Align content to top */
    }

    /* Left section (icon) stays fixed */
    .sub-item .sub-icon-outer {
        flex-shrink: 0 !important;
        align-self: flex-start !important;
    }

    /* Details section - takes full available width, with minimum */
    .sub-item.expanded .sub-details {
        flex: 1 1 auto !important;
        min-width: 120px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        overflow: hidden !important;
    }

    /* Badges display inline with name/category */
    .sub-item.expanded .sub-details .badge {
        display: inline-flex !important;
        margin-right: 6px !important;
        margin-top: 4px !important;
        vertical-align: middle;
    }

    /* Notes display - limited to 2 lines (except notes-text which shows full) */
    .sub-item.expanded .sub-note,
    .sub-item.expanded .sub-details p.note {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        line-clamp: 2 !important;
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: 4px;
        max-height: 2.6em !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;
    }

    /* Right section - flexible width, allows shrink and wrap */
    .sub-item.expanded .sub-right {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px !important;
        flex-shrink: 1 !important;
        flex-grow: 0 !important;
        justify-content: flex-end !important;
        margin-left: auto !important;
    }

    /* FIX: Allow wrapping but keep Bell with Price via 'contents' display */
    .sub-item.expanded .desktop-price-actions {
        align-items: flex-start !important;
        flex-wrap: wrap !important;
        /* Allow wrapping */
        justify-content: flex-end !important;
    }

    /* Fine-tune Price alignment with Bell */
    .sub-item.expanded .sub-price {
        white-space: nowrap !important;
        text-align: right !important;
        margin-top: 6px !important;
        /* Visual align with Bell icon */
    }

    /* Flatten hierarchy so Bell sits next to Price, while Actions can wrap */
    .sub-item.expanded .action-buttons {
        display: contents !important;
    }

    /* The actual actions block (edit/delete) - can wrap to next line alone */
    .sub-item.expanded .expanded-actions {
        display: flex !important;
        gap: 6px !important;
        margin-left: 8px !important;
        /* Spacing if on same line */
    }

    /* Action buttons - compact */
    .sub-item.expanded .action-buttons button,
    .sub-item.expanded .expanded-actions button {
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }

    /* Payment progress bar at bottom */
    .sub-item .payment-progress-container {
        position: absolute;
        bottom: 8px;
        left: 16px;
        right: 16px;
        z-index: 5;
    }

    /* Mobile actions (chevron/bell) - position in corner */
    .sub-item .mobile-actions {
        position: absolute;
        top: 10px;
        right: 10px;
        display: flex;
        gap: 4px;
        z-index: 10;
    }

    /* Chevron on desktop - Visible per user request */
    .sub-item .expand-chevron {
        display: inline-block !important;
        /* Show chevron */
    }

    /* Rotate chevron when expanded */
    .sub-item.expanded .expand-chevron {
        transform: rotate(180deg);
    }
}

/* ========================================
   12. UNIVERSAL TABLET & DESKTOP RESET (> 768px)
   Overrides previous desktop styles to ensure consistent row layout
   ======================================== */
/* ========================================
   12. UNIVERSAL TABLET & DESKTOP RESET (> 768px)
   Overrides previous desktop styles to ensure consistent row layout
   ======================================== */
@media (min-width: 768px) {

    /* Grid Layout - Consistent Columns */
    .sub-list,
    #top-expensive-list {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)) !important;
        gap: 16px !important;
    }

    /* Card Container - Align stretch to let right side fill height */
    .sub-list .sub-item,
    #top-expensive-list .sub-item {
        margin: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        /* Stretch so right side can push price to bottom */
        padding: 12px 14px !important;
        gap: 12px !important;
        min-height: 90px !important;
        /* Slightly taller for vertical spacing */
        position: relative !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* 1. HIDE Mobile Actions */
    .sub-list .sub-item .mobile-actions {
        display: none !important;
    }

    /* 2. SHOW Desktop Controls (Bell + Chevron) at TOP RIGHT */
    .sub-list .sub-item .desktop-only-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        order: 1 !important;
        /* TOP */
        opacity: 1 !important;
        visibility: visible !important;
        margin-left: 0 !important;
        margin-bottom: auto !important;
        /* Push price down */
        z-index: 20 !important;
    }

    .sub-list .sub-item .desktop-only-wrapper .bell-indicator,
    .sub-list .sub-item .desktop-only-wrapper i {
        opacity: 1 !important;
        visibility: visible !important;
        color: inherit;
        font-size: 1.3rem !important;
        display: flex !important;
    }

    /* 3. Icon Container - Fixed Size */
    .sub-list .sub-item .sub-icon-outer {
        order: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        justify-content: center !important;
    }

    .sub-list .sub-item .sub-icon-outer .sub-icon,
    .sub-list .sub-item .sub-icon-outer .sub-icon>div {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
    }

    /* 4. Details Section - Vertically centered */
    .sub-list .sub-item .sub-details {
        order: 2 !important;
        flex: 1 !important;
        padding-right: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        /* Keep text centered */
    }

    /* 5. Right Section (Controls Top, Price Bottom) */
    .sub-list .sub-item .sub-right {
        order: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        /* Stack Vertically */
        align-items: flex-end !important;
        /* Align Right */
        justify-content: space-between !important;
        /* Spread Top/Bottom */
        gap: 4px !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        position: relative !important;
        top: auto !important;
        right: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
        /* Will stretch due to parent */
        min-width: 80px !important;
        /* Ensure space */
        max-width: none !important;
        width: auto !important;
        z-index: 20 !important;
    }

    /* Price Styling - BOTTOM RIGHT - Single Line with Unit */
    .sub-list .sub-item .sub-price {
        font-size: 1.1em !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        display: flex !important;
        /* Use Flex to align unit */
        flex-direction: row !important;
        align-items: baseline !important;
        justify-content: flex-end !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        order: 2 !important;
        /* BOTTOM */
        margin-right: 0 !important;
        /* Align strict right */
        opacity: 1 !important;
        visibility: visible !important;
        color: white !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
        z-index: 21 !important;
        transform: none !important;
        align-self: flex-end !important;
    }

    body.light-theme .sub-list .sub-item .sub-price {
        color: #0f172a !important;
        text-shadow: none !important;
    }


    /* Price Unit Styling (e.g. /mo) - Smaller and lighter */
    .sub-list .sub-item .sub-price small {
        display: inline-block !important;
        font-size: 0.65em !important;
        /* Smaller */
        margin-left: 3px !important;
        font-weight: 400 !important;
        opacity: 0.7 !important;
    }

    /* HIDE Action Buttons (Edit/delete) when Collapsed */
    .sub-list .sub-item:not(.expanded) .action-buttons {
        display: none !important;
    }

    /* SHOW Action Buttons when Expanded */
    .sub-list .sub-item.expanded .action-buttons {
        display: flex !important;
        width: 100% !important;
        justify-content: flex-end !important;
        margin-top: 15px !important;
        padding-top: 15px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        order: 10 !important;
        /* Drop to bottom of block */
    }

    /* FIX: When expanded, keep flex row but align top */
    .sub-list .sub-item.expanded {
        flex-wrap: nowrap !important;
        /* Keep columns intact */
        padding-bottom: 25px !important;
        /* Extra padding for progress/date */
        height: auto !important;
        align-items: flex-start !important;
        /* Keep icon at top */
    }

    /* FIX: Allow sub-right to wrap internally */
    .sub-list .sub-item.expanded .sub-right {
        flex-wrap: wrap !important;
        max-width: 40% !important;
    }

    /* Progress bar position - RESTORED */
    .sub-list .sub-item .payment-progress-container {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 3px !important;
        border-radius: 0 !important;
        background: rgba(255, 255, 255, 0.05) !important;
        display: block !important;
        /* Show it! */
        z-index: 10 !important;
    }

    .sub-list .sub-item .payment-progress-container .progress-bar {
        height: 100% !important;
        /* Ensure the inner bar fills height */
    }

    /* Date Label - RESTORED & Positioned */
    .sub-list .sub-item .payment-progress-container .next-date-label {
        display: block !important;
        position: absolute !important;
        bottom: 6px !important;
        /* Above the bar */
        left: 0 !important;
        width: auto !important;
        color: rgba(255, 255, 255, 0.5) !important;
        font-size: 0.75rem !important;
        padding-left: 14px !important;
        /* Align with left padding */
        pointer-events: none !important;
    }

    body.light-theme .sub-list .sub-item .payment-progress-container .next-date-label {
        color: #475569 !important;
    }

}