/* 
 * Cleanup CSS
 * Styles extracted from inline HTML attributes for better maintainability and linter compliance.
 */

/* Browser Warning */
#browser-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-family: sans-serif;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#browser-warning a {
    color: #fef08a;
    text-decoration: underline;
    margin-left: 8px;
}

#browser-warning button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 12px;
}

.user-sync-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Sidebar & Brand */
.brand, .brand-mobile {
    cursor: pointer;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.beta-badge {
    font-size: 0.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ec4899);
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.sidebar-legal-links {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.7rem;
    padding-left: 4px;
}

.sidebar-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.sidebar-legal-links a:hover {
    color: var(--text-primary) !important;
    /* Force override inline-like behavior */
}

/* Common Layout */
.content-max-width {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.content-max-width.limit-width-only {
    width: auto;
    margin: 0;
}

/* Dashboard Controls */
.limit-warning {
    display: none;
    margin-top: 12px;
}

.dashboard-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    margin-bottom: 15px;
    padding: 0 5px;
}

.dashboard-control-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.dashboard-control-header h3 i {
    vertical-align: middle;
    margin-right: 6px;
}

.mobile-collapse-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.2rem;
}

/* Stats */
.stat-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label-flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ri-wallet-mobile {
    display: none;
    color: var(--accent);
    font-size: 1.1em;
}

.next-date-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Notification Header in Dashboard */
.notify-header {
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.notify-desc {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 0.8rem;
}

/* Settings Sections */
.settings-section-padded {
    padding: 16px;
}

.settings-section-header {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.settings-section-desc {
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.email-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#notify-email {
    flex: 1;
}

.btn-verify-email {
    display: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#email-verified-badge {
    display: none;
    color: #10b981;
    font-size: 1.2rem;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#email-verification-group {
    display: none;
    gap: 8px;
    align-items: center;
}

#verification-code {
    width: 80px;
    text-align: center;
    letter-spacing: 2px;
}

.btn-confirm-code {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-cancel-code {
    padding: 6px;
    font-size: 0.8rem;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
}

.telegram-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

/* Sync Section */
.sync-section-wrapper {
    margin-top: 12px;
    padding: 14px;
}

.sync-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.sync-privacy {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 16px;
    text-align: center;
}

/* Testing Section */
.testing-section-wrapper {
    margin-top: 12px;
}

.testing-desc {
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.testing-buttons-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-test-notify {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.85rem;
}

#notify-status {
    margin-top: 10px;
    padding: 10px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    font-size: 0.8rem;
    display: none;
}

/* Add Subscription Modal */
.sub-name-input-wrapper {
    position: relative;
}

#sub-name {
    padding-right: 48px;
}

.suggestions-dropdown {
    display: none;
}

#modal-sub-icon-preview {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.note-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.note-label-row label {
    margin-bottom: 0;
}

.note-char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Notification Settings Panel in Modal */
.notification-settings-panel {
    margin-top: 16px;
    margin-bottom: 24px;
}

.notification-settings-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.ns-chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
}

#sub-reminder-row {
    display: none;
}

.custom-days-row-nomargin {
    margin: 0;
}

.form-group-spaced {
    margin-bottom: 16px;
}

/* Budget Modal */
.modal-content-xs {
    max-width: 420px;
}

.modal-content-sm {
    max-width: 480px;
}

.modal-content-delete {
    max-width: 400px;
    text-align: center;
}

.modal-content-tag {
    max-width: 350px;
}

.budget-header-wrapper {
    text-align: center;
    margin-bottom: 24px;
}

.budget-icon-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.8rem;
}

.budget-title {
    margin: 0 0 8px;
}

.budget-desc {
    color: var(--text-secondary);
    margin: 0;
}

.budget-hint-wrapper {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 12px 0 0;
    text-align: center;
}

.modal-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-modal-cancel {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    margin: 0;
    justify-content: center;
}

.btn-modal-save {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    margin: 0;
}

.modal-actions-center {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

/* Cancel Modal */
.cancel-icon-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.8rem;
}

.cancel-service-name {
    color: var(--accent);
    margin: 0;
    font-weight: 600;
}

.cancel-direct-link {
    display: none;
}

.cancel-email-section {
    display: none;
    margin-top: 16px;
}

.cancel-email-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.cancel-email-textarea {
    width: 100%;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    resize: none;
}

.btn-copy-email {
    margin-top: 8px;
    width: 100%;
}

.btn-got-it {
    margin-top: 24px;
    width: 100%;
}

/* Delete Modal */
.delete-icon-circle {
    width: 60px;
    height: 60px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #ef4444;
    font-size: 2rem;
}

.delete-title {
    margin-bottom: 8px;
}

.delete-message {
    color: var(--text-secondary);
    margin: 0;
}

.delete-sub-name-display {
    color: white;
    font-weight: 600;
    margin-top: 12px;
    font-size: 1.1rem;
}

