@media (min-width: 769px) and (max-width: 1024px) {
    .stats-row { grid-template-columns: 1fr 200px; }
    .balance-info h1 { font-size: 2.1rem; }
    .main-panel { padding: 26px; }
    .chart-box { min-height: 260px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.05rem; }
}

@media (max-width: 768px) {
    .app-container { padding: 14px 12px 96px; }

    .main-panel { padding: 18px; border-radius: 20px; }

    .view-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .view-header h2 { font-size: 1.35rem; }

    .stats-row {
        grid-template-columns: 1fr 140px;
        gap: 12px;
    }
    .balance-card { padding: 18px 16px; }
    .balance-info h1 { font-size: 1.65rem; }
    .pie-card { padding: 10px; }
    .pie-card canvas { max-width: 120px !important; max-height: 120px !important; }

    .two-col-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 12px; gap: 10px; }
    .stat-card i { font-size: 1.3rem; }
    .stat-card strong { font-size: 0.95rem; }

    .report-grid { grid-template-columns: 1fr; gap: 12px; }
    .chart-box { padding: 14px; min-height: 230px; }

    .filter-row { flex-direction: column; width: 100%; gap: 8px; }
    .month-selector, .type-filter { width: 100%; font-size: 0.86rem; }

    .data-table { font-size: 0.74rem; }
    .data-table th, .data-table td { padding: 8px 8px; font-size: 0.74rem; }
    .data-table td small { font-size: 0.64rem; }
    .data-table tfoot td { padding: 8px 8px; }

    .form-card { padding: 18px; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 0.8rem; }
    .form-group input, .form-group select { padding: 10px 12px; font-size: 0.9rem; }
    .btn-save { padding: 12px; font-size: 0.9rem; }

    .method-subfields { grid-template-columns: 1fr; gap: 12px; }

    .cashflow-advice { padding: 14px 16px; }
    #cashflow-value { font-size: 1.15rem; }

    .download-buttons-group { flex-direction: column; gap: 8px; }
    .download-btn, .install-btn { width: 100%; justify-content: center; }

    .profile-card { padding: 18px; }
    .profile-avatar i { font-size: 80px; }
    .avatar-badge { right: 0; width: 26px; height: 26px; }
    .avatar-badge i { font-size: 12px; }

    .field-row { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 0; }
    .field-value-group { width: 100%; justify-content: space-between; }
    .currency-selector, .language-selector { width: 100%; }
    .toggle-btn { width: 100%; justify-content: center; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-item { padding: 12px; }
    .stat-value { font-size: 0.95rem; }

    .modal-content { width: 95%; }
    .modal-header, .modal-body, .modal-footer { padding: 14px 16px; }

    .bottom-nav { padding: 9px 10px; }
    .nav-item { padding: 5px 8px; }
    .nav-item span { font-size: 0.6rem; }
    .nav-item i { font-size: 1.2rem; }

    .brand-credit { font-size: 0.62rem; }

    .insight-text { font-size: 0.82rem; padding: 11px 14px; }
    .preview-table-section h3, .table-preview-section h3, .download-section h3 { font-size: 0.82rem; }
}

@media (max-width: 480px) {
    .main-panel { padding: 14px; }
    .view-header h2 { font-size: 1.15rem; }

    .stats-row { grid-template-columns: 1fr 120px; gap: 10px; }
    .balance-info h1 { font-size: 1.4rem; }
    .pie-card canvas { max-width: 100px !important; max-height: 100px !important; }

    .two-col-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card strong { font-size: 0.88rem; }
    .stat-card i { font-size: 1.2rem; }

    .data-table { font-size: 0.68rem; }
    .data-table th, .data-table td { padding: 7px 6px; font-size: 0.68rem; }
    .data-table td small { font-size: 0.58rem; }

    .chart-box { min-height: 200px; padding: 10px; }

    .insight-text { font-size: 0.76rem; padding: 10px 12px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-label { font-size: 0.68rem; }
    .stat-value { font-size: 0.88rem; }

    .credit-footer { font-size: 0.7rem; }
}

@media (max-width: 768px) and (orientation: landscape) {
    .stats-row { grid-template-columns: 1fr 160px; }
    .report-grid { grid-template-columns: 1fr 1fr; }
    .chart-box { min-height: 190px; }
    .filter-row { flex-direction: row; }
    .month-selector, .type-filter { width: auto; flex: 1; }
    .table-wrapper { max-height: 360px; overflow-y: auto; }
    .download-buttons-group { flex-direction: row; flex-wrap: wrap; }
    .download-btn, .install-btn { width: auto; flex: 1; }
    .field-row { flex-direction: row; justify-content: space-between; align-items: center; }
    .field-value-group { width: auto; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (hover: hover) {
    .nav-item:hover { color: var(--accent-2); background: var(--accent-light); transform: translateY(-2px); }
    .download-btn:hover, .install-btn:hover, .btn-save:hover { transform: translateY(-1px); }
    .month-selector:hover, .type-filter:hover { border-color: var(--border-focus); }
    .edit-btn:hover, .view-balance-btn:hover { background: var(--accent-light); border-color: var(--accent-2); color: var(--accent-2); }
    .toggle-btn:hover { background: var(--accent-light); border-color: var(--accent-2); color: var(--accent-2); }
    .currency-selector:hover, .language-selector:hover { border-color: var(--border-focus); }
    .data-table tr:hover td { background: var(--bg-table-hover); }
}

@media (min-width: 820px) {
    .bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0;
    }
}