/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* Mobile Header Styles */
.mobile-header {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 0 16px 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 0;
    font-weight: 700;
}

.header-left h1 i {
    margin-right: 8px;
    color: #667eea;
}

.user-info-mobile {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 4px;
}

.header-right {
    display: flex;
    gap: 8px;
}

.mobile-add-btn,
.mobile-filter-btn,
.mobile-menu-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.mobile-add-btn {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.mobile-add-btn:hover,
.mobile-filter-btn:hover,
.mobile-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.mobile-add-btn:hover {
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4) !important;
}

.mobile-filter-bar {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.mobile-filter-bar.show {
    display: block;
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.date-input-mobile,
.filter-select-mobile {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    min-height: 44px;
}

.btn-mobile {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    min-height: 44px;
    min-width: 44px;
}

.btn-primary-mobile {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary-mobile {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #2c3e50;
    border: 2px solid #dee2e6;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.mobile-menu-overlay.show {
    display: flex;
    align-items: flex-end;
}

.mobile-menu {
    background: white;
    width: 100%;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.menu-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.close-menu {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 48px;
}

.menu-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.menu-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.menu-item.logout {
    color: #dc3545;
    margin-top: 10px;
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

.menu-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Desktop navigation */
.desktop-menu {
    display: none;
    margin-top: 24px;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.desktop-menu-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(248, 250, 252, 0.85);
    color: #1f2937;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.desktop-menu-item i {
    font-size: 1.1rem;
    color: #4f46e5;
}

.desktop-menu-item span {
    pointer-events: none;
}

.desktop-menu-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.desktop-menu-item.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.25);
}

.desktop-menu-item.active i {
    color: inherit;
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    font-weight: 500;
    min-height: 48px;
}

.nav-item.active {
    color: #667eea;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-size: 0.7rem;
    line-height: 1;
}

/* Floating Action Button */
.floating-action-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 8px 25px rgba(40, 167, 69, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    color: white;
    font-size: 1.5rem;
}

.floating-action-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 
        0 12px 35px rgba(40, 167, 69, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.floating-action-btn:active {
    transform: translateY(-1px) scale(1.05);
}

/* Mobile Summary Cards */
.summary-cards-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 0 8px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.summary-cards-scroll::-webkit-scrollbar {
    display: none;
}

.mobile-card {
    min-width: 140px;
    flex-shrink: 0;
    padding: 16px;
    min-height: 100px;
}

.mobile-card .card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 8px;
}

.mobile-card .card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.mobile-card .card-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.mobile-card .card-amount {
    font-size: 1.4rem;
    text-align: center;
    margin: 8px 0;
}

.mobile-card .card-change {
    font-size: 0.7rem;
    justify-content: center;
    text-align: center;
}

/* Mobile Transaction Cards */
.mobile-transactions {
    display: none;
}

.mobile-transaction-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f3f4;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-transaction-card:active {
    transform: scale(0.98);
}

.transaction-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.transaction-card-left {
    flex: 1;
}

.transaction-card-merchant {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 4px;
}

.transaction-card-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.transaction-card-amount {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: right;
}

.transaction-card-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.transaction-card-category {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e9ecef;
    color: #6c757d;
}

.transaction-card-actions {
    display: flex;
    gap: 8px;
}

.transaction-card-action {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.transaction-card-action.edit {
    background: #e3f2fd;
    color: #1976d2;
}

.transaction-card-action.delete {
    background: #ffebee;
    color: #d32f2f;
}

.transaction-card-action:hover {
    transform: scale(1.1);
}

/* Mobile Filter Modal */
.mobile-filter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.mobile-filter-modal.show {
    display: flex;
    align-items: flex-end;
}

.filter-modal-content {
    background: white;
    width: 100%;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.3s ease-out;
}

.filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.filter-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.close-filter {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.filter-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.filter-actions .btn-mobile {
    flex: 1;
    justify-content: center;
}

/* Mobile Search Bar */
.mobile-search-bar {
    display: none;
    gap: 8px;
    margin-top: 12px;
}

.search-input-mobile {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    min-height: 48px;
}

/* Mobile Upload Area */
.mobile-upload-area {
    display: none;
    border: 2px dashed #667eea;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mobile-upload-area:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.upload-icon-mobile {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 12px;
}

.mobile-upload-area h4 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.mobile-upload-area p {
    color: #6c757d;
    margin: 0;
    font-size: 0.9rem;
}

/* Desktop Header (hidden on mobile) */
.desktop-header {
    display: block;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px 32px;
    margin-bottom: 28px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Tighter icon spacing inside header buttons */
.header .btn i { margin-right: 6px; font-size: 0.85rem; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Make header controls slightly more compact without affecting other buttons */
.header .btn {
    padding: 8px 12px;
    min-height: 36px;
}

.header .filter-select,
.header .date-input {
    padding: 8px 10px;
    height: 36px;
    flex: 0 0 auto;
}

.header #pageAccountFilter {
    min-width: 180px;
}

html, body {
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden; /* prevent stray horizontal scroll */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%; /* avoid accidental overflow */
}

.header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px 32px;
    margin-bottom: 28px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Header Top Section - Title and User Info */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.add-transaction-btn {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    font-weight: 700 !important;
    box-shadow: 
        0 4px 15px rgba(40, 167, 69, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
}

.add-transaction-btn:hover {
    background: linear-gradient(135deg, #20c997, #28a745) !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(40, 167, 69, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset !important;
}

.header h1 {
    color: #1a202c;
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h1 i {
    margin-right: 12px;
    color: #667eea;
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

/* Header Bottom Section - Filter Controls */
.header-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 14px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
    white-space: nowrap;
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.user-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.user-info:hover::before {
    left: 100%;
}

.user-info:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 35px rgba(102, 126, 234, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.user-info span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: rgba(248, 250, 252, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(10px);
    max-width: 100%;
    width: fit-content;
}

.date-input {
    padding: 12px 16px;
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 150px;
    height: 44px;
    font-weight: 500;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.date-input:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 1);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    white-space: nowrap;
    min-height: 44px;
    height: 44px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.btn-secondary {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #2c3e50 !important;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600 !important;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    color: #1a252f !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.btn i {
    font-size: 0.85rem;
}

/* Ensure button text is always visible */
.btn-secondary,
.btn-secondary * {
    color: #2c3e50 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

.btn-secondary:hover,
.btn-secondary:hover * {
    color: #1a252f !important;
}

/* Debug styling to make button text extra visible */
.btn-secondary {
    text-decoration: none !important;
    line-height: 1.4 !important;
}

.btn-secondary:focus,
.btn-secondary:active {
    color: #2c3e50 !important;
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Webhook Configuration Section */
.webhook-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.webhook-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #dee2e6;
}

.webhook-info {
    margin-bottom: 20px;
}

.webhook-field {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.webhook-field label {
    font-weight: 600;
    color: #495057;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.webhook-field label i {
    color: #667eea;
    width: 16px;
}

.code-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.verification-code {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-copy, .btn-copy-small {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-copy:hover, .btn-copy-small:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.webhook-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.webhook-instructions {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #e9ecef;
    margin-top: 20px;
}

.webhook-instructions h4 {
    color: #495057;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h5 {
    color: #495057;
    margin-bottom: 8px;
    font-weight: 600;
}

.step-content p {
    color: #6c757d;
    margin-bottom: 10px;
    line-height: 1.5;
}

.code-block {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-block code {
    color: #495057;
    background: none;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block .btn-copy-small {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Specific styling for This Month button */
.this-month-btn {
    background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
    color: #374151 !important;
    border: 2px solid rgba(226, 232, 240, 0.8) !important;
    font-weight: 700 !important;
    margin-left: 12px !important;
    min-width: 140px !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
}

.this-month-btn span {
    color: #374151 !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.this-month-btn:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9) !important;
    color: #1f2937 !important;
    border-color: rgba(102, 126, 234, 0.3) !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
}

.this-month-btn:hover span {
    color: #1f2937 !important;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card.active {
    box-shadow: 0 12px 40px rgba(0, 123, 255, 0.35);
    border: 2px solid rgba(0, 123, 255, 0.4);
}

.summary-card.mobile-card {
    cursor: pointer;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 600;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.income-icon { background: linear-gradient(135deg, #28a745, #20c997); }
.expense-icon { background: linear-gradient(135deg, #dc3545, #fd7e14); }
.balance-icon { background: linear-gradient(135deg, #007bff, #6610f2); }
.transfer-icon { background: linear-gradient(135deg, #6f42c1, #9c27b0); }
.investment-icon { background: linear-gradient(135deg, #fd7e14, #ff9800); }
.transactions-icon { background: linear-gradient(135deg, #6c757d, #495057); }

.card-amount {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 12px 0;
    line-height: 1.2;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    opacity: 0.8;
}

.positive { color: #28a745; }
.negative { color: #dc3545; }

/* Specific styling for balance card */
#netBalance {
    color: #007bff;
}

#netBalance.negative-balance {
    color: #dc3545;
}

#netBalance.positive-balance {
    color: #28a745;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 25px;
    margin-bottom: 30px;
}

.chart-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
}

.chart-tabs {
    display: flex;
    gap: 10px;
}

.chart-scroll-wrapper {
    position: relative;
    margin-top: 10px;
    padding-bottom: 4px;
    overflow: hidden;
}

.chart-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 16px 8px;
    scroll-snap-type: x mandatory;
    scroll-snap-stop: always;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    scroll-padding: 16px;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}

.chart-scroll:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.7);
    outline-offset: 6px;
}

.chart-scroll::-webkit-scrollbar {
    height: 6px;
}

.chart-scroll::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 999px;
}

.chart-scroll::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.6);
    border-radius: 999px;
}

.trend-chart-card {
    flex: 0 0 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
    border-radius: 16px;
    padding: 18px 18px 12px;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(226, 232, 240, 0.6);
    scroll-snap-align: center;
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.trend-chart-card canvas {
    cursor: pointer;
}

.trend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trend-card-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.trend-card-label i {
    color: #4f46e5;
}

.chart-tab {
    padding: 8px 16px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.chart-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chart-container {
    flex: 1;
    position: relative;
    height: 260px;
    margin-top: 15px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

.category-breakdown {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: 400px;
    overflow-y: auto;
}

/* Analysis Section Specific Styles */
.analysis-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.analysis-chart {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: 400px;
    display: flex;
    flex-direction: column;
}

.analysis-breakdown {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: 400px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f3f4;
}

.category-item:last-child {
    border-bottom: none;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.category-name {
    font-weight: 600;
    color: #2c3e50;
}

.category-amount {
    font-weight: 700;
    color: #6c757d;
}

.payment-reminders-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
    margin-bottom: 30px;
}

.reminders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.reminders-header h2 {
    font-size: 1.4rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.reminders-header h2 i {
    color: #f59e0b;
}

.reminder-count {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.reminders-list {
    list-style: none;
    margin: 0;
    padding: 4px 8px 20px;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.6) transparent;
}

.reminders-list::-webkit-scrollbar {
    height: 6px;
}

.reminders-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

.reminders-list::-webkit-scrollbar-track {
    background: transparent;
}

.reminders-carousel {
    position: relative;
    isolation: isolate;
}

.reminders-track {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
}

.reminders-track::before,
.reminders-track::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    opacity: 0;
    z-index: 1;
}

.reminders-track::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0));
}

.reminders-track::after {
    right: 0;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0));
}

.reminders-track.is-scrollable::before,
.reminders-track.is-scrollable::after {
    opacity: 1;
}

.reminder-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
    color: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.reminder-nav i {
    pointer-events: none;
}

.reminder-nav:hover {
    transform: translateY(-50%) scale(1.05);
}

.reminder-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.reminder-nav:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.reminder-nav[disabled] {
    opacity: 0;
    pointer-events: none;
}

.reminder-nav-prev {
    left: 8px;
}

.reminder-nav-next {
    right: 8px;
}

.reminder-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 16px 18px;
    background: rgba(248, 250, 252, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    flex: 0 0 280px;
    scroll-snap-align: start;
}

.reminder-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.reminder-item.reminder-overdue {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(254, 226, 226, 0.85);
}

.reminder-item.reminder-overdue .reminder-due-date {
    color: #b91c1c;
}

.reminder-item.reminder-overdue .reminder-due-date i {
    color: #dc2626;
}

.reminder-item .reminder-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.reminder-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.reminder-dismiss {
    background: transparent;
    border: none;
    color: #9aa1b2;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.reminder-dismiss i {
    pointer-events: none;
}

.reminder-dismiss:hover {
    background: rgba(255, 77, 79, 0.12);
    color: #ff4d4f;
}

.reminder-item-dismissing {
    opacity: 0.6;
}

.reminder-item .reminder-biller {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.reminder-item .reminder-due-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reminder-item .reminder-amount {
    font-size: 0.95rem;
    color: #374151;
    font-weight: 500;
}

.reminder-item .reminder-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: #6b7280;
}

.reminder-item .reminder-tag {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.reminder-item .reminder-tag.overdue {
    background: rgba(220, 38, 38, 0.15);
    color: #b91c1c;
}

.reminder-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    color: #6b7280;
    padding: 18px;
    border: 1px dashed rgba(156, 163, 175, 0.4);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.8);
    font-weight: 500;
    flex: 1 0 calc(100% - 16px);
    min-height: 160px;
}

.reminder-empty i {
    color: #10b981;
}

.transactions-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
}

.transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-filter-notice {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 14px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #1f2937;
}

.chart-filter-notice.show {
    display: flex;
}

.chart-filter-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    flex: 1;
    color: #1f2937;
}

.chart-filter-text i {
    color: #667eea;
    font-size: 1rem;
}

.chart-filter-clear {
    border: none;
    background: rgba(102, 126, 234, 0.15);
    color: #334155;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.chart-filter-clear:hover {
    background: rgba(102, 126, 234, 0.25);
    color: #1e293b;
}

.chart-filter-clear:focus {
    outline: 3px solid rgba(102, 126, 234, 0.35);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.search-filter {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    min-width: 250px;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    height: 44px;
    min-width: 200px;
    font-weight: 500;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.filter-select:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 1);
}

/* Improve header layout at medium widths */
@media (max-width: 1024px) {
  .desktop-header {
    gap: 16px;
    padding: 20px 24px;
  }
  
  .header-top {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  
  .add-transaction-btn {
    width: 100%;
    max-width: 200px;
  }
  
  .header-bottom {
    width: 100%;
  }
  
  .date-controls { 
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .chart-filter-notice {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-filter-clear {
    width: 100%;
    justify-content: center;
  }
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.transactions-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

.transactions-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.transaction-row:hover {
    background: #f8f9fa;
}

.transaction-merchant {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    overflow-wrap: anywhere;
}

.transaction-details {
    font-size: 0.85rem;
    color: #6c757d;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2; /* standard property for compatibility */
    overflow-wrap: anywhere;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.amount-expense { color: #dc3545; }
.amount-income { color: #28a745; }

.transaction-category {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e9ecef;
    color: #6c757d;
}

.confidence-score {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 3px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover, .page-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.upload-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
}

.upload-area {
    border: 2px dashed #e1e8ed;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .payment-reminders-section {
        padding: 20px;
        margin-top: 20px;
        margin-bottom: 24px;
    }

    .reminders-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .reminder-count {
        align-self: flex-start;
    }

    .reminders-carousel {
        padding: 0 4px;
    }

    .reminders-track {
        border-radius: 16px;
    }

    .reminders-track::before,
    .reminders-track::after {
        display: none;
    }

    .reminder-nav {
        display: none;
    }

    .reminders-list {
        padding: 4px 2px 16px;
        gap: 14px;
        scroll-snap-type: x mandatory;
    }

    .reminder-item {
        flex: 0 0 calc(100% - 36px);
    }

    .reminder-empty {
        flex-basis: calc(100% - 36px);
    }

    .desktop-header {
        padding: 16px 18px;
        gap: 16px;
    }
    
    .header-top {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .add-transaction-btn {
        width: 100%;
        max-width: 100%;
    }
    
    .header-bottom {
        width: 100%;
    }
    
    .date-controls {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding: 16px;
    }
    
    .date-input,
    .filter-select,
    .btn {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    .this-month-btn {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
    
    .search-input {
        min-width: 200px;
    }
}

/* --- Desktop responsiveness --- */
@media (min-width: 769px) {
  /* Hide mobile elements on desktop */
  .mobile-header { display: none !important; }
  .bottom-nav { display: none !important; }
  .mobile-transactions { display: none !important; }
  .mobile-upload-area { display: none !important; }
  .mobile-search-bar { display: none !important; }
  .summary-cards-scroll { display: none !important; }
  
  /* Show desktop elements on desktop */
  .desktop-header { display: block !important; }
  .desktop-menu { display: flex !important; }
  .desktop-table { display: table !important; }
  .desktop-upload { display: block !important; }
  .search-filter { display: flex !important; }
}

/* --- Enhanced mobile responsiveness --- */
@media (max-width: 768px) {
  .container { padding: 14px; }
  .chart-container { height: 240px; }
  #categoryChart, #analysisCategoryChart, .chart-container canvas { max-height: 220px !important; }
  .date-controls { flex-wrap: wrap; gap: 8px; width: 100%; }
  .date-input { flex: 1 1 45%; min-width: 140px; }
  .btn { flex: 1 1 45%; justify-content: center; }
  .chart-scroll { padding: 0 8px 8px; gap: 12px; scroll-padding: 8px; }
  .trend-chart-card { flex: 0 0 100%; }
  .chart-container canvas { max-height: 220px !important; }
  
  /* Show mobile elements on mobile */
  .mobile-header { display: block !important; }
  .bottom-nav { display: flex !important; }
  .mobile-transactions { display: block !important; }
  .mobile-upload-area { display: flex !important; }
  .mobile-search-bar { display: flex !important; }
  .summary-cards-scroll { display: flex !important; }
  .floating-action-btn { display: flex !important; }
  
  /* Hide desktop elements on mobile */
  .desktop-header { display: none !important; }
  .desktop-table { display: none !important; }
  .desktop-upload { display: none !important; }
  .search-filter { display: none !important; }
}

@media (max-width: 600px) {
  /* Summary cards responsive layout */
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .summary-card {
    padding: 16px;
    min-height: 120px;
  }
  
  .card-amount {
    font-size: 1.8rem;
  }
  
  .card-title {
    font-size: 0.9rem;
  }
  
  /* Turn the transactions table into mobile cards without changing HTML */
  .transactions-table thead { display: none; }
  .transactions-table,
  .transactions-table tbody,
  .transactions-table tr,
  .transactions-table td { display: block; width: 100%; }
  .transactions-table { table-layout: fixed; }
  .transactions-table tr { background: #fff; border: 1px solid #eee; border-radius: 12px; margin-bottom: 12px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
  .transactions-table td { position: relative; padding: 8px 10px 8px 100px; border: none; min-height: 44px; word-break: break-word; }
  .transactions-table td::before { content: attr(data-label); position: absolute; left: 12px; top: 10px; width: 90px; font-weight: 600; color: #6c757d; }
  .transactions-table td:last-child { padding-left: 12px; }

  /* Fallback if data-label not provided: map by column index */
  .transactions-table tr td:nth-child(1)::before { content: 'Date'; }
  .transactions-table tr td:nth-child(2)::before { content: 'Merchant'; }
  .transactions-table tr td:nth-child(3)::before { content: 'Category'; }
  .transactions-table tr td:nth-child(4)::before { content: 'Payment'; }
  .transactions-table tr td:nth-child(5)::before { content: 'Amount'; }
  .transactions-table tr td:nth-child(6)::before { content: 'Actions'; }

  .action-buttons { justify-content: flex-start; }

  /* Make controls stack nicely */
  .search-filter, .date-controls { width: 100%; }
  .filter-select, .search-input { flex: 1 1 48%; min-width: 140px; }
  .btn, .this-month-btn { width: 100%; }

  /* Compress sections */
  .upload-section, .webhook-section, .transactions-section, .chart-section, .category-breakdown { padding: 16px; border-radius: 16px; }
  .header { padding: 14px 16px; }

  /* Force containers not to exceed viewport width */
  .container,
  .header,
  .summary-cards,
  .main-content,
  .transactions-section,
  .upload-section,
  .webhook-section,
  .chart-section,
  .category-breakdown { max-width: 100vw; overflow-x: hidden; }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .summary-card {
    padding: 14px;
    min-height: 100px;
  }
  
  .card-amount {
    font-size: 1.6rem;
  }
  
  .chart-container { height: 200px; }
  #spendingChart, #categoryChart, canvas { max-height: 180px !important; }
  .user-info span { max-width: 100px; }
  .card-title { font-size: 0.9rem; }
  .btn { padding: 8px 10px; }
  .filter-select, .search-input { min-width: 120px; }
}

/* Enhanced Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    margin: 0;
    padding: 0;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

.modal-content.delete-modal {
    max-width: 450px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
}

.modal-header {
    padding: 24px 32px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h3 i {
    font-size: 1.4rem;
    opacity: 0.9;
}

.modal-header.edit-header h3 {
    color: #4CAF50;
}

.modal-header.delete-header h3 {
    color: #f44336;
}

.modal-header.add-header h3 {
    color: #28a745;
}

.close {
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* Enhanced Form Styles */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    font-size: 0.9rem;
    opacity: 0.8;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 0 0 4px rgba(76, 175, 80, 0.15),
        0 8px 25px rgba(76, 175, 80, 0.1);
    transform: translateY(-2px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group select option {
    background: #2a2a2a;
    color: #fff;
}

.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary,
.btn-secondary,
.btn-danger {
    position: relative;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 
        0 6px 20px rgba(76, 175, 80, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(76, 175, 80, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 
        0 6px 20px rgba(244, 67, 54, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(244, 67, 54, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

/* Loading State */
.btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Transaction Preview */
.transaction-preview {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05));
    border: 2px solid rgba(244, 67, 54, 0.2);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.transaction-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f44336, #ff5722);
}

.transaction-preview h4 {
    margin: 0 0 16px 0;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.transaction-preview h4 i {
    color: #f44336;
    font-size: 1.2rem;
}

.transaction-preview p {
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.transaction-preview p strong {
    color: #fff;
    min-width: 80px;
}

.warning-text {
    color: #ff9800;
    font-weight: 600;
    text-align: center;
    margin: 24px 0 16px;
    padding: 16px;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.warning-text i {
    font-size: 1.1rem;
}

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-edit,
.btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #1976D2, #2196F3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        align-items: center;
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
        word-break: break-word;
    }
    
    .date-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    
    .date-input {
        min-width: 120px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    .user-info {
        order: -1;
        margin-bottom: 8px;
        font-size: 0.85rem;
        padding: 8px 14px;
        white-space: normal; /* allow wrapping on small screens */
    }
    
    .user-info span {
        max-width: 120px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .summary-card {
        padding: 20px;
        min-height: 120px;
    }
    
    .card-amount {
        font-size: 1.8rem;
        margin: 8px 0;
    }
    
    .card-change {
        font-size: 0.8rem;
    }
    
    /* Modal Responsive */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .summary-card {
        padding: 16px;
        min-height: 100px;
    }
    
    .card-amount {
        font-size: 1.6rem;
    }
    
  .card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Force mobile layout for very small screens */
@media (max-width: 600px) {
  .mobile-header {
    display: block !important;
  }
  
  .desktop-header {
    display: none !important;
  }
  
  .bottom-nav {
    display: flex !important;
  }
  
  .summary-cards {
    display: block !important;
  }
  
  .summary-cards-scroll {
    display: flex !important;
  }
  
  .mobile-transactions {
    display: block !important;
  }
  
  .desktop-table {
    display: none !important;
  }
  
  .mobile-upload-area {
    display: flex !important;
  }
  
  .desktop-upload {
    display: none !important;
  }
  
  .mobile-search-bar {
    display: flex !important;
  }
  
  .search-filter {
    display: none !important;
  }
}

/* Mobile First - Show mobile elements, hide desktop */
@media (max-width: 768px) {
  /* Show mobile elements */
  .mobile-header {
    display: block !important;
  }
  
  .bottom-nav {
    display: flex !important;
  }
  
  .mobile-search-bar {
    display: flex !important;
  }
  
  .mobile-upload-area {
    display: flex !important;
  }
  
  .mobile-transactions {
    display: block !important;
  }
  
  /* Hide desktop elements */
  .desktop-header {
    display: none !important;
  }
  
  .desktop-upload {
    display: none !important;
  }
  
  .desktop-table {
    display: none !important;
  }
  
  .search-filter {
    display: none !important;
  }
  
  /* Force mobile layout for summary cards */
  .summary-cards {
    display: block !important;
  }
  
  .summary-cards-scroll {
    display: flex !important;
  }
  
  /* Hide desktop table, show mobile cards */
  .transactions-table.desktop-table {
    display: none !important;
  }
  
  .mobile-transactions {
    display: block !important;
  }
  
  /* Mobile container adjustments */
  .container {
    padding: 16px !important;
    padding-bottom: 32px !important;
  }
  
  /* Mobile summary cards */
  .summary-cards {
    margin-bottom: 24px !important;
    display: block !important;
  }
  
  .summary-cards-scroll {
    display: flex !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  
  .summary-cards-scroll::-webkit-scrollbar {
    display: none !important;
  }
  
  /* Force mobile card layout */
  .mobile-card {
    min-width: 140px !important;
    flex-shrink: 0 !important;
    padding: 16px !important;
    min-height: 100px !important;
  }
  
  /* Mobile main content */
  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
  }
  
  /* Mobile chart adjustments */
  .chart-section,
  .category-breakdown {
    padding: 16px;
    border-radius: 16px;
    height: auto;
    min-height: 300px;
  }
  
  /* Analysis section mobile adjustments */
  .analysis-content {
    gap: 20px;
  }
  
  .analysis-chart,
  .analysis-breakdown {
    padding: 16px;
    border-radius: 16px;
    height: auto;
    min-height: 300px;
  }
  
  .chart-container {
    height: 250px;
  }
  
  #spendingChart, #categoryChart, canvas {
    max-height: 220px !important;
  }
  
  /* Mobile transactions section */
  .transactions-section {
    padding: 16px;
    border-radius: 16px;
    margin-top: 20px;
  }
  
  .transactions-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  /* Mobile upload section */
  .upload-section {
    padding: 16px;
    border-radius: 16px;
    margin-top: 20px;
  }
  
  /* Mobile webhook section */
  .webhook-section {
    padding: 16px;
    border-radius: 16px;
    margin-top: 20px;
  }
  
  /* Mobile modal adjustments */
  .modal-content {
    width: 95%;
    margin: 5% auto;
    max-height: 85vh;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 12px;
  }
  
  .form-actions button {
    width: 100%;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .container {
    padding: 16px !important;
    padding-bottom: 80px !important;
  }

  .payment-reminders-section {
    padding: 18px !important;
    margin-bottom: 24px !important;
  }

  .reminder-item,
  .reminder-empty {
    padding: 14px 16px !important;
  }
  
  .mobile-header {
    padding: 10px 12px !important;
    margin-bottom: 12px !important;
    display: block !important;
  }
  
  .header-left h1 {
    font-size: 1.1rem !important;
  }
  
  .mobile-card {
    min-width: 120px !important;
    padding: 12px !important;
    min-height: 90px !important;
  }
  
  .mobile-card .card-amount {
    font-size: 1.2rem !important;
  }
  
  .mobile-card .card-title {
    font-size: 0.75rem !important;
  }
  
  .chart-container {
    height: 200px !important;
  }
  
  #spendingChart, #categoryChart, canvas {
    max-height: 180px !important;
  }
  
  .user-info-mobile span {
    max-width: 80px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  .nav-item span {
    font-size: 0.65rem !important;
  }
  
  .nav-item i {
    font-size: 1.1rem !important;
  }
  
  /* Force mobile layout on small screens */
  .desktop-header {
    display: none !important;
  }
  
  .mobile-header {
    display: block !important;
  }
  
  .bottom-nav {
    display: flex !important;
  }
  
  .summary-cards {
    display: block !important;
  }
  
  .summary-cards-scroll {
    display: flex !important;
  }
}

/* Large mobile / small tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .mobile-header {
    display: none;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .desktop-header {
    display: block;
  }
  
  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .mobile-header {
    display: none;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .desktop-header {
    display: block;
  }
  
  .mobile-search-bar {
    display: none;
  }
  
  .mobile-upload-area {
    display: none;
  }
  
  .mobile-transactions {
    display: none;
  }
  
  .desktop-upload {
    display: block;
  }
  
  .desktop-table {
    display: table;
  }
  
  .search-filter {
    display: flex;
  }
}