.btn-delete-confirm {
    flex: 1;
    background: #ef4444;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content-delete .btn-secondary {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-tag-confirm {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-tag-msg {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Icon Picker */
.picker-header span {
    font-weight: 600;
    font-size: 1rem;
}

.picker-close-btn {
    width: 28px;
    height: 28px;
}

.picker-text-input {
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.font-chip.font-inter {
    font-family: 'Inter', sans-serif;
}

.font-chip.font-playfair {
    font-family: 'Playfair Display', serif;
}

.font-chip.font-roboto {
    font-family: 'Roboto Mono', monospace;
}

.font-chip.font-dancing {
    font-family: 'Dancing Script', cursive;
}

/* New Utilities for Linter Resolution */
.hidden {
    display: none !important;
}

.w-full-h-full-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mt-12 {
    margin-top: 12px;
}

.mt-32 {
    margin-top: 32px;
}


.mb-20 {
    margin-bottom: 20px;
}

.mb-24 {
    margin-bottom: 24px;
}

.mb-40 {
    margin-bottom: 40px;
}

.p-lock-btn {
    padding: 8px 10px;
}

.text-amber {
    color: #f59e0b;
}

.text-sec-mb-24 {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.opacity-1 {
    opacity: 1 !important;
}

/* Specific Components */
.budget-container {
    display: none;
}

.budget-container.active {
    display: block;
}

.budget-progress-fill.w-0 {
    width: 0;
}

.market-ticker-wrapper {
    display: none;
}

/* Sync Calendar Panel with Sidebar Gray */
.calendar-day-panel {
    background: #111827 !important;
    /* Forces solid dark gray matching sidebar */
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

#calendar-day-panel .sub-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.calendar-day-panel-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
}

/* Elongated Glow for ALL Icons (Logos, Symbols, Apple, etc.) */
.calendar-day-sub-item .sub-icon-outer,
.calendar-day-sub-item .sub-icon-outer>div {
    box-shadow: 0 0 15px -2px var(--accent), 0 0 35px -5px var(--accent) !important;
    overflow: hidden !important;
    border: none !important;
    /* Clean glow bleed */
}

.calendar-day-sub-item .sub-icon-outer img,
.calendar-day-sub-item .sub-icon-outer i,
.calendar-day-sub-item .sub-icon-outer span,
.calendar-day-sub-item .sub-icon-outer .service-icon-text {
    filter: drop-shadow(0 0 15px var(--accent)) !important;
    overflow: visible !important;
}

.sync-actions {
    display: none;
}

#picker-content-text {
    display: none;
}

.limit-warning {
    display: none;
    margin-top: 12px;
}

.limit-warning.visible {
    display: flex;
}

.service-collapsible-content {
    display: block;
}

/* Default */
.pro-offers-collapse-btn {
    margin-left: 12px;
    background: transparent;
    border: none;
    color: #ff4757;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Final Mobile Header Fix (Forced) */
@media (max-width: 768px) {
    body:not(.light-theme) .mobile-header {
        background: #111827 !important;
        /* Forces solid dark gray matching sidebar */
        background-color: #111827 !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        /* Removed the light bottom line */
        border-bottom: none !important;
    }

    .brand-mobile {
        gap: 2px !important;
        /* Minimal gap between JayLex and BETA */
    }

    .brand-mobile .beta-badge {
        font-size: 0.4rem !important;
        /* Extremely small as requested */
        padding: 1px 3px !important;
        margin-left: 0 !important;
        /* No extra margin */
        margin-right: 0 !important;
        vertical-align: middle;
        position: relative;
        top: -2px;
        /* Adjusted visual alignment for smaller size */
    }

    body:not(.light-theme) .mobile-header::before,
    body:not(.light-theme) .mobile-header::after {
        display: none !important;
        content: none !important;
    }
}

/* Enhanced Close Button Animation */
.close-btn,
.close-day-panel {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.close-btn:hover,
.close-day-panel:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ff4d4d !important;
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4) !important;
}

.close-btn:active,
.close-day-panel:active {
    transform: rotate(180deg) scale(0.9) !important;
}

/* --- LIGHT THEME CONTRAST PATCHES --- */

/* App-wide Price & Date fixes */
body.light-theme .next-date-label,
body.light-theme .next-date-text,
body.light-theme .sub-price,
body.light-theme .sub-price div,
body.light-theme .sub-price small,
body.light-theme .calendar-day-sub-item .sub-price-block div:first-child {
    color: #0f172a !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

body.light-theme .next-date-label,
body.light-theme .next-date-text,
body.light-theme .sub-details p,
body.light-theme .sub-details div,
body.light-theme .sub-details span:not(.badge) {
    color: #475569 !important;
    opacity: 1 !important;
}

/* Calendar Day Panel Fixes */
body.light-theme .calendar-day-sub-item .sub-details h4 {
    color: #0f172a !important;
}

body.light-theme .calendar-day-sub-item .expand-chevron {
    color: #0f172a !important;
    opacity: 1 !important;
}

body.light-theme .calendar-day-sub-item .calendar-day-sub-expanded .sub-actions-group button,
body.light-theme .calendar-day-sub-item .calendar-day-sub-expanded .sub-actions-group .neon-action-btn,
body.light-theme .calendar-day-sub-item .calendar-day-sub-expanded .sub-actions-group .bell-indicator {
    background: rgba(15, 23, 42, 0.05) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}

/* Analytics Cards Fixes */
body.light-theme .analytics-card h4 {
    color: #0f172a !important;
}

body.light-theme .analytics-card .sub-price {
    color: #0f172a !important;
}

/* Custom Language Dropdown */
.custom-lang-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.custom-lang-dropdown .lang-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.custom-lang-dropdown:hover .lang-dropdown-toggle,
.custom-lang-dropdown.open .lang-dropdown-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent, #8b5cf6);
}

.custom-lang-dropdown .lang-dropdown-toggle i {
    font-size: 1.1rem;
    color: var(--text-muted, #9ca3af);
}

.custom-lang-dropdown .lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e1e2d; /* Solid opaque color */
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Prevent clicks when hidden */
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 9999;
}

/* Invisible bridge to keep hover active across the 8px gap */
.custom-lang-dropdown .lang-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
}


body.light-theme .custom-lang-dropdown .lang-dropdown-menu {
    background: #ffffff; /* Solid opaque color */
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Sidebar Specific Overrides */
.sidebar .custom-lang-dropdown {
    margin: 0 0 16px 0;
    align-self: flex-start; /* Prevents button from stretching full width */
}

body.light-theme .custom-lang-dropdown .lang-dropdown-toggle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #111827;
}

body.light-theme .custom-lang-dropdown:hover .lang-dropdown-toggle,
body.light-theme .custom-lang-dropdown.open .lang-dropdown-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--accent, #6366f1);
}

.custom-lang-dropdown:hover .lang-dropdown-menu,
.custom-lang-dropdown.open .lang-dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto; /* Re-enable clicks */
    transform: translateY(0);
}

.custom-lang-dropdown .lang-dropdown-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.light-theme .custom-lang-dropdown .lang-dropdown-menu button {
    color: #4b5563;
}

.custom-lang-dropdown .lang-dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #ffffff);
}

body.light-theme .custom-lang-dropdown .lang-dropdown-menu button:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #111827;
}

