/* ============================================
   RESPONSIVE STYLES
   Consolidated from styles.css @media blocks
   + mobile-enhancements.css
   ============================================ */

/* Desktop: Sticky table headers */
@media (min-width: 769px) {
    .table-container {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        position: relative;
    }
    
    .table-container thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-secondary);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .table-container thead th {
        background: var(--bg-secondary);
        backdrop-filter: blur(10px);
    }

    /* Alternating rows */
    .table-container tbody tr:nth-child(even) {
        background: rgba(255, 255, 255, 0.015);
    }

    /* Hover glow */
    .table-container tbody tr:hover {
        background: var(--glass-hover);
        box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.08);
    }
}

/* Desktop: Slide-in panel modals */
@media (min-width: 769px) {
    .modal-content {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: 550px;
        max-width: 90vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 20px 0 0 20px;
        animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    .modal {
        justify-content: flex-end;
        padding: 0;
    }
}

/* Desktop: Stat card parallax hover */
@media (min-width: 769px) {
    .stat-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        will-change: transform;
    }
    
    .stat-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 16px 48px var(--glow-color);
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-tabs { gap: 8px; }
    .nav-tab span { display: none; }
    .nav-tab { padding: 12px 16px; }
}

/* Mobile */
@media (max-width: 768px) {
    /* Prevent zoom on input focus (iOS) */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Improve touch targets */
    button, .btn {
        touch-action: manipulation; /* Prevent double-tap zoom */
    }
    
    /* Prevent overscroll/bounce and side-scroll glitches */
    body {
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }
    
    .main-content {
        overscroll-behavior-y: none;
        overscroll-behavior-x: none;
    }
    
    .table-container {
        overflow-x: scroll !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-x: auto !important;
        touch-action: pan-x pan-y !important;
    }
    
    /* Allow horizontal scroll on tables */
    .table-container table {
        touch-action: pan-x pan-y !important;
    }
    
    /* Prevent text selection on UI elements */
    .btn, .nav-tab, .sub-tab, .badge, .brand-badge {
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* App-like animations and transitions */
    .glass-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .glass-card:active {
        transform: scale(0.98);
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Better button feedback */
    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Swipe indicators */
    .table-container {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    
    .table-container::-webkit-scrollbar {
        display: none;
    }
    
    /* Pull-to-refresh hint */
    .main-content {
        position: relative;
    }
    
    
    /* Card tap effects */
    .stat-card, .analysis-card {
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .stat-card:active, .analysis-card:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
    
    /* Modal slide-up animation */
    .modal.active {
        animation: fadeIn 0.2s ease;
    }
    
    .modal.active .modal-content {
        animation: slideUpMobile 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Hide original add buttons on mobile portrait - use FAB instead */
    .card-header .btn.btn-primary {
        display: none !important;
    }
    
    /* Header — single-line compact */
    .header {
        padding: 8px 12px;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .header-logo h1 {
        font-size: 1.1rem;
    }

    .header-user {
        width: auto;
        justify-content: flex-end;
        gap: 8px;
    }

    /* Hide username text, show only role badge */
    .header-user .user-info .user-name {
        display: none;
    }

    /* Hide theme name text, show only icon */
    #currentThemeName {
        display: none;
    }

    .theme-selector-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
        min-width: auto;
    }

    .user-info {
        font-size: 0.85rem;
    }
    
    /* Navigation */
    .nav-tabs {
        padding: 10px;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
    
    .nav-tab {
        padding: 10px 14px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .nav-tab span {
        display: none;
    }
    
    /* Main content */
    .main-content {
        padding: 8px;
    }

    .glass-card {
        padding: 12px;
        border-radius: 10px;
    }

    .glass-card + .glass-card {
        margin-bottom: 12px;
    }

    .card-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .card-header h2 {
        font-size: 1rem;
        flex: 1;
    }

    /* Non-primary buttons: icon-only on mobile */
    .card-header .btn:not(.btn-primary) {
        width: auto;
        justify-content: center;
    }

    .card-header .btn:not(.btn-primary) span {
        display: none;
    }
    
    /* Code inline */
    code {
        background: var(--bg-tertiary);
        padding: 2px 6px;
        border-radius: 4px;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.85em;
        color: var(--primary);
        border: 1px solid var(--glass-border);
    }
    
    
    /* Sub-tabs */
    .sub-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        margin-bottom: 12px;
        gap: 6px;
    }

    .sub-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* Filters */
    .filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-group {
        min-width: 100%;
        width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 12px 15px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-grid .form-group.full-width {
        grid-column: span 1;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px 15px;
        touch-action: manipulation;
    }
    
    /* Prevent form resubmission on mobile */
    form {
        touch-action: manipulation;
    }
    
    /* Improve modal stability on mobile */
    .modal.active {
        position: fixed;
        overflow: hidden;
    }
    
    .modal-content {
        overscroll-behavior: contain;
    }
    
    /* Tables */
    table {
        min-width: 500px;
        font-size: 0.85rem;
    }
    
    table th, table td {
        padding: 10px 8px;
    }
    
    .action-btns {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-btns .btn {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    /* Stats grid — always 2-col on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stats-grid--enhanced {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 10px;
    }

    .stat-card .stat-icon,
    .stat-card--enhanced .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .stat-card .value,
    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-sparkline {
        display: none;
    }

    .stat-card__header .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Badges */
    .badge, .brand-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    /* Toast notifications */
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    /* Theme dropdown */
    .theme-dropdown {
        width: 280px;
        max-width: 90vw;
        right: 0;
        left: auto;
    }
    
    /* Login */
    .login-box {
        width: 95%;
        padding: 25px 20px;
        margin: 10px;
    }
    
    .login-logo h1 {
        font-size: 1.5rem;
    }
}

/* Mobile: Custom modal */
@media (max-width: 768px) {
    .custom-modal-content {
        width: 95%;
        margin: 20px;
    }

    .custom-modal-header {
        padding: 20px;
    }

    .custom-modal-body {
        padding: 20px;
    }

    .custom-modal-body p {
        font-size: 1rem;
    }

    .custom-modal-footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }

    .custom-modal-footer .btn {
        width: 100%;
        min-width: unset;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .card-header .btn.btn-primary {
        display: flex !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        padding: 10px 20px !important;
        border-radius: 8px !important;
        font-size: 0.9rem !important;
    }
    
    .card-header .btn.btn-primary i {
        margin-left: 8px !important;
        font-size: 0.9rem !important;
    }
    
    .card-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .card-header .btn:not(.btn-primary) {
        width: auto !important;
    }
    
    /* Hide mobile FAB in landscape */
    .mobile-fab {
        display: none !important;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    .header-logo h1 {
        font-size: 1rem;
    }
    
    .nav-tab {
        padding: 8px 10px;
    }
    
    .nav-tab i {
        font-size: 1rem;
    }
    
    table {
        min-width: 400px;
        font-size: 0.8rem;
    }
    
    table th, table td {
        padding: 8px 6px;
    }
    
    .card-header h2 {
        font-size: 1rem;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
}

/* Mobile portrait: FAB button */
@media (max-width: 768px) and (orientation: portrait) {
    .mobile-fab {
        display: flex !important;
    }
}

/* Mobile: Table horizontal scroll */
@media (max-width: 768px) {
    .table-container {
        margin: 0 -10px;
        padding: 0 0 15px 0;
        width: calc(100% + 20px);
        overflow-x: scroll !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container table {
        min-width: 700px;
        width: max-content;
    }
    
    /* Table cells - prevent text wrapping for better scroll */
    .table-container th,
    .table-container td {
        white-space: nowrap;
        padding: 10px 12px;
    }
    
    /* Visible scrollbar on mobile */
    .table-container::-webkit-scrollbar {
        height: 6px;
        display: block !important;
    }
    
    .table-container::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: var(--accent-primary);
        border-radius: 3px;
    }
    
    /* Add padding at bottom to not overlap with FAB */
    .tab-content {
        padding-bottom: 70px;
    }
    
    .table-container {
        position: relative;
    }

    /* Hide scroll hints on mobile landscape */
    .table-container::before,
    .table-container::after {
        display: none !important;
    }
}

/* Mobile portrait: Expandable card tables */
@media (max-width: 576px) and (orientation: portrait) {
    /* Reset landscape table constraints for portrait */
    .table-container {
        overflow-x: visible !important;
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        border: none;
        border-radius: 0;
    }

    /* Card-v2 parent containers — maximize card width */
    .glass-card:has(.mobile-card-v2) {
        padding: 6px 2px !important;
        border-radius: 8px;
        margin-bottom: 6px !important;
        overflow: visible !important;
    }

    .table-container:has(.mobile-card-v2) {
        margin: 0 -2px !important;
        width: calc(100% + 4px) !important;
    }

    .table-container table {
        display: block;
        min-width: 100% !important;
        width: 100% !important;
    }

    .table-container thead {
        display: none;
    }

    .table-container tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 4px 0;
    }

    /* --- Card row --- */
    .table-container tr.mobile-card {
        display: block;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        margin-bottom: 0;
        padding: 14px 16px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
        transition: all 0.2s ease;
        cursor: pointer;
        position: relative;
        border-right: 4px solid var(--glass-border);
        min-height: 48px;
    }

    .table-container tr.mobile-card:active {
        transform: scale(0.985);
        background: var(--glass-hover);
    }

    .table-container tr.mobile-card.status-active {
        border-right-color: var(--accent-primary);
    }
    .table-container tr.mobile-card.status-deposit {
        border-right-color: var(--success);
    }
    .table-container tr.mobile-card.status-withdrawal {
        border-right-color: var(--warning);
    }
    .table-container tr.mobile-card.status-expense {
        border-right-color: var(--danger);
    }

    /* Chevron indicator */
    .table-container tr.mobile-card .card-summary::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
        font-weight: 900;
        font-size: 0.7rem;
        color: var(--text-secondary);
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.2s ease;
        opacity: 0.5;
    }

    .table-container tr.mobile-card.expanded .card-summary::after {
        transform: translateY(-50%) rotate(180deg);
    }

    /* Summary cell — always visible */
    .table-container tr.mobile-card .card-summary {
        display: block;
        padding: 0;
        border: none;
    }

    /* Line 1: main data — name + amount + indicator */
    .card-summary-line1 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-left: 28px;
        min-height: 24px;
    }

    .card-summary-line1 .card-name {
        font-size: 0.95rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .card-summary-line1 .card-amount {
        font-weight: 700;
        font-size: 1rem;
        flex-shrink: 0;
        letter-spacing: -0.02em;
    }

    .card-summary-line1 .status-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .card-summary-line1 .status-dot.dot-active { background: var(--success); box-shadow: 0 0 6px var(--success); }
    .card-summary-line1 .status-dot.dot-inactive { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

    .card-summary-line1 .category-icon {
        font-size: 0.85rem;
        flex-shrink: 0;
        opacity: 0.7;
    }

    /* Line 2: secondary info — brand, meta tags */
    .card-summary-line2 {
        display: flex;
        align-items: center;
        gap: 8px;
        padding-left: 28px;
        margin-top: 6px;
        flex-wrap: wrap;
    }

    .card-summary-line2 .card-meta {
        font-size: 0.78rem;
        color: var(--text-secondary);
        white-space: nowrap;
    }

    .card-summary-line2 .brand-badge {
        font-size: 0.72rem;
        padding: 2px 8px;
    }

    /* Legacy single-row support */
    .card-summary-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-left: 28px;
        min-height: 24px;
    }

    .card-summary-row .card-name {
        font-size: 0.95rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .card-summary-row .card-amount {
        font-weight: 700;
        font-size: 1rem;
        flex-shrink: 0;
    }

    /* Legacy card-line support — keep for backward compat */
    .card-line1 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
    }

    .card-line1 strong {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card-line1 .brand-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
        flex-shrink: 0;
    }

    .card-line2 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding-left: 24px;
    }

    .card-line2 .card-amount {
        font-weight: 700;
        font-size: 0.95rem;
    }

    .card-line2 .badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    /* Details cell — hidden by default */
    .table-container tr.mobile-card .card-details {
        display: none;
        padding: 0;
        border: none;
    }

    .table-container tr.mobile-card.expanded .card-details {
        display: block;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        animation: cardDetailSlide 0.2s ease-out;
    }

    @keyframes cardDetailSlide {
        from { opacity: 0; transform: translateY(-6px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .card-detail-grid {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 8px 14px;
        font-size: 0.88rem;
        margin-bottom: 10px;
    }

    .card-detail-grid .detail-label {
        color: var(--text-secondary);
        font-weight: 500;
        white-space: nowrap;
        line-height: 1.5;
    }

    .card-detail-grid .detail-value {
        color: var(--text-primary);
        text-align: left;
        direction: ltr;
        line-height: 1.5;
        word-break: break-word;
    }

    /* Action buttons in expanded card */
    .card-details .action-btns {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        flex-wrap: wrap;
    }

    .card-details .action-btns .btn {
        min-height: 40px;
        min-width: 40px;
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    /* Hide default td structure for mobile-card rows */
    .table-container tr.mobile-card td {
        display: none;
        border: none;
        padding: 0;
    }
    .table-container tr.mobile-card td.card-summary,
    .table-container tr.mobile-card td.card-details {
        display: block;
    }
    .table-container tr.mobile-card.expanded td.card-details {
        display: block;
    }
    .table-container tr.mobile-card:not(.expanded) td.card-details {
        display: none;
    }

    /* Empty state for mobile cards */
    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td[colspan] {
        display: block !important;
        text-align: center;
        padding: 40px 20px !important;
        color: var(--text-secondary);
        font-size: 0.95rem;
        border: none;
    }
    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td[colspan]::before {
        display: none;
    }

    /* Fallback: non-mobile-card rows (admin tables) */
    .table-container tr:not(.mobile-card):not(.mobile-card-v2) {
        display: block;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        margin-bottom: 8px;
        padding: 12px 16px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        white-space: normal;
        min-height: 40px;
        font-size: 0.9rem;
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td:not(:last-child) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--accent-primary);
        font-size: 0.85rem;
        flex: 0 0 40%;
        text-align: right;
        padding-left: 12px;
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td > * {
        flex: 1;
        text-align: left;
        min-width: 0;
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) .action-btns {
        position: static;
        width: 100%;
        display: flex;
        gap: 6px;
        justify-content: flex-start;
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td:has(.action-btns) {
        flex-direction: column;
        align-items: stretch;
    }

    .table-container tr:not(.mobile-card):not(.mobile-card-v2) td:has(.action-btns)::before {
        display: none;
    }

    /* Badge styling in cards */
    .table-container .badge {
        position: static;
        display: inline-block;
    }

    /* Remove scroll hint for card layout */
    .table-container::before {
        display: none;
    }

    /* Disable horizontal scroll for card layout */
    .table-container {
        overflow-x: visible !important;
        padding: 0 !important;
    }

    .table-container:has(.mobile-card-v2) {
        margin: 0 -2px !important;
        width: calc(100% + 4px) !important;
    }

    /* ============================================
       CARD V2: Full-info dashboard cards
       All data visible — no expand/collapse
       ============================================ */
    .table-container tr.mobile-card-v2 {
        display: block;
        width: 100%;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 14px;
        margin-bottom: 0;
        padding: 12px 10px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
        position: relative;
        overflow: hidden;
        border-right: 4px solid var(--glass-border);
        animation: cardV2Enter 0.3s ease-out backwards;
        box-sizing: border-box;
    }

    .table-container tr.mobile-card-v2:nth-child(1) { animation-delay: 0.03s; }
    .table-container tr.mobile-card-v2:nth-child(2) { animation-delay: 0.06s; }
    .table-container tr.mobile-card-v2:nth-child(3) { animation-delay: 0.09s; }
    .table-container tr.mobile-card-v2:nth-child(4) { animation-delay: 0.12s; }
    .table-container tr.mobile-card-v2:nth-child(5) { animation-delay: 0.15s; }
    .table-container tr.mobile-card-v2:nth-child(n+6) { animation-delay: 0.18s; }

    @keyframes cardV2Enter {
        from { opacity: 0; transform: translateY(12px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .table-container tr.mobile-card-v2.status-active { border-right-color: var(--success); }
    .table-container tr.mobile-card-v2.status-inactive { border-right-color: var(--danger); }
    .table-container tr.mobile-card-v2.status-deposit { border-right-color: var(--success); }
    .table-container tr.mobile-card-v2.status-withdrawal { border-right-color: var(--warning); }
    .table-container tr.mobile-card-v2.status-expense { border-right-color: var(--danger); }

    /* Hide default tds, show only card-v2 */
    .table-container tr.mobile-card-v2 td {
        display: none;
        border: none;
        padding: 0;
    }
    .table-container tr.mobile-card-v2 td.card-v2 {
        display: block;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        padding: 0;
    }

    /* --- Card V2: Header --- */
    .card-v2-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        gap: 8px;
    }

    .card-v2-header-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
        flex-wrap: wrap;
    }

    .card-v2-actions {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .card-v2-btn {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        border: 1px solid var(--glass-border);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 0.8rem;
        padding: 0;
        min-width: 34px;
        min-height: 34px;
    }

    .card-v2-btn:active {
        transform: scale(0.88);
    }

    .card-v2-btn-view {
        color: var(--accent-primary);
        border-color: rgba(0, 229, 255, 0.2);
    }
    .card-v2-btn-view:active { background: rgba(0, 229, 255, 0.12); }

    .card-v2-btn-edit {
        color: var(--warning);
        border-color: rgba(255, 170, 0, 0.2);
    }
    .card-v2-btn-edit:active { background: rgba(255, 170, 0, 0.12); }

    .card-v2-btn-delete {
        color: var(--danger);
        border-color: rgba(255, 51, 102, 0.2);
    }
    .card-v2-btn-delete:active { background: rgba(255, 51, 102, 0.12); }

    /* --- Card V2: Main content --- */
    .card-v2-main {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 10px;
    }

    .card-v2-name {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        line-height: 1.3;
    }

    .card-v2-amount {
        font-size: 1.2rem;
        font-weight: 800;
        flex-shrink: 0;
        letter-spacing: -0.03em;
        font-variant-numeric: tabular-nums;
    }

    .card-v2-amount.deposit { color: var(--success); }
    .card-v2-amount.withdrawal { color: var(--warning); }
    .card-v2-amount.expense { color: var(--danger); }
    .card-v2-amount.balance { color: var(--accent-primary); }

    /* --- Card V2: Meta chips --- */
    .card-v2-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .card-v2-chip {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 0.78rem;
        color: var(--text-secondary);
        background: rgba(255, 255, 255, 0.04);
        padding: 4px 10px;
        border-radius: 7px;
        white-space: nowrap;
        border: 1px solid rgba(255, 255, 255, 0.04);
    }

    .card-v2-chip i {
        font-size: 0.68rem;
        opacity: 0.6;
    }

    /* --- Card V2: Footer (extras) --- */
    .card-v2-footer {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .card-v2-tag {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 0.75rem;
        padding: 3px 9px;
        border-radius: 6px;
        white-space: nowrap;
    }

    .card-v2-tag i { font-size: 0.65rem; }

    .card-v2-tag.bonus {
        background: rgba(0, 229, 255, 0.08);
        color: var(--accent-primary);
    }

    .card-v2-tag.total {
        background: rgba(0, 255, 136, 0.08);
        color: var(--success);
        font-weight: 600;
    }

    .card-v2-tag.fee {
        background: rgba(255, 170, 0, 0.08);
        color: var(--warning);
    }

    .card-v2-tag.notes {
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-secondary);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* --- Card V2: Status pill --- */
    .card-v2-status {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 0.73rem;
        font-weight: 600;
        padding: 3px 10px;
        border-radius: 20px;
    }

    .card-v2-status.active {
        background: rgba(0, 255, 136, 0.1);
        color: var(--success);
    }

    .card-v2-status.inactive {
        background: rgba(255, 51, 102, 0.1);
        color: var(--danger);
    }

    .card-v2-status .status-dot-sm {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
        box-shadow: 0 0 4px currentColor;
    }

    /* --- Card V2: Type badge --- */
    .card-v2-type {
        font-size: 0.72rem;
        font-weight: 700;
        padding: 3px 10px;
        border-radius: 6px;
    }

    .card-v2-type.deposit {
        background: rgba(0, 255, 136, 0.1);
        color: var(--success);
    }

    .card-v2-type.withdrawal {
        background: rgba(255, 170, 0, 0.1);
        color: var(--warning);
    }
}


/* ============================================
   MOBILE ENHANCEMENTS
   (merged from mobile-enhancements.css)
   ============================================ */

/* Mobile-First Enhancements for App-Like Experience */

/* iOS Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    
    .nav-tabs {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* PWA-like fullscreen */
@media (display-mode: standalone) {
    body {
        padding-top: 0;
    }
}

/* Smooth momentum scrolling */
.table-container,
.main-content,
.modal-body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ============================================
   ENHANCED LOADING & EMPTY STATE ANIMATIONS
   (Lottie-style CSS animations)
   ============================================ */

/* Loading skeleton animations */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0px,
        var(--bg-tertiary) 40px,
        var(--bg-secondary) 80px
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 8px;
}

/* Animated loading spinner */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.loading-spinner-animated {
    width: 80px;
    height: 80px;
    position: relative;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinRing 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: var(--accent-primary);
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: var(--accent-secondary);
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: var(--accent-tertiary);
}

@keyframes spinRing {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Pulsing dots loader */
.loading-dots-animated {
    display: flex;
    gap: 8px;
    align-items: center;
}

.loading-dot {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
    background: var(--accent-secondary);
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
    background: var(--accent-tertiary);
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Empty state with animated icon */
.empty-state-animated {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    gap: 20px;
}

.empty-state-icon {
    font-size: 5rem;
    color: var(--text-secondary);
    opacity: 0.3;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.empty-state-icon.bounce {
    animation: bounceIcon 2s ease-in-out infinite;
}

@keyframes bounceIcon {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

/* Success checkmark animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.success-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke: var(--success);
    fill: none;
    animation: checkmarkCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: var(--success);
    stroke-width: 3;
    fill: none;
    animation: checkmarkCheck 0.3s 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmarkCircle {
    0% {
        stroke-dashoffset: 166;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes checkmarkCheck {
    0% {
        stroke-dashoffset: 48;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Error X animation */
.error-x {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.error-x-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke: var(--danger);
    fill: none;
    animation: checkmarkCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.error-x-line {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: var(--danger);
    stroke-width: 3;
    stroke-linecap: round;
    animation: xLine 0.3s 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes xLine {
    0% {
        stroke-dashoffset: 48;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Skeleton card layout */
.skeleton-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0px,
        var(--bg-tertiary) 40px,
        var(--bg-secondary) 80px
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0px,
        var(--bg-tertiary) 40px,
        var(--bg-secondary) 80px
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Confetti animation for celebrations */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    animation: confetti-fall 3s linear forwards;
    pointer-events: none;
    z-index: 10000;
}

/* Wave animation for loading bars */
@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

.loading-wave {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.wave-bar {
    width: 4px;
    height: 30px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

/* Bottom sheet modal (mobile) */
@media (max-width: 768px) {
    .modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: 90vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        transform-origin: bottom;
    }
    
    .modal.active .modal-content {
        animation: slideUpBottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    @keyframes slideUpBottom {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Add handle for drag-to-close */
    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--text-secondary);
        border-radius: 2px;
        opacity: 0.5;
    }
    
    .modal-header {
        padding-top: 24px;
        position: relative;
    }
}

/* Better toast notifications on mobile */
@media (max-width: 768px) {
    .toast-container {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 400px;
    }
    
    .toast {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(20px);
    }
}

/* Card stack animation */
.glass-card {
    animation: cardAppear 0.3s ease-out backwards;
}

.glass-card:nth-child(1) { animation-delay: 0.05s; }
.glass-card:nth-child(2) { animation-delay: 0.1s; }
.glass-card:nth-child(3) { animation-delay: 0.15s; }
.glass-card:nth-child(4) { animation-delay: 0.2s; }

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Ripple effect on buttons */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Floating labels effect */
.form-group {
    position: relative;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    transform: translateY(-8px) scale(0.85);
    color: var(--accent-primary);
}

/* Swipe indicators removed — were distracting */

/* Better focus states for accessibility */
@media (max-width: 768px) {
    input:focus,
    select:focus,
    textarea:focus,
    button:focus {
        outline: 2px solid var(--accent-primary);
        outline-offset: 2px;
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   WIZARD BOTTOM SHEET & STEP-BY-STEP FORMS
   (Mobile portrait only)
   ============================================ */

/* Wizard Menu Bottom Sheet */
.wizard-bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: none;
}

.wizard-bottom-sheet.active {
    display: block;
}

.wizard-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.wizard-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: slideUpBottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 70vh;
    overflow-y: auto;
}

.wizard-drag-handle {
    width: 40px;
    height: 4px;
    background: var(--text-secondary);
    border-radius: 2px;
    opacity: 0.4;
    margin: 0 auto 16px;
}

.wizard-panel h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-primary);
}

.wizard-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wizard-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: right;
}

.wizard-option:active {
    transform: scale(0.97);
    background: var(--glass-hover);
}

.wizard-option.highlighted {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 12px rgba(0, 229, 255, 0.15);
}

.wizard-option-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 12px;
    flex-shrink: 0;
}

.wizard-option-text {
    flex: 1;
}

.wizard-option-text .wizard-option-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.wizard-option-text .wizard-option-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Wizard Full-Screen Sheet */
.wizard-sheet {
    position: fixed;
    inset: 0;
    z-index: 10003;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
}

.wizard-sheet.active {
    display: flex;
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.wizard-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wizard-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.wizard-close-btn:active {
    transform: scale(0.9);
}

/* Progress dots */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px 6px;
    flex-shrink: 0;
}

.wizard-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--glass-border);
    transition: all 0.3s ease;
}

.wizard-progress-dot.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--glow-color);
}

.wizard-progress-dot.completed {
    background: var(--success);
    border-color: var(--success);
}

.wizard-progress-connector {
    width: 24px;
    height: 2px;
    background: var(--glass-border);
    transition: background 0.3s;
}

.wizard-progress-connector.completed {
    background: var(--success);
}

/* Step content */
.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    -webkit-overflow-scrolling: touch;
}

.wizard-step-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wizard-step-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: wizardStepIn 0.25s ease-out;
}

@keyframes wizardStepIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

.wizard-step .form-group {
    margin-bottom: 16px;
}

.wizard-step .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.wizard-step .form-group input,
.wizard-step .form-group select,
.wizard-step .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.wizard-step .form-group input:focus,
.wizard-step .form-group select:focus,
.wizard-step .form-group textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

/* Transaction type big buttons */
.wizard-type-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.wizard-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    border-radius: 14px;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.wizard-type-btn .type-icon {
    font-size: 2rem;
}

.wizard-type-btn:active {
    transform: scale(0.96);
}

.wizard-type-btn.selected {
    border-color: var(--accent-primary);
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

.wizard-type-btn.type-deposit.selected {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.08);
    box-shadow: 0 0 16px rgba(76, 175, 80, 0.15);
}

.wizard-type-btn.type-withdrawal.selected {
    border-color: var(--warning);
    background: rgba(255, 152, 0, 0.08);
    box-shadow: 0 0 16px rgba(255, 152, 0, 0.15);
}

/* Wizard footer buttons */
.wizard-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.wizard-footer .btn {
    flex: 1;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    min-height: 50px;
}

.wizard-footer .btn-wizard-back {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.wizard-footer .btn-wizard-next {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
}

.wizard-footer .btn-wizard-save {
    background: var(--success);
    color: white;
    border: none;
}

.wizard-footer .btn-wizard-skip {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state illustrations */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* Sticky header on scroll (mobile) */
@media (max-width: 768px) {
    .card-header {
        position: sticky;
        top: 0;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        z-index: 10;
        margin: -12px -12px 12px -12px;
        padding: 12px;
        border-bottom: 1px solid var(--glass-border);
    }
}

/* Better date/time pickers on mobile */
@media (max-width: 768px) {
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] {
        min-height: 48px;
        padding: 12px;
        font-size: 16px;
        border-radius: 8px;
    }
}

/* ============================================
   IMPROVED FORM LAYOUTS FOR MOBILE PORTRAIT
   ============================================ */
@media (max-width: 576px) and (orientation: portrait) {
    /* Full-width form inputs */
    .modal-body .form-group,
    .form-group {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .modal-body input,
    .modal-body select,
    .modal-body textarea,
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        min-height: 52px;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .modal-body textarea,
    .form-group textarea {
        min-height: 120px;
        resize: vertical;
    }
    
    /* Form labels */
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--accent-primary);
    }
    
    /* Collapsible form sections */
    .form-section {
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        margin-bottom: 16px;
        overflow: hidden;
    }
    
    .form-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        cursor: pointer;
        user-select: none;
        background: rgba(255, 255, 255, 0.02);
        transition: background 0.3s ease;
    }
    
    .form-section-header:active {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .form-section-header h3 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin: 0;
    }
    
    .form-section-toggle {
        font-size: 1.2rem;
        color: var(--accent-primary);
        transition: transform 0.3s ease;
    }
    
    .form-section.collapsed .form-section-toggle {
        transform: rotate(-90deg);
    }
    
    .form-section-content {
        padding: 16px;
        max-height: 2000px;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease;
        overflow: hidden;
    }
    
    .form-section.collapsed .form-section-content {
        max-height: 0;
        padding: 0 16px;
        opacity: 0;
    }
    
    /* Form grid - stack on mobile */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .form-col {
        flex: 1;
        width: 100%;
    }
    
    /* Modal footer buttons - stack vertically */
    .modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    
    /* Helper text */
    .form-help {
        display: block;
        margin-top: 6px;
        font-size: 0.85rem;
        color: var(--text-secondary);
        line-height: 1.4;
    }
    
    /* Input with icon */
    .input-with-icon {
        position: relative;
    }
    
    .input-with-icon input {
        padding-right: 48px;
    }
    
    .input-with-icon i {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--accent-primary);
        font-size: 1.1rem;
    }
    
    /* Toggle switches */
    .toggle-switch {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 52px;
        padding: 12px 16px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        margin-bottom: 16px;
    }
    
    .toggle-switch label {
        margin: 0;
        font-weight: 500;
    }
    
    .toggle-switch input[type="checkbox"] {
        width: 52px;
        height: 28px;
        margin: 0;
        transform: none;
        appearance: none;
        background: var(--bg-tertiary);
        border-radius: 14px;
        position: relative;
        cursor: pointer;
        transition: background 0.3s ease;
    }
    
    .toggle-switch input[type="checkbox"]::before {
        content: '';
        position: absolute;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: white;
        top: 2px;
        right: 2px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .toggle-switch input[type="checkbox"]:checked {
        background: var(--accent-primary);
    }
    
    .toggle-switch input[type="checkbox"]:checked::before {
        transform: translateX(-24px);
    }
    
    /* Select dropdown styling */
    select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2300E5FF' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: left 16px center;
        padding-left: 48px;
        cursor: pointer;
    }
    
    /* Radio button groups */
    .radio-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .radio-option {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        background: var(--glass-bg);
        border: 2px solid var(--glass-border);
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .radio-option:has(input:checked) {
        border-color: var(--accent-primary);
        background: rgba(0, 229, 255, 0.1);
    }
    
    .radio-option input[type="radio"] {
        margin: 0 12px 0 0;
    }
    
    .radio-option label {
        margin: 0;
        cursor: pointer;
        flex: 1;
    }
}

/* Improved dropdown menus */
@media (max-width: 768px) {
    select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300E5FF' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: left 12px center;
        padding-left: 32px;
    }
}

/* ============================================
   TOUCH TARGET IMPROVEMENTS
   Reasonable sizes — not oversized
   ============================================ */
@media (max-width: 768px) {
    /* Buttons */
    .btn,
    button {
        min-height: 40px;
        min-width: 40px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* Action buttons in tables — compact */
    .action-btns .btn,
    .btn-sm {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
        font-size: 0.85rem;
    }

    /* Form inputs — keep 44px for iOS zoom prevention */
    input,
    select,
    textarea {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 16px;
    }

    /* Checkboxes and radio buttons — reasonable scale */
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 22px;
        min-height: 22px;
        transform: scale(1.2);
        margin: 8px;
    }

    /* Navigation tabs */
    .nav-tab {
        min-height: 40px;
        min-width: 40px;
        padding: 10px 14px;
    }

    /* Table action buttons */
    .action-btns {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    /* FAB button */
    .mobile-fab {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }

    /* Close buttons in modals */
    .modal-close,
    .close-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 10px;
    }

    /* Badge buttons (status toggles) */
    .badge.clickable {
        min-height: 32px;
        padding: 6px 14px;
    }

    /* Spacing between interactive elements */
    .form-group {
        margin-bottom: 20px;
    }

    .btn + .btn {
        margin-right: 8px;
    }
}

/* Coarse pointer devices (touch screens) */
@media (max-width: 768px) and (pointer: coarse) {
    .action-btns .btn {
        min-width: 40px;
        min-height: 40px;
        padding: 10px;
    }
}

/* Dark mode optimizations for OLED screens */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body {
        background: #000;
    }
    
    .glass-card {
        background: rgba(255, 255, 255, 0.02);
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-card {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* ============================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================ */
@media (max-width: 768px) and (orientation: portrait) {
    /* Hide desktop navigation on mobile portrait */
    .nav-tabs {
        display: none !important;
    }
    
    /* Bottom navigation container */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 10px;
        border-radius: 10px;
        color: var(--text-secondary);
        text-decoration: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
        min-width: 56px;
        position: relative;
        overflow: hidden;
    }
    
    .mobile-nav-item i {
        font-size: 1.3rem;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-item span {
        font-size: 0.65rem;
        font-weight: 500;
        transition: all 0.3s ease;
    }
    
    /* Active state */
    .mobile-nav-item.active {
        color: var(--accent-primary);
        background: var(--glass-bg);
    }
    
    .mobile-nav-item.active i {
        transform: scale(1.1);
        color: var(--accent-primary);
    }
    
    /* Pill indicator */
    .mobile-nav-item.active::before {
        content: '';
        position: absolute;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 2px;
        background: var(--accent-primary);
        border-radius: 2px;
        box-shadow: 0 0 8px var(--accent-primary);
    }
    
    /* Ripple effect */
    .mobile-nav-item::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
        transform: translate(-50%, -50%);
        transition: width 0.4s ease, height 0.4s ease;
    }
    
    .mobile-nav-item:active::after {
        width: 100%;
        height: 100%;
    }
    
    /* Adjust main content padding for bottom nav */
    .main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    /* More menu — full-screen overlay */
    .mobile-nav-more-menu {
        position: fixed;
        inset: 0;
        z-index: 1001;
        display: none !important;
    }

    .mobile-nav-more-menu.active {
        display: block !important;
    }

    .mobile-more-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        animation: fadeIn 0.2s ease;
    }

    .mobile-more-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 80vh;
        background: var(--bg-secondary);
        border-radius: 20px 20px 0 0;
        overflow-y: auto;
        animation: slideUpFade 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .mobile-more-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 20px 12px;
        position: relative;
    }

    .mobile-more-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--text-secondary);
        border-radius: 2px;
        opacity: 0.3;
    }

    .mobile-more-header h3 {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    .mobile-more-close {
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-more-close:hover {
        color: var(--danger);
        border-color: var(--danger);
    }

    .mobile-more-content {
        padding: 0 12px;
    }

    .mobile-more-group {
        margin-bottom: 8px;
    }

    .mobile-more-group-label {
        padding: 12px 12px 6px;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-secondary);
        opacity: 0.6;
    }

    .mobile-nav-more-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        border-radius: 12px;
        color: var(--text-primary);
        text-decoration: none;
        transition: all 0.2s ease;
        cursor: pointer;
        min-height: 48px;
    }

    .mobile-nav-more-item:hover,
    .mobile-nav-more-item.active {
        background: var(--glass-bg);
        color: var(--accent-primary);
    }

    .mobile-nav-more-item i {
        font-size: 1.1rem;
        width: 24px;
        text-align: center;
        color: var(--text-secondary);
    }

    .mobile-nav-more-item.active i,
    .mobile-nav-more-item:hover i {
        color: var(--accent-primary);
    }
    
    /* Badge for notifications */
    .mobile-nav-badge {
        position: absolute;
        top: 4px;
        right: 8px;
        background: var(--danger);
        color: white;
        font-size: 0.65rem;
        font-weight: 700;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
        box-shadow: 0 2px 8px rgba(255, 51, 102, 0.4);
    }
}