.custom-lang-dropdown .lang-dropdown-menu button.active {
    background: var(--accent, #8b5cf6);
    color: #ffffff;
}

body.light-theme .custom-lang-dropdown .lang-dropdown-menu button.active {
    background: var(--accent, #6366f1);
    color: #ffffff;
}

/* Validation Feedback */
input.error,
select.error,
textarea.error {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown),
select:invalid:not(:placeholder-shown) {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
}

/* Overview Accordion Header Styling (Harmonious) */
.dashboard-control-header.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 8px 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
    margin-bottom: 12px;
    opacity: 0.85;
}

.dashboard-control-header.accordion-header:hover {
    opacity: 1;
}

.dashboard-control-header.accordion-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.dashboard-control-header.accordion-header h3 i {
    color: var(--text-muted);
    font-size: 1.3rem;
    transition: color 0.3s ease;
}

.dashboard-control-header.accordion-header:hover h3 i {
    color: var(--accent);
}

.dashboard-control-header.accordion-header .collapse-icon {
    font-size: 1.4rem;
    color: var(--text-muted);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.dashboard-control-header.accordion-header:hover .collapse-icon {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(1px);
}

/* Light Theme Overrides */
body.light-theme .dashboard-control-header.accordion-header .collapse-icon {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .dashboard-control-header.accordion-header:hover .collapse-icon {
    background: rgba(0, 0, 0, 0.1);
}

/* VIP Theme Overrides */
body.theme-vip .dashboard-control-header.accordion-header:hover h3 i,
body.theme-vip .dashboard-control-header.accordion-header:hover .collapse-icon {
    color: rgba(255, 215, 0, 1);
}

/* ═══════════════════════════════════════════════════════
   Collapsible Sidebar — Desktop Only
   ═══════════════════════════════════════════════════════ */

/* Collapse Toggle Button */
.collapse-sidebar-btn {
    position: absolute;
    top: 18px;
    right: 12px;
    width: 32px;
    height: 32px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-muted, #71717a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.25s ease;
    padding: 0;
}

.collapse-sidebar-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: var(--accent, #8b5cf6);
    color: var(--accent, #8b5cf6);
    transform: scale(1.08);
}

body.light-theme .collapse-sidebar-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #94a3b8;
}

body.light-theme .collapse-sidebar-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent, #6366f1);
    color: var(--accent, #6366f1);
}

/* ── Collapsed State ─────────────────────────────── */

/* Sidebar base transition */
.sidebar {
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.main-content {
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Collapsed sidebar: narrow icon-only view */
.sidebar.collapsed {
    width: 72px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    overflow: visible;
}

/* Shift main content to match collapsed width */
.sidebar.collapsed ~ .main-content {
    margin-left: 72px !important;
}

/* Rotate the toggle icon */
.sidebar.collapsed .collapse-sidebar-btn {
    right: 50%;
    transform: translateX(50%) rotate(180deg);
    top: 14px;
}

.sidebar.collapsed .collapse-sidebar-btn:hover {
    transform: translateX(50%) rotate(180deg) scale(1.08);
}

/* ── Hide text elements in collapsed state ──────── */
.sidebar.collapsed .brand-text-gradient,
.sidebar.collapsed .beta-badge,
.sidebar.collapsed .sidebar-actions-row,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn,
.sidebar.collapsed .sidebar-legal-links {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s ease, width 0.2s ease;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Brand: icon-only ────────────────────────────── */
.sidebar.collapsed .brand {
    justify-content: center;
    padding: 12px 0 !important;
    margin-top: 32px;
}

.sidebar.collapsed .brand .logo-icon {
    margin: 0;
}

/* ── Nav items: icon-only, centered ──────────────── */
.sidebar.collapsed .sidebar-nav {
    padding: 0 !important;
}

.sidebar.collapsed .nav-item {
    justify-content: center !important;
    padding: 12px 0 !important;
    border-radius: 12px !important;
    margin: 2px 4px;
    min-height: 44px;
    position: relative;
}

/* Transform the existing span into a floating tooltip */
.sidebar.collapsed .nav-item span {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e1e2d;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: auto !important;
    margin: 0 !important;
}

body.light-theme .sidebar.collapsed .nav-item span {
    background: #fff;
    color: #334155;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sidebar.collapsed .nav-item:hover span {
    opacity: 1;
    visibility: visible;
}

/* Nav item icon: centered and full-width */
.sidebar.collapsed .nav-item i {
    margin: 0 !important;
    font-size: 1.3rem;
}

/* ── Footer: avatar only ─────────────────────────── */
.sidebar.collapsed .sidebar-footer {
    padding: 12px 4px !important;
}

.sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center;
    gap: 0;
    padding: 8px 4px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.sidebar.collapsed .user-info-label,
.sidebar.collapsed .account-settings-icon {
    display: none;
}

.sidebar.collapsed .sidebar-footer .user-avatar {
    margin: 0;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
}

/* ── Hide on mobile (mobile uses slide-out) ──────── */
@media (max-width: 768px) {
    .collapse-sidebar-btn {
        display: none !important;
    }

    /* Never apply collapsed state on mobile */
    .sidebar.collapsed {
        width: auto !important;
        padding-left: initial !important;
        padding-right: initial !important;
    }

    .sidebar.collapsed .brand-text-gradient,
    .sidebar.collapsed .beta-badge,
    .sidebar.collapsed .sidebar-actions-row,
    .sidebar.collapsed .nav-item span,
    .sidebar.collapsed .user-details,
    .sidebar.collapsed .logout-btn,
    .sidebar.collapsed .sidebar-legal-links {
        opacity: 1;
        width: auto;
        pointer-events: auto;
    }

    .sidebar.collapsed .nav-item {
        justify-content: flex-start !important;
        padding: initial !important;
    }

    .sidebar.collapsed .nav-item::after {
        display: none;
    }
}

/* ============================================
   PRICE INSIGHTS — Catalog Plans in Card
   ============================================ */

/* Sibling of .sub-item, inside .sub-wrapper to match card width */
.sub-wrapper {
    align-self: start;
    width: 100%;
    height: -moz-fit-content;
    height: fit-content;
}

/* Sibling of .sub-item, inside .sub-wrapper to match card width */
.sub-wrapper > .sub-item {
    position: relative;
    z-index: 5; /* Card must sit over the insights banner */
    transition: border-radius 0.2s ease, max-height 0.4s ease;
}

/* Flatten card corners seamlessly when insights are attached */
.sub-wrapper:has(> .catalog-insights) > .sub-item {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: 0 !important;
}

.catalog-insights {
    position: relative;
    z-index: 2; 
    margin: 0 0 8px 0; /* completely flush, zero overlap */
    padding: 0;
    border-radius: 0 0 16px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    overflow: hidden;
    pointer-events: auto;
    display: block;
    width: 100%;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

body.light-theme .catalog-insights {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

/* ---- Header (always visible, clickable toggle) ---- */
.insight-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px; /* normal padding for flush layout */
    gap: 8px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.2s ease;
}

.insight-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.light-theme .insight-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.insight-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    min-width: 0;
    flex-wrap: wrap;
}

.insight-header-left i {
    font-size: 0.9rem;
    color: var(--accent);
}

.insight-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.insight-updated {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Mini savings badge in collapsed header */
.insight-save-mini {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
    white-space: nowrap;
}

.insight-save-mini i {
    font-size: 0.6rem;
    color: #34d399;
}

body.light-theme .insight-save-mini {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

body.light-theme .insight-save-mini i {
    color: #059669;
}

/* Toggle chevron */
.insight-toggle-chevron {
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.catalog-insights.insights-open .insight-toggle-chevron {
    transform: rotate(180deg);
}

/* Hide savings badge when open */
.catalog-insights.insights-open .insight-save-mini {
    display: none;
}

/* ---- Body (collapsible) ---- */
.insight-body {
    position: relative;
    width: 100%;
    background: #111422;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    z-index: 50;
    pointer-events: none;
    
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
}

body.light-theme .insight-body {
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.catalog-insights.insights-open .insight-body {
    max-height: 600px;
    opacity: 1;
    pointer-events: auto;
}

/* Also add bottom border to header when body is shown */
.catalog-insights.insights-open .insight-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.light-theme .catalog-insights.insights-open .insight-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* ---- Plans List ---- */
.insight-plans-list {
    display: flex;
    flex-direction: column;
}

/* Single Plan Row */
.insight-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 12px;
}

.insight-plan-row:last-child {
    border-bottom: none;
}

.insight-plan-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

body.light-theme .insight-plan-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Current plan has a subtle left border accent */
.insight-plan-row.is-current {
    background: rgba(139, 92, 246, 0.04);
    border-left: 3px solid var(--accent);
    padding-left: 11px;
}

body.light-theme .insight-plan-row.is-current {
    background: rgba(139, 92, 246, 0.06);
}

/* Cheaper plan glows slightly green */
.insight-plan-row.is-cheaper:hover {
    background: rgba(16, 185, 129, 0.06);
}

/* Plan Info (left side) */
.insight-plan-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.insight-plan-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insight-plan-price {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.insight-plan-price small {
    font-weight: 400;
    opacity: 0.7;
}

/* Offer text */
.insight-offer-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Plan Action (right side) */
.insight-plan-action {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.insight-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.insight-plan-row:hover .insight-arrow {
    transform: translateX(3px);
    color: var(--accent);
}

/* Badges */
.insight-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.insight-badge.current {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

body.light-theme .insight-badge.current {
    background: rgba(139, 92, 246, 0.08);
    color: #7c3aed;
}

.insight-badge.save {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

body.light-theme .insight-badge.save {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.insight-badge.promo {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

body.light-theme .insight-badge.promo {
    background: rgba(251, 191, 36, 0.08);
    color: #d97706;
}

.insight-badge i {
    font-size: 0.7rem;
}

/* Footer disclaimer */
.insight-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.01);
}

body.light-theme .insight-footer {
    border-top-color: rgba(0, 0, 0, 0.04);
    background: rgba(0, 0, 0, 0.01);
}

.insight-footer i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
    .catalog-insights {
        display: block !important;
        margin: 0 0 6px 0; /* completely flush on mobile */
        border-radius: 0 0 14px 14px;
        height: auto !important;
        min-height: 38px !important;
        overflow: hidden !important;
    }
    
    .insight-header {
        padding: 10px 12px;
        min-height: 38px;
    }
    
    .insight-header-left {
        font-size: 0.72rem;
    }
    
    .insight-updated {
        display: none; /* hide date on mobile to save space */
    }
    
    .catalog-insights.insights-open {
        overflow: visible !important;
        z-index: 50 !important;
    }
    
    .catalog-insights.insights-open .insight-body {
        max-height: 800px; /* Mobile allows slightly taller dropdown */
    }
    
    .insight-plan-row {
        padding: 9px 12px;
        gap: 8px;
    }
    
    .insight-plan-name {
        font-size: 0.8rem;
    }
    
    .insight-plan-price {
        font-size: 0.75rem;
    }
    
    .insight-badge {
        font-size: 0.62rem;
        padding: 2px 6px;
    }
    
    .insight-footer {
        padding: 7px 12px;
        font-size: 0.6rem;
    }
    
    .insight-offer-text {
        max-width: 160px;
        font-size: 0.65rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
}

/* ============================================
   INSIGHT MODAL (Native Overlay)
   ============================================ */

.insight-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: insightFadeIn 0.2s ease;
}

@keyframes insightFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes insightSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.insight-modal-popup {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    max-width: 440px;
    width: 100%;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: insightSlideUp 0.25s ease;
}

body.light-theme .insight-modal-popup {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.insight-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

body.light-theme .insight-modal-title {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.insight-modal-title i:first-child {
    font-size: 1.2rem;
    color: var(--accent, #8b5cf6);
}

.insight-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.insight-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

body.light-theme .insight-modal-close:hover {
    background: rgba(0, 0, 0, 0.04);
}

.insight-modal-body {
    padding: 20px;
    text-align: left;
}

/* Warning banner */
.insight-modal-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.insight-modal-warning i {
    color: #fbbf24;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Comparison block (Old → New) */
.insight-modal-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.insight-modal-plan {
    flex: 1;
    text-align: center;
    padding: 14px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

body.light-theme .insight-modal-plan {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

.insight-modal-plan .plan-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.insight-modal-plan .plan-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.insight-modal-plan .plan-value small {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.6;
}

.insight-modal-plan.old {
    opacity: 0.6;
}

.insight-modal-plan.new {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.06);
}

body.light-theme .insight-modal-plan.new {
    background: rgba(16, 185, 129, 0.05);
}

.insight-modal-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Steps */
.insight-modal-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}

.insight-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.insight-step .step-num {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Modal buttons */
.insight-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 20px 20px;
}

.insight-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    width: 100%;
}

.insight-modal-btn.primary {
    background: linear-gradient(135deg, var(--accent, #8b5cf6), #a855f7);
    color: #fff;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.insight-modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.insight-modal-btn.outline {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .insight-modal-btn.outline {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #374151;
}

.insight-modal-btn.outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.insight-modal-btn.cancel {
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
}

.insight-modal-btn.cancel:hover {
    color: var(--text-secondary);
}

/* ---- Modal Mobile Responsive ---- */
@media (max-width: 768px) {
    .insight-modal-popup {
        max-width: none;
        border-radius: 16px;
    }
    
    .insight-modal-body {
        padding: 16px;
    }
    
    .insight-modal-buttons {
        padding: 0 16px 16px;
    }
    
    .insight-modal-comparison {
        gap: 8px;
    }

    .insight-modal-plan {
        padding: 10px 8px;
    }

    .insight-modal-plan .plan-value {
        font-size: 1rem;
    }
}

/* ========================================
   AI SCAN MODAL
   ======================================== */

.modal-content-ai-scan {
    max-width: 560px;
    padding-bottom: 24px;
}

.ai-scan-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: -8px 0 20px;
    line-height: 1.5;
}

/* AI Scan Button */
.ai-scan-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.12)) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    color: #c084fc !important;
    transition: all 0.3s ease !important;
}

.ai-scan-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.2)) !important;
    border-color: rgba(139, 92, 246, 0.5) !important;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2) !important;
    transform: translateY(-1px);
}

/* Dropzone */
.ai-scan-dropzone {
    position: relative;
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(139, 92, 246, 0.03);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-scan-dropzone:hover,
.ai-scan-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.1) inset;
}

.ai-scan-dropzone.drag-over {
    transform: scale(1.01);
}

.ai-scan-dropzone.has-file {
    border-style: solid;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
    padding: 16px;
}

.ai-scan-icon-pulse {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: ai-pulse 2s ease-in-out infinite;
}

.ai-scan-icon-pulse i {
    font-size: 28px;
    color: var(--accent);
}

@keyframes ai-pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; }
}

.ai-scan-drop-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.ai-scan-formats {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Preview */
.ai-scan-preview {
    position: relative;
    width: 100%;
    max-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-scan-preview img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 12px;
    object-fit: contain;
}

.ai-scan-preview-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px;
}

.ai-scan-preview-pdf i {
    font-size: 48px;
    color: #ef4444;
}

.ai-scan-preview-pdf span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 300px;
    text-align: center;
}

.ai-scan-remove-file {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    z-index: 5;
}

.ai-scan-remove-file:hover {
    background: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}

/* Analyze Button */
.ai-scan-analyze-btn {
    width: 100%;
    padding: 14px 24px;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--accent), #ec4899);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.ai-scan-analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.ai-scan-analyze-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-scan-analyze-btn i {
    font-size: 1.2rem;
}

/* Loading */
.ai-scan-loading {
    text-align: center;
    padding: 40px 20px;
}

.ai-scan-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(139, 92, 246, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-scan-loading p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.ai-scan-loading-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Results */
.ai-scan-results {
    margin-top: 20px;
}

.ai-scan-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ai-scan-results-header h3 {
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.ai-scan-results-header h3 i {
    color: var(--accent);
}

.ai-scan-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.ai-scan-select-all input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* Items List */
.ai-scan-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.ai-scan-items::-webkit-scrollbar {
    width: 4px;
}

.ai-scan-items::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

.ai-scan-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.ai-scan-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.2);
}

.ai-scan-item.unchecked {
    opacity: 0.4;
}

.ai-scan-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ai-scan-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.ai-scan-item-info {
    flex: 1;
    min-width: 0;
}

.ai-scan-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-scan-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ai-scan-item-price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-scan-item-cycle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Import Button */
.ai-scan-import-btn {
    width: 100%;
    padding: 14px 24px;
    margin-top: 16px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.ai-scan-import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.ai-scan-import-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Empty & Error States */
.ai-scan-empty,
.ai-scan-error {
    text-align: center;
    padding: 30px 20px;
    margin-top: 16px;
}

.ai-scan-empty i,
.ai-scan-error i {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.ai-scan-error i {
    color: #ef4444;
}

.ai-scan-empty p,
.ai-scan-error p {
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.ai-scan-retry-btn {
    padding: 10px 20px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--accent);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ai-scan-retry-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

/* Light Theme */
body.light-theme .ai-scan-dropzone {
    border-color: rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.02);
}

body.light-theme .ai-scan-dropzone:hover,
body.light-theme .ai-scan-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
}

body.light-theme .ai-scan-dropzone.has-file {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.03);
}

body.light-theme .ai-scan-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .ai-scan-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
}

body.light-theme .ai-scan-btn {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(236, 72, 153, 0.06)) !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
    color: #6366f1 !important;
}

/* Mobile */
@media (max-width: 768px) {
    .modal-content-ai-scan {
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .ai-scan-dropzone {
        min-height: 140px;
        padding: 28px 16px;
    }

    .ai-scan-icon-pulse {
        width: 52px;
        height: 52px;
    }

    .ai-scan-icon-pulse i {
        font-size: 22px;
    }

    .ai-scan-items {
        max-height: 250px;
    }

    .ai-scan-item {
        padding: 10px 12px;
    }

    .ai-scan-item-icon {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .ai-scan-btn span {
        display: none;
    }

    .ai-scan-btn {
        padding: 8px 10px !important;
    }
}

/* ── Premium Account Override (User Request) ──────── */
.user-info {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    padding: 10px 14px !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    position: relative !important;
}

.user-info.premium-frame {
    margin-top: 10px !important;
    border-color: rgba(139, 92, 246, 0.4) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.05) !important;
    background: linear-gradient(145deg, var(--bg-card), rgba(139, 92, 246, 0.03)) !important;
}

.user-info-label {
    position: absolute !important;
    top: -9px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: var(--bg-primary) !important;
    padding: 0 8px !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    color: #fbbf24 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    transition: color 0.3s ease !important;
}

body.light-theme .user-info-label {
    background: #ffffff !important;
    color: #d97706 !important;
}

.account-settings-icon {
    margin-left: auto !important;
    color: var(--text-muted) !important;
    font-size: 1.1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.3s ease, color 0.3s ease !important;
}

.user-info:hover {
    background: rgba(139, 92, 246, 0.08) !important;
    border-color: var(--accent) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.user-info.premium-frame:hover {
    border-color: #fbbf24 !important;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.user-info.premium-frame:hover .user-info-label {
    color: #fcd34d !important;
}

body.light-theme .user-info.premium-frame:hover .user-info-label {
    color: #b45309 !important;
}

.user-info:hover .account-settings-icon {
    color: var(--accent) !important;
    transform: rotate(45deg) !important;
}

.user-info:active {
    transform: translateY(0) !important;
}

.sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center !important;
    gap: 0 !important;
    padding: 8px 4px !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.sidebar.collapsed .user-info-label,
.sidebar.collapsed .account-settings-icon {
    display: none !important;
}

/* ═══════════════════════════════════════════ */
/* Bank Import Button                         */
/* ═══════════════════════════════════════════ */
.bank-import-btn {
    background: linear-gradient(135deg, #0d9488, #06b6d4) !important;
    color: #fff !important;
    border: 1px solid rgba(6, 182, 212, 0.3) !important;
    position: relative;
    overflow: hidden;
}

.bank-import-btn:hover {
    background: linear-gradient(135deg, #14b8a6, #22d3ee) !important;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.4) !important;
    transform: translateY(-1px);
}

.bank-import-btn i {
    font-size: 1.1em;
}

/* Subtle shimmer effect */
.bank-import-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: skewX(-20deg);
    animation: bankBtnShimmer 4s ease-in-out infinite;
}

@keyframes bankBtnShimmer {
    0%, 100% { left: -75%; }
    50% { left: 150%; }
}

/* ═══════════════════════════════════════════ */
/* Bank Connect Modal                         */
/* ═══════════════════════════════════════════ */
.modal-content-bank-connect {
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
}

.bc-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.88rem;
    margin: 0 0 16px;
    line-height: 1.5;
}

/* Bank Search */
.bc-bank-search {
    position: relative;
    margin-bottom: 12px;
}
.bc-bank-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
}
.bc-bank-search input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.bc-bank-search input:focus {
    border-color: rgba(6, 182, 212, 0.5);
}

/* Bank List */
.bc-bank-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}
.bc-bank-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.bc-bank-card:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    transform: translateY(-1px);
}
.bc-bank-card .bc-bank-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(139,92,246,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #06b6d4;
    flex-shrink: 0;
}
.bc-bank-card .bc-bank-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
}
.bc-bank-card.hidden { display: none; }

/* Separator */
.bc-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: rgba(255,255,255,0.3);
    font-size: 0.8rem;
}
.bc-separator::before, .bc-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

/* CSV Fallback */
.bc-csv-fallback-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.bc-csv-fallback-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}

/* Selected Bank Header */
.bc-selected-bank {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 10px;
    margin-bottom: 16px;
}
.bc-back-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.bc-back-btn:hover { color: #fff; }
.bc-bank-name { font-weight: 600; color: #fff; }
.bc-bank-blz { font-size: 0.8rem; color: rgba(255,255,255,0.4); margin-left: 6px; }

/* Form */
.bc-form { display: flex; flex-direction: column; gap: 14px; }
.bc-field label {
    display: block;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
    font-weight: 500;
}
.bc-field input {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.bc-field input:focus { border-color: rgba(6, 182, 212, 0.5); }
.bc-date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-date-inputs input { flex: 1; }
.bc-date-inputs span { color: rgba(255,255,255,0.3); }

/* Security Note */
.bc-security-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 10px;
    margin: 16px 0;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.45;
}
.bc-security-note i {
    color: #10b981;
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Connect Button */
.bc-connect-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #0d9488, #06b6d4);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}
.bc-connect-btn:hover {
    background: linear-gradient(135deg, #14b8a6, #22d3ee);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
    transform: translateY(-1px);
}

/* Loading */
.bc-loading-animation {
    text-align: center;
    padding: 40px 20px;
}
.bc-loading-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}
.bc-loading-icon > i {
    font-size: 2rem;
    color: #06b6d4;
    z-index: 1;
}
.bc-loading-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(6, 182, 212, 0.15);
    border-top-color: #06b6d4;
    border-radius: 50%;
    animation: bcSpin 1s linear infinite;
}
@keyframes bcSpin { to { transform: rotate(360deg); } }

.bc-loading-text {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 6px;
}
.bc-loading-hint {
    color: rgba(255,255,255,0.4);
    font-size: 0.82rem;
}

/* Results */
.bc-results-header { margin-bottom: 12px; }
.bc-results-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}
.bc-results-stats i { color: #06b6d4; }
.bc-results-header h3 {
    color: #fff;
    font-size: 1rem;
    margin: 0 0 8px;
}
.bc-results-header h3 i { color: #10b981; }
.bc-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
}
.bc-results-items {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.bc-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    transition: background 0.2s;
}
.bc-result-item:hover { background: rgba(255,255,255,0.07); }
.bc-result-item input[type="checkbox"] { flex-shrink: 0; }
.bc-result-info { flex: 1; min-width: 0; }
.bc-result-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.92rem;
}
.bc-result-detail {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}
.bc-result-price {
    font-weight: 700;
    color: #06b6d4;
    font-size: 1rem;
    white-space: nowrap;
}
.bc-result-cycle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

/* Import Button */
.bc-import-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}
.bc-import-btn:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}
.bc-import-count {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* Error */
.bc-error {
    text-align: center;
    padding: 30px 20px;
}
.bc-error > i {
    font-size: 2.5rem;
    color: #ef4444;
    margin-bottom: 12px;
    display: block;
}
.bc-error p {
    color: rgba(255,255,255,0.7);
    margin: 0 0 16px;
}
.bc-retry-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.bc-retry-btn:hover { background: rgba(255,255,255,0.12); }

/* Bank CSV Export Guide */
.bc-guide {
    margin-bottom: 16px;
}
.bc-guide-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bc-guide-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.bc-guide-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #06b6d4);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bc-guide-text {
    flex: 1;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.5;
}
.bc-guide-text strong {
    color: #fff;
}
.bc-guide-text code {
    background: rgba(6,182,212,0.15);
    color: #22d3ee;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}
.bc-upload-csv-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    margin-bottom: 12px;
}
.bc-upload-csv-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #c084fc);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}
.bc-guide-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 10px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
}
.bc-guide-hint i {
    color: #f59e0b;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Light theme logo overrides */
body.light-theme .brand .brand-text-gradient {
    display: none !important;
}
body.light-theme .brand .logo-icon {
    width: 96px !important;
    height: 48px !important;
}

/* ============================================================
   PRODUCT FOUNDATIONS — FIND, ARCHIVE, SYNC & SECURITY
   ============================================================ */
.subscription-list-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(190px, auto) auto;
    gap: 10px;
    align-items: center;
    margin: 12px 0 16px;
}

.subscription-search,
.subscription-sort {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: color-mix(in srgb, var(--card-bg) 94%, transparent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.subscription-search {
    padding: 0 10px 0 14px;
}

.subscription-search > i,
.subscription-sort > i {
    color: var(--accent);
    font-size: 1.05rem;
}

.subscription-search input,
.subscription-sort select {
    min-width: 0;
    flex: 1;
    height: 46px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

.subscription-search input::placeholder {
    color: var(--text-muted);
}

.subscription-search-clear {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.subscription-search-clear:hover {
    background: rgba(139, 92, 246, .1);
    color: var(--accent);
}

.subscription-sort {
    padding: 0 12px;
}

.subscription-sort select {
    cursor: pointer;
}

.subscription-archive-toggle {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.subscription-archive-toggle:hover,
.subscription-archive-toggle[aria-expanded="true"] {
    border-color: rgba(139, 92, 246, .45);
    background: rgba(139, 92, 246, .1);
    color: var(--accent);
}

.archive-count {
    min-width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(139, 92, 246, .16);
    font-size: .75rem;
}

.archive-panel {
    margin: 0 0 18px;
    padding: 18px;
    border: 1px solid rgba(139, 92, 246, .28);
    border-radius: 20px;
    background:
        radial-gradient(circle at 0 0, rgba(139, 92, 246, .12), transparent 34%),
        var(--card-bg);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .1);
}

.archive-panel-header,
.archive-item,
.archive-item-actions {
    display: flex;
    align-items: center;
}

.archive-panel-header {
    justify-content: space-between;
    margin-bottom: 14px;
}

.archive-eyebrow {
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.archive-panel h4 {
    margin: 4px 0 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.archive-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 13px;
    background: rgba(127, 127, 127, .1);
    color: var(--text-secondary);
    cursor: pointer;
}

.archive-list {
    display: grid;
    gap: 9px;
}

.archive-item {
    min-height: 64px;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
}

.archive-item-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(139, 92, 246, .12);
    color: var(--accent);
    overflow: hidden;
}

.archive-item-info {
    min-width: 0;
    flex: 1;
}

.archive-item-info strong,
.archive-item-info span {
    display: block;
}

.archive-item-info strong {
    overflow: hidden;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-item-info span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: .76rem;
}

.archive-item-actions {
    gap: 6px;
}

.archive-item-actions button {
    min-width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(127, 127, 127, .08);
    color: var(--text-secondary);
    cursor: pointer;
}

.archive-item-actions .restore {
    color: #10b981;
}

.archive-item-actions .remove {
    color: #ef4444;
}

.empty-state.product-empty-state {
    min-height: 250px;
    padding: 28px 18px;
    border: 1px dashed rgba(139, 92, 246, .32);
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 0, rgba(139, 92, 246, .14), transparent 46%),
        var(--card-bg);
}

.product-empty-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(124, 92, 246, .2), rgba(217, 70, 239, .15));
    color: var(--accent);
    font-size: 1.8rem;
}

.product-empty-state h4 {
    margin: 0 0 6px;
    color: var(--text-primary);
    font-size: 1.08rem;
}

.product-empty-state > p {
    max-width: 440px;
    margin: 0 auto;
    color: var(--text-secondary);
}

.empty-state-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    width: 100%;
    max-width: 590px;
    margin: 20px auto 0;
}

.empty-state-actions button {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(127, 127, 127, .07);
    color: var(--text-primary);
    font: inherit;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
}

.empty-state-actions button.primary {
    border-color: transparent;
    background: linear-gradient(135deg, #6d5be7, #a855f7);
    color: white;
    box-shadow: 0 12px 28px rgba(124, 92, 246, .24);
}

.undo-delete-toast {
    position: fixed;
    z-index: 10050;
    right: 20px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    max-width: min(420px, calc(100vw - 28px));
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px 9px 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 17px;
    background: rgba(20, 19, 30, .96);
    color: white;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .32);
    animation: undoToastIn .25s ease both;
}

.undo-delete-toast span {
    min-width: 0;
    flex: 1;
}

.undo-delete-toast button {
    min-width: 74px;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    background: rgba(139, 92, 246, .22);
    color: #c4b5fd;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

@keyframes undoToastIn {
    from { transform: translateY(16px); opacity: 0; }
}

.sync-conflict-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
    margin-top: 15px;
    padding: 14px;
    border: 1px solid rgba(245, 158, 11, .35);
    border-radius: 16px;
    background: rgba(245, 158, 11, .09);
}

.sync-conflict-card[hidden],
.security-delete-form[hidden],
.archive-panel[hidden] {
    display: none !important;
}

.sync-conflict-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    grid-row: 1 / span 2;
    border-radius: 12px;
    background: rgba(245, 158, 11, .16);
    color: #f59e0b;
}

.sync-conflict-copy strong,
.sync-conflict-copy span {
    display: block;
}

.sync-conflict-copy span {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: .78rem;
}

.sync-conflict-actions {
    display: flex;
    gap: 8px;
}

.sync-conflict-actions button {
    min-height: 40px;
    border: 1px solid rgba(245, 158, 11, .28);
    border-radius: 11px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.sync-conflict-actions button.primary {
    border-color: transparent;
    background: #f59e0b;
    color: #18120a;
}

.sync-history-block {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

body.simple-user-mode #ap-sync-content .account-sync-section {
    display: block !important;
}

body.simple-user-mode #ap-sync-content .account-sync-section > :not(.sync-history-block):not(.sync-conflict-card) {
    display: none !important;
}

.sync-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: .86rem;
    font-weight: 750;
}

.sync-history-heading button {
    min-height: 34px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.sync-history-list {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}

.sync-history-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(127, 127, 127, .06);
}

.sync-history-item i {
    color: #10b981;
}

.sync-history-item.error i,
.sync-history-item.conflict i {
    color: #f59e0b;
}

.sync-history-item span {
    color: var(--text-secondary);
    font-size: .77rem;
}

.sync-history-item time,
.sync-history-empty {
    color: var(--text-muted);
    font-size: .7rem;
}

.security-center {
    display: grid;
    gap: 12px;
    padding: 2px 0 8px;
}

.security-summary,
.security-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--card-bg);
}

.security-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background:
        radial-gradient(circle at 0 0, rgba(16, 185, 129, .14), transparent 44%),
        var(--card-bg);
}

.security-summary-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(16, 185, 129, .13);
    color: #10b981;
    font-size: 1.25rem;
}

.security-summary strong,
.security-summary span {
    display: block;
}

.security-summary span {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: .78rem;
}

.security-card {
    padding: 14px;
}

.security-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-primary);
    font-size: .88rem;
    font-weight: 750;
}

.security-card-heading button {
    min-height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: rgba(127, 127, 127, .06);
    color: var(--accent);
    cursor: pointer;
}

.security-sessions-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.security-session {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 13px;
    background: rgba(127, 127, 127, .06);
}

.security-session-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(139, 92, 246, .12);
    color: var(--accent);
}

.security-session strong,
.security-session span {
    display: block;
}

.security-session span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: .7rem;
}

.security-current-badge {
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(16, 185, 129, .12);
    color: #10b981;
    font-size: .66rem;
    font-weight: 800;
}

.security-password-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 12px 0 10px;
}

.security-password-grid label span {
    display: block;
    margin: 0 0 5px 2px;
    color: var(--text-secondary);
    font-size: .72rem;
}

.security-password-grid input,
.security-delete-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    outline: 0;
    background: rgba(127, 127, 127, .06);
    color: var(--text-primary);
}

.security-password-grid input:focus,
.security-delete-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .12);
}

.security-primary-btn {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6d5be7, #a855f7);
    color: white;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.security-data-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.security-data-actions > button {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.security-data-actions > button > i {
    font-size: 1.25rem;
    color: var(--accent);
}

.security-data-actions span,
.security-data-actions strong,
.security-data-actions small {
    display: block;
}

.security-data-actions small {
    margin-top: 2px;
    color: var(--text-muted);
}

.security-data-actions > button.danger > i,
.security-data-actions > button.danger strong {
    color: #ef4444;
}

.security-delete-form {
    display: grid;
    gap: 9px;
    padding: 14px;
    border: 1px solid rgba(239, 68, 68, .3);
    border-radius: 15px;
    background: rgba(239, 68, 68, .07);
}

.security-delete-form p {
    margin: 0;
    color: var(--text-secondary);
    font-size: .78rem;
}

.security-delete-form > div {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.security-delete-form button {
    min-height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
}

.security-delete-form button.danger {
    border-color: transparent;
    background: #ef4444;
    color: white;
}

.service-price-provenance {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0 15px;
    padding: 12px;
    border: 1px solid rgba(16, 185, 129, .24);
    border-radius: 14px;
    background: rgba(16, 185, 129, .07);
}

.service-price-provenance-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(16, 185, 129, .12);
    color: #10b981;
}

.service-price-provenance strong,
.service-price-provenance span {
    display: block;
}

.service-price-provenance strong {
    color: var(--text-primary);
    font-size: .8rem;
}

.service-price-provenance span {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: .72rem;
    line-height: 1.4;
}

.catalog-price-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .68rem;
}

.ap-status-timeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    margin: 11px 0 4px;
    padding-top: 2px;
}

.ap-status-timeline::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border-color);
}

.ap-status-step {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    color: var(--text-muted);
}

.ap-status-step > span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--card-bg);
    font-size: .66rem;
    font-weight: 800;
}

.ap-status-step small {
    font-size: .6rem;
    white-space: nowrap;
}

.ap-status-step.complete {
    color: #10b981;
}

.ap-status-step.complete > span {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.ap-status-step.active {
    color: var(--accent);
}

.ap-status-step.active > span {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, .11);
}

.ap-status-step.error {
    color: #ef4444;
}

.ap-status-step.error > span {
    border-color: #ef4444;
    background: rgba(239, 68, 68, .12);
}

.archive-btn {
    color: #f59e0b !important;
}

@media (max-width: 720px) {
    .subscription-list-toolbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .subscription-search {
        grid-column: 1 / -1;
    }

    .subscription-sort {
        min-width: 0;
    }

    .subscription-archive-toggle {
        padding-inline: 12px;
    }

    .empty-state-actions {
        grid-template-columns: 1fr;
    }

    .security-password-grid,
    .security-data-actions {
        grid-template-columns: 1fr;
    }

    .undo-delete-toast {
        right: 14px;
        bottom: calc(102px + var(--android-nav-bar-height, 0px) + env(safe-area-inset-bottom));
    }

    .sub-list .sub-item.expanded {
        padding-bottom: 76px !important;
    }

    .sub-list .sub-item.expanded .action-buttons {
        position: absolute !important;
        left: 62px !important;
        right: 16px !important;
        bottom: 13px !important;
        width: auto !important;
        margin: 0 !important;
        padding: 9px 0 0 !important;
        border-top: 1px solid rgba(127, 127, 127, .16) !important;
        z-index: 24 !important;
    }

    .sub-list .sub-item.expanded .expanded-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 7px !important;
        margin: 0 !important;
    }

    .sub-list .sub-item.expanded .expanded-actions button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
    }
}

@media (max-width: 380px) {
    .archive-toggle-label {
        display: none;
    }

    .subscription-sort select {
        font-size: .76rem;
    }
}

/* Dashboard cleanup: keep the primary action prominent and secondary tools compact */
.dashboard-tools {
    position: relative;
}

.dashboard-tools-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 650;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.dashboard-tools-btn:hover,
.dashboard-tools-btn.active {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent);
}

.dashboard-tools-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 120;
    width: 224px;
    padding: 7px;
    display: none;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(16, 15, 27, 0.98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(20px);
}

.dashboard-tools-menu.open {
    display: grid;
    gap: 3px;
}

.dashboard-tools-menu > button {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

.dashboard-tools-menu > button:hover,
.dashboard-tools-menu > button:focus-visible {
    outline: none;
    background: rgba(139, 92, 246, 0.14);
    color: #a78bfa;
}

body.light-theme .dashboard-tools-menu {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 18px 44px rgba(45, 36, 80, 0.16);
}

/* Filter arrows appear only when the chips really overflow */
.filter-bar-wrapper > .filter-scroll-left,
.filter-bar-wrapper > .filter-scroll-right {
    display: none !important;
}

.filter-bar-wrapper.has-overflow > .filter-scroll-left,
.filter-bar-wrapper.has-overflow > .filter-scroll-right {
    display: inline-flex !important;
}

.filter-bar-wrapper > .filter-scroll-btn:disabled {
    opacity: 0.28;
    pointer-events: none;
}

/* Google Drive belongs to Account / data backup, not notification channels */
.account-sync-section {
    margin: 0;
    padding: 16px;
    border-radius: 16px;
}

.account-sync-section .sync-header {
    margin-bottom: 14px;
}

.account-sync-section .sync-info h3 {
    margin: 0 0 3px;
    color: var(--text-primary);
    font-size: 0.96rem;
}

.account-sync-section .sync-desc {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.account-sync-section .sync-status-row {
    padding: 12px;
    gap: 10px;
}

.account-sync-section .google-btn {
    min-height: 40px;
}

#bank-connect-modal[hidden] {
    display: none !important;
}

@media (max-width: 768px) {
    .dashboard-tools-label {
        display: none;
    }

    .dashboard-tools-btn {
        padding: 0;
    }

    #view-analytics .analytics-header {
        display: flex !important;
        order: 0;
        margin-bottom: 10px;
        align-items: flex-start;
        text-align: left;
    }

    #view-analytics .analytics-summary-neon {
        display: grid !important;
        order: 1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
        margin-bottom: 10px;
    }

    #view-analytics .neon-stat-card {
        min-width: 0;
        padding: 12px 7px 11px;
        border-radius: 14px;
    }

    #view-analytics .neon-stat-card .stat-icon-wrapper {
        width: 34px;
        height: 34px;
        margin: 0 auto 8px;
        font-size: 1rem;
    }

    #view-analytics .neon-stat-card .stat-label {
        min-height: 28px;
        font-size: 0.58rem;
        line-height: 1.25;
        letter-spacing: 0.04em;
    }

    #view-analytics .neon-stat-card .stat-value-large {
        font-size: clamp(1.05rem, 5vw, 1.45rem);
        line-height: 1.15;
    }

    #view-analytics .analytics-tabs {
        order: 2;
    }

    #view-analytics .analytics-tab-content {
        order: 3;
    }

    .account-sync-section .sync-status-row {
        align-items: stretch;
        flex-direction: column;
    }

    .account-sync-section .google-btn {
        justify-content: center;
    }
}

/* Mobile subscriptions: one predictable, compact control layout.
   This is intentionally last: older mobile styles use incompatible
   positioning rules for the same controls. */
@media (max-width: 640px) {
    html,
    body,
    .app-shell,
    .main-content,
    #view-subscriptions,
    #view-subscriptions .content-wrapper {
        max-width: 100%;
        overflow-x: clip;
    }

    #view-subscriptions .content-wrapper {
        padding-inline: 0;
    }

    #view-subscriptions .dashboard-control-header {
        min-height: 40px;
        margin: 4px 0 6px;
        padding-inline: 2px;
    }

    #view-subscriptions .dashboard {
        gap: 8px;
        margin-bottom: 14px;
    }

    #view-subscriptions .stat-card {
        min-width: 0;
        padding: 14px;
    }

    #view-subscriptions .section-header {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center !important;
        gap: 8px;
        min-height: 42px;
        margin: 6px 0 !important;
    }

    #view-subscriptions .section-header h3 {
        min-width: 0;
        font-size: 0.98rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #view-subscriptions .header-actions {
        display: flex !important;
        flex: 0 0 auto;
        align-items: center;
        gap: 6px;
        margin: 0 !important;
    }

    /* The primary actions stay reachable; rarely-used exports move to the menu. */
    #view-subscriptions .header-actions .export-btn:not(#lock-btn) {
        display: none !important;
    }

    #view-subscriptions #lock-btn,
    #view-subscriptions #add-btn {
        width: 44px !important;
        min-width: 44px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        justify-content: center;
        border-radius: 13px !important;
    }

    #view-subscriptions #lock-btn i,
    #view-subscriptions #add-btn i {
        margin: 0 !important;
        font-size: 1.25rem;
    }

    #view-subscriptions #add-btn span {
        display: none;
    }

    #view-subscriptions .filter-bar-wrapper {
        display: grid !important;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: center;
        gap: 6px !important;
        width: 100% !important;
        height: 44px !important;
        margin: 0 0 6px !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    #view-subscriptions .filter-scroll-btn {
        display: none !important;
    }

    #view-subscriptions .filter-add-btn-fixed {
        position: static !important;
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        margin: 0 !important;
        transform: none !important;
        border-radius: 13px !important;
    }

    #view-subscriptions .filter-bar-wrapper .filter-bar {
        display: flex !important;
        min-width: 0 !important;
        width: 100% !important;
        height: 44px !important;
        margin: 0 !important;
        padding: 4px 2px !important;
        gap: 8px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x proximity;
        overscroll-behavior-inline: contain;
    }

    #view-subscriptions .filter-chip {
        height: 38px !important;
        padding: 0 12px !important;
        scroll-snap-align: start;
    }

    /* Search, sort and archive share one compact row. The native select still
       covers the sort icon, so tapping it opens the normal accessible menu. */
    #view-subscriptions .subscription-list-toolbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 42px 42px !important;
        gap: 6px !important;
        align-items: center;
        width: 100%;
        margin: 6px 0 10px !important;
    }

    #view-subscriptions .subscription-search,
    #view-subscriptions .subscription-sort,
    #view-subscriptions .subscription-archive-toggle {
        min-height: 42px !important;
        height: 42px !important;
        border-radius: 12px !important;
    }

    #view-subscriptions .subscription-search {
        grid-column: auto !important;
        min-width: 0;
        padding: 0 5px 0 11px !important;
        gap: 8px !important;
    }

    #view-subscriptions .subscription-search input {
        height: 40px !important;
        font-size: 0.86rem;
    }

    #view-subscriptions .subscription-search-clear {
        width: 32px;
        min-width: 32px;
        height: 32px;
    }

    #view-subscriptions .subscription-sort {
        position: relative;
        width: 42px !important;
        min-width: 42px !important;
        padding: 0 !important;
        justify-content: center;
        overflow: hidden;
    }

    #view-subscriptions .subscription-sort > i {
        margin: 0 !important;
        font-size: 1.12rem;
        pointer-events: none;
    }

    #view-subscriptions .subscription-sort select {
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        opacity: 0;
        cursor: pointer;
    }

    #view-subscriptions .subscription-archive-toggle {
        position: relative;
        width: 42px !important;
        min-width: 42px !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    #view-subscriptions .archive-toggle-label {
        display: none !important;
    }

    #view-subscriptions .archive-count {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 18px;
        width: auto;
        height: 18px;
        padding: 0 4px;
        border: 2px solid var(--bg-primary);
        font-size: 0.62rem;
    }

    #view-subscriptions .sub-list,
    #view-subscriptions .sub-wrapper,
    #view-subscriptions .sub-item {
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

