/* ============================================================================
   💎 MINIAPP TÀI CHÍNH - ADAPTIVE OCEAN CYAN FINTECH DESIGN SYSTEM (GLASSMORPHISM)
   ============================================================================ */

/* ─── THEME TỐI ĐẶC TRƯNG (MẶC ĐỊNH HOẶC THEO HỆ THỐNG) ─── */
:root {
  --bg-base: #0B1120;
  /* Chuyển bề mặt và card thành dạng trong suốt */
  --bg-surface: rgba(15, 23, 42, 0.65); 
  --bg-card: rgba(30, 41, 59, 0.45);
  --bg-card2: rgba(51, 65, 85, 0.4);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-border: rgba(255, 255, 255, 0.08);

  /* Tone Xanh Cyan FinTech linh hoạt */
  --primary: #06B6D4;
  --primary-light: #67E8F9;
  --primary-dark: #0891B2;
  --primary-alpha: rgba(6, 182, 212, 0.15); 
  --grad-primary: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);

  /* Phân loại tài chính - MÀU TƯƠI RỰC RỠ (Đồng bộ Sáng & Tối) */
  --income-color: #00D26A; 
  --income: #00D26A;
  --income-bg: rgba(0, 210, 106, 0.15);

  --expense-color: #FF4444; 
  --expense: #FF4444;
  --expense-bg: rgba(255, 68, 68, 0.15);

  --balance-color: #FFB800; 
  --balance: #FFB800;

  /* Hệ thống chữ */
  --text-1: #F8FAFC;   
  --text-2: #94A3B8;   
  --text-3: #475569;   
  
  /* Viền kính mỏng bắt sáng */
  --border: rgba(255, 255, 255, 0.12);
  --border-color: rgba(255, 255, 255, 0.08);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  
  --shadow-glow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --glass-effect: blur(24px) saturate(180%);
}

/* ─── TỰ ĐỘNG CHUYỂN ĐỔI THEME SÁNG THEO THIẾT BỊ ─── */
@media (prefers-color-scheme: light) {
  :root {
    --bg-base: #F0F4F8;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-card: rgba(255, 255, 255, 0.5);
    --bg-card2: rgba(255, 255, 255, 0.8);
    --bg-glass: rgba(0, 0, 0, 0.03);
    --bg-glass-border: rgba(0, 0, 0, 0.04);

    --primary: #0891B2;
    --primary-light: #06B6D4;
    --primary-dark: #155E75;
    --primary-alpha: rgba(6, 182, 212, 0.12);
    
    --grad-primary: linear-gradient(135deg, #0284C7 0%, #1E40AF 100%);

    --income-color: #00D26A; 
    --income: #00D26A;
    --income-bg: rgba(0, 210, 106, 0.12);

    --expense-color: #FF4444; 
    --expense: #FF4444;
    --expense-bg: rgba(255, 68, 68, 0.1);

    --balance-color: #FFB800; 
    --balance: #FFB800;

    --text-1: #0F172A;
    --text-2: #475569;
    --text-3: #94A3B8;
    
    --border: rgba(255, 255, 255, 0.8); /* Viền sáng hơn để kính nổi bật */
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 8px 32px rgba(31, 38, 135, 0.07);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 15px; scroll-behavior: smooth; }

body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background-color: var(--bg-base);
    /* Các đốm màu (Blobs) mờ ảo ở các góc màn hình tạo hiệu ứng nền cho kính */
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-1); 
    padding: 0 0 100px 0; 
    min-height: 100vh; 
    overflow-x: hidden; 
    transition: background-color 0.3s ease, color 0.3s ease; 
}
.content-wrapper { max-width: 600px; margin: 0 auto; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tab-content { display: none; padding: 0 16px; animation: tabFadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes tabFadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

/* UTILITY CLASSES */
.mt-4 { margin-top: 16px !important; }
.mb-3 { margin-bottom: 12px !important; }
.pb-4 { padding-bottom: 16px !important; }
.w-full { width: 100% !important; }
.flex-1 { flex: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.text-left { text-align: left !important; }
.text-income-color { color: var(--income) !important; }
.text-expense-color { color: var(--expense) !important; }
.m-0 { margin: 0 !important; }
.flex-row-gap-10 { display: flex; gap: 10px; }

.loading-spinner { text-align: center; margin: 16px 0; }
.loading-spinner i { font-size: 1.5rem; color: var(--primary-light); }

.section-header { display: flex; align-items: center; justify-content: center; margin-top: 20px; margin-bottom: 12px; }
.section-title { font-size: 1.15rem; font-weight: 800; color: var(--text-1); letter-spacing: -0.01em; text-transform: uppercase; text-align: center; }
h1 { font-size: 1.1rem; font-weight: 800; color: var(--primary-light); margin: 1.5rem 0 1rem; text-align: center; text-transform: uppercase; }

.empty-state { text-align: center; color: var(--text-3); font-style: italic; padding: 8px 0 24px; font-size: 0.9rem; width: 100%; }

.hero-card { 
    /* Dùng chung biến màu với các nút filter đang active */
    background: var(--grad-primary);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.2);
    border-radius: var(--radius-xl); 
    padding: 20px 20px 18px; 
    margin-top: 16px; 
    margin-bottom: 16px; 
    position: relative; 
    overflow: hidden; 
    cursor: pointer; 
    transition: transform 0.25s ease, box-shadow 0.25s ease; 
}
.hero-card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(6, 182, 212, 0.3); }
.hero-card:active { transform: scale(0.98); }
.hero-card::before { content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.06); top: -60px; right: -40px; }
.hero-card::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.04); bottom: -30px; left: 20px; }

.hero-date-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; position: relative; z-index: 1; }
.hero-date { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin-bottom: 0; }
.date-nav-btn { background: rgba(255, 255, 255, 0.15); border: none; color: white; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); font-size: 0.7rem; }
.date-nav-btn:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }
.date-nav-btn:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.4); }

.hero-label, .hero-stat-label { display: flex; align-items: center; }
.hero-label i, .hero-stat-label i { margin-right: 4px; }
.hero-label { font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; position: relative; z-index: 1; }
.hero-balance { font-size: 2.2rem; font-weight: 900 !important; color: white; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 4px; position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; white-space: nowrap !important; }
.hero-balance span { font-size: 1.2rem; font-weight: 700; opacity: 0.8; line-height: 1; }

#heroExpenseCompare { font-size: 0.75rem; margin-bottom: 20px; display: flex; align-items: center; gap: 4px; position: relative; z-index: 1; }
#heroExpenseCompare span { background: transparent !important; padding: 0 !important; box-shadow: none !important; text-shadow: none !important; letter-spacing: 0.02em; font-weight: 800 !important; }
#heroExpenseCompare span i { margin-right: 4px; }

.hero-sub { display: flex; gap: 20px; margin-top: 18px; position: relative; z-index: 1; }
.hero-stat { flex: 1; }
.hero-stat-label { font-size: 0.7rem; color: rgba(255,255,255,0.6); font-weight: 600; margin-bottom: 3px; }
.hero-stat-val { font-size: 1.05rem; font-weight: 700; color: white; white-space: nowrap !important; }
.divider-v { width: 1px; background: rgba(255,255,255,0.2); }

.quick-actions { display: flex; gap: 10px; margin-bottom: 8px; }
.qa-btn { flex: 1; background: transparent; border: none; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.qa-btn-relative { position: relative; }
.qa-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.qa-icon.filter { background: rgba(255, 184, 0, 0.12); color: var(--balance); }
.qa-icon.add { background: rgba(0, 210, 106, 0.12); color: var(--income); }
.qa-icon.search { background: var(--primary-alpha); color: var(--primary-light); }
.qa-label { font-size: 0.75rem; font-weight: 600; color: var(--text-1); transition: color 0.25s ease; }
.qa-btn:hover .qa-icon { transform: scale(1.08) translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); filter: brightness(1.1); }
.qa-btn:hover .qa-label { color: var(--primary-light); }
.qa-btn:active .qa-icon { transform: scale(0.95); }
.hidden-picker { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor:pointer; }

/* GLASSMORPHISM CARD COMPONENTS */
.tx-card, .stat-card, .info-card, .cat-progress-card, .time-nav-container, .filter-controls, .chart-placeholder, .keyword-group-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-effect);
    -webkit-backdrop-filter: var(--glass-effect);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx-card { position: relative; border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 14px; transition: all 0.25s ease; overflow: hidden; }
.tx-card:hover { background: var(--bg-card2); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.05); border-color: rgba(6, 182, 212, 0.2); }
.tx-icon-wrap { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.tx-icon-wrap.income { background: var(--income-bg); color: var(--income); }
.tx-icon-wrap.expense { background: var(--expense-bg); color: var(--expense); }
.tx-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tx-title { font-size: 0.95rem; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.tx-meta-row { margin-bottom: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tx-date { font-size: 0.72rem; color: var(--text-2); font-weight: 600; margin-right: 2px; }
.tx-badge { font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.tx-badge-neutral { background: var(--bg-card2); color: var(--text-2); border: 1px solid var(--border-color); }
.tx-badge.income { background: var(--income-bg); color: var(--income); }
.tx-badge.expense { background: var(--expense-bg); color: var(--expense); }
.tx-note { font-size: 0.75rem; color: var(--text-3); margin-top: 4px; font-style: italic; }
.tx-note-icon { font-size: 0.65rem; margin-right: 4px; }
.tx-id-row { font-size: 0.65rem; color: var(--text-3); font-weight: 500; margin-top: 4px; }
.tx-right-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tx-amount { font-size: 1.1rem; font-weight: 900 !important; flex-shrink: 0; letter-spacing: -0.02em; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.tx-amount.income { color: var(--income) !important; }
.tx-amount.expense { color: var(--expense) !important; }
.tx-actions { display: flex; gap: 6px; }

.tx-btn { background: var(--bg-glass); border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.tx-btn.edit-btn { color: var(--primary-light); }
.tx-btn.delete-btn { color: var(--expense); }
.tx-btn:hover { transform: translateY(-2px); filter: brightness(1.2); }
.tx-btn.edit-btn:hover { background: rgba(6, 182, 212, 0.15); border-color: rgba(6, 182, 212, 0.3); }
.tx-btn.delete-btn:hover { background: rgba(255, 68, 68, 0.15); border-color: rgba(255, 68, 68, 0.3); }
.tx-btn:active { transform: scale(0.9); }

.period-pills { display: flex; gap: 10px; padding: 6px 0; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.period-pills::-webkit-scrollbar { display: none; }
.period-pill { flex: 1; text-align: center; padding: 12px 14px; border-radius: 24px; font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap; border: 1px solid rgba(255, 255, 255, 0.15); background: var(--bg-card2); color: var(--text-2); transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.period-pill:hover:not(.active) { background: var(--bg-card); color: var(--primary-light); border-color: var(--primary-alpha); transform: translateY(-1px); }
.period-pill:active:not(.active) { transform: scale(0.96); }
.period-pill.active { background: var(--grad-primary); color: white; box-shadow: 0 4px 12px var(--primary-alpha); transform: translateY(-1px); border: 1px solid rgba(255, 255, 255, 0.35); }

.time-nav-container { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding: 8px; border-radius: var(--radius-md); }
.nav-arrow-btn { background: transparent; border: none; color: var(--text-2); padding: 8px 14px; cursor: pointer; transition: all 0.2s ease; border-radius: 8px; }
.nav-arrow-btn:hover { color: var(--primary-light); background: rgba(255,255,255,0.05); transform: scale(1.1); }
.nav-arrow-btn:active { transform: scale(0.9); }
.time-nav-center { position: relative; flex: 1; text-align: center; }
#currentPeriodLabel { font-weight: 700; color: var(--text-1); font-size: 0.9rem; }

.filter-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px; border-radius: var(--radius-md); }
.filter-separator { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.btn-filter { width: 42px !important; flex: 0 0 42px !important; height: 42px !important; padding: 0 !important; display: flex; align-items: center; justify-content: center; border-radius: 50% !important; transition: all 0.25s ease; }
.btn-filter:hover { transform: rotate(10deg) scale(1.05); box-shadow: 0 4px 15px var(--primary-alpha); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-card { border-radius: var(--radius-md); padding: 14px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; transition: all 0.25s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-color: rgba(255,255,255,0.1); }
.stat-header { display: flex; align-items: center; gap: 6px; }
.stat-header i { font-size: 0.85rem; }
.stat-tag { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.stat-header.card-income i, .stat-header.card-income .stat-tag { color: var(--income); }
.stat-header.card-expense i, .stat-header.card-expense .stat-tag { color: var(--expense); }
.stat-header.card-balance i, .stat-header.card-balance .stat-tag { color: var(--balance); }
.stat-num { font-size: clamp(0.85rem, 4vw, 1.05rem); font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; width: 100%; }
.stat-num.income { color: var(--income); }
.stat-num.expense { color: var(--expense); }
.stat-num.balance { color: var(--balance); }
.stat-compare { font-size: 0.6rem; text-align: left; line-height: 1.4; width: 100%; }
.stat-compare span { background: transparent !important; padding: 0 !important; }

.chart-placeholder { border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; position: relative; display: flex; justify-content: center; align-items: center; min-height: 250px; }
.chart-title { font-size: 0.9rem; font-weight: 800; color: var(--primary-light); margin-bottom: 12px; letter-spacing: -0.01em; text-transform: uppercase; }

.pie-layout-wrapper { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 16px; gap: 16px; }
.pie-layout-wrapper .pie-chart-inner { flex: 0 0 140px; width: 140px; height: 140px; min-width: 140px !important; min-height: 140px !important; display: flex; justify-content: center; align-items: center; position: relative; transition: transform 0.3s ease; }
.pie-layout-wrapper .pie-chart-inner:hover { transform: scale(1.05); }
.chart-placeholder canvas { width: 100% !important; max-height: 100% !important; object-fit: contain; }

.compact-legend { flex: 1; display: flex; flex-direction: column; gap: 12px; max-height: 150px; overflow-y: auto; padding-right: 8px; min-width: 0; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--text-3) transparent; }
.compact-legend::-webkit-scrollbar { width: 4px; -webkit-appearance: none; }
.compact-legend::-webkit-scrollbar-track { background: transparent; }
.compact-legend::-webkit-scrollbar-thumb { background-color: var(--text-3); border-radius: 10px; }
.legend-item { display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: 0.2s; padding: 4px; border-radius: 6px; }
.legend-item:hover { opacity: 1; background: rgba(255,255,255,0.05); transform: translateX(4px); }
.legend-item-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.legend-name { font-size: 0.8rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-value-col { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.legend-pct { font-size: 0.75rem; font-weight: 800; white-space: nowrap !important; }

/* Chi tiết danh mục */
.category-detail { padding-bottom: 20px; will-change: transform, opacity; }
.detail-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; margin-top: 20px; }
#categoryDetailTitle { margin: 0; text-align: left; font-size: 1.1rem; color: var(--text-1); }
.detail-total-card { text-align: center; margin-bottom: 20px; padding: 16px; background: var(--bg-card); border-radius: var(--radius-md); border: 1px solid rgba(255, 255, 255, 0.15); box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.detail-total-label { font-size: 0.7rem; color: var(--text-2); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; letter-spacing: 0.05em; }
.detail-total-value { font-size: 1.6rem; font-weight: 900; line-height: 1; letter-spacing: -0.01em; }

.cat-progress-card { border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.cat-progress-card:hover { background: var(--bg-card2); transform: translateX(4px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); border-color: rgba(255,255,255,0.1); }
.cat-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cat-progress-info { display: flex; align-items: center; gap: 10px; }
.cat-progress-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.cat-progress-title { font-size: 0.88rem; font-weight: 600; color: var(--text-1); }
.cat-progress-amt { font-size: 0.95rem; font-weight: 800; white-space: nowrap !important; }
.cat-progress-bar-bg { height: 5px; background: var(--bg-card2); border-radius: 3px; width: 100%; overflow: hidden; }
.cat-progress-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); z-index: 1500; display: none; }
.overlay.show { display: flex !important; }

/* MODALS GLASSMORPHISM */
.modal-sheet { 
    position: fixed; bottom: 0; left: 0; right: 0; 
    background: var(--bg-surface); 
    backdrop-filter: var(--glass-effect); 
    -webkit-backdrop-filter: var(--glass-effect); 
    border-radius: 28px 28px 0 0; padding: 20px 20px 40px; 
    border-top: 1px solid var(--border); 
    /* ĐÃ SỬA: Chỉ giữ lại viền kính sáng mỏng bên trong, gỡ bỏ phần bóng đổ vệt đen hắt ra ngoài ở trạng thái ẩn */
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1); 
    z-index: 2000; transform: translateY(100%); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease; 
    max-height: 90vh; overflow-y: auto; width: 100%; max-width: 600px; margin: 0 auto; 
}

.modal-sheet.show { 
    transform: translateY(0); 
    /* ĐÃ SỬA: Bật lại bóng đen ở đây khi cửa sổ trượt lên để tạo chiều sâu */
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.1); 
}
.modal-handle { width: 40px; height: 5px; background: var(--text-2); opacity: 0.4; border-radius: 3px; margin: 0 auto 20px; }
.modal-title { font-size: 1.15rem; font-weight: 800; color: var(--text-1); margin-bottom: 24px; letter-spacing: -0.02em; text-transform: uppercase; display: flex; align-items: center; }

.modal-footer-actions { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
.modal-action-group { display: flex; gap: 8px; flex: 1; justify-content: flex-end; flex-wrap: nowrap; min-width: 0; }

/* BẢNG ICON PICKER */
.icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; align-content: start; max-height: 40vh; overflow-y: auto; }
.icon-grid-scrollable { min-height: 160px; max-height: 240px; overflow-y: auto; flex-shrink: 0; padding-bottom: 8px; }

/* GLASSMORPHISM INPUTS & PILLS */
.field-input, .btn-soft, .btn-cancel, .btn-back, .type-pill, .icon-item {
    background: var(--bg-card) !important; 
    backdrop-filter: var(--glass-effect);
    -webkit-backdrop-filter: var(--glass-effect);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05);
}

.icon-item { font-size: 1.5rem; color: var(--text-2); padding: 12px; border-radius: 12px; text-align: center; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); display: flex; justify-content: center; align-items: center; }
.icon-item:hover:not(.selected) { background: var(--bg-card2) !important; border-color: rgba(6, 182, 212, 0.3) !important; transform: scale(1.05); }
.icon-item:active { transform: scale(0.95); }
.icon-item.selected { border-color: var(--primary) !important; color: var(--primary); background: var(--primary-alpha) !important; transform: scale(1.1); box-shadow: 0 4px 15px var(--primary-alpha); }
.icon-item.disabled-icon { opacity: 0.2; pointer-events: none; filter: grayscale(100%); }

/* TAGS & INPUTS */
.field-group { margin-bottom: 16px; }
.field-label { font-size: 0.72rem; font-weight: 700; color: var(--text-2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.field-input { width: 100% !important; max-width: 100% !important; border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text-1) !important; font-size: 0.95rem; outline: none; font-family: inherit; transition: all 0.25s ease; box-sizing: border-box !important; display: block !important; -webkit-appearance: none; appearance: none; }
.field-input:focus { background: rgba(255, 255, 255, 0.05) !important; border-color: var(--primary-light) !important; box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important; }
.date-input { width: 100%; display: block; box-sizing: border-box; -webkit-appearance: none; }

.tag-input-container { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 44px; align-items: center; }
.tag-input-field { border: none; background: transparent; outline: none; color: var(--text-1); flex: 1; min-width: 120px; font-size: 0.85rem; font-family: inherit; }
.tag-badge { background: var(--primary); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.keyword-tag { display: inline-block; background: var(--bg-card2); padding: 6px 12px; border-radius: 12px; font-size: 0.75rem; color: var(--text-1); margin: 0 6px 6px 0; border: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s; }
.keyword-tag:hover { border-color: var(--balance); }
.keyword-group-card { padding: 0; margin-bottom: 12px; flex-direction: column; overflow: hidden; align-items: stretch; }
.accordion-header { padding: 14px; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; }
.accordion-body { padding: 0 14px 14px 14px; flex-wrap: wrap; width: 100%; border-top: 1px solid var(--border-color); padding-top: 14px; }

.input-with-btn-wrapper { display: flex; width: 100%; align-items: center; }
.btn-icon-picker { background: transparent; color: var(--primary); border: none; border-radius: 8px; padding: 0 16px; margin-left: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; height: 100%; }

.type-row { display: flex; gap: 10px; }
.type-pill { flex: 1; padding: 14px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.95rem; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.type-pill:hover:not(.expense-active):not(.income-active) { background: var(--bg-card2) !important; border-color: var(--primary-alpha) !important; transform: translateY(-1px); }
.type-pill:active { transform: scale(0.97); }
.type-pill.expense-active { background: var(--expense-bg) !important; color: var(--expense); border-color: rgba(255, 68, 68, 0.4) !important; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(255, 68, 68, 0.15); }
.type-pill.income-active { background: var(--income-bg) !important; color: var(--income); border-color: rgba(0, 210, 106, 0.4) !important; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0, 210, 106, 0.15); }

/* ==========================================
   BUTTONS
   ========================================== */
.modal-actions { display: flex; gap: 12px; margin-top: 24px; align-items: center; flex-shrink: 0;}
.btn-cancel, .btn-save, .btn-full { flex: 1; width: 100%; padding: 14px 6px; border-radius: var(--radius-md); font-weight: 800; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.btn-full { margin-top: 8px; }

.btn-save { background: var(--grad-primary); border: none; color: white; box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2); }
.btn-save:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(6, 182, 212, 0.35); filter: brightness(1.1); }
.btn-save:active { transform: scale(0.96); box-shadow: 0 2px 10px rgba(6, 182, 212, 0.2); filter: brightness(0.9); }

.btn-cancel:hover { background: var(--bg-card2) !important; color: var(--text-1); border-color: rgba(255,255,255,0.15) !important; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn-cancel:active { transform: scale(0.96); }

.btn-back { padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; color: var(--text-1); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.25s ease;}
.btn-back:hover { background: var(--bg-card2) !important; transform: translateX(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-color: rgba(255,255,255,0.15) !important; }
.btn-back:active { transform: scale(0.95); }

.btn-soft { flex: 1; width: 100%; padding: 14px; border-radius: var(--radius-md); font-weight: 800; color: var(--text-1); cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 0; }
.btn-soft:hover { background: var(--bg-card2) !important; border-color: var(--primary-light) !important; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.btn-soft:active { transform: scale(0.96); }

.btn-danger-outline { padding: 14px; background: rgba(255, 68, 68, 0.1); color: var(--expense); border: 1px solid transparent; border-radius: var(--radius-md); font-weight: 800; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px;}
.btn-danger-outline:hover { background: rgba(255, 68, 68, 0.15); border-color: rgba(255, 68, 68, 0.3); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255, 68, 68, 0.1); filter: brightness(1.1); }
.btn-danger-outline:active { transform: scale(0.96); }

.btn-edit-kw { background: var(--balance) !important; color: white !important; box-shadow: 0 4px 15px rgba(255, 184, 0, 0.2) !important; }
.btn-edit-kw:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255, 184, 0, 0.35) !important; filter: brightness(1.1); }


/* ==========================================
   PREMIUM TOAST NOTIFICATION (GLASSMORPHISM)
   ========================================== */
.premium-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: var(--bg-card);
    backdrop-filter: var(--glass-effect);
    -webkit-backdrop-filter: var(--glass-effect);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 280px;
    max-width: 90%;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.premium-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon { font-size: 1.5rem; flex-shrink: 0; }
.toast-message { font-size: 0.95rem; font-weight: 600; color: var(--text-1); flex: 1; }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 3px; width: 100%; animation: premiumToastProgress 3s linear forwards; }

@keyframes premiumToastProgress { from { width: 100%; } to { width: 0%; } }

.toast-success .toast-icon { color: #10B981; }
.toast-success .toast-progress { background: #10B981; }
.toast-error .toast-icon { color: #F43F5E; }
.toast-error .toast-progress { background: #F43F5E; }
.toast-info .toast-icon { color: #0EA5E9; }
.toast-info .toast-progress { background: #0EA5E9; }


/* ==========================================
   CUSTOM CONFIRM MODAL
   ========================================== */
.custom-confirm-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 999999; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.custom-confirm-modal { background: var(--bg-card); width: 85%; max-width: 320px; border-radius: 20px; box-shadow: 0 15px 35px rgba(0,0,0,0.25); transform: scale(0.9); opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); overflow: hidden; display: flex; flex-direction: column; }
.custom-confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(244,63,94,0.1); color: #f43f5e; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 16px; }
.custom-confirm-title { margin: 0 0 10px; font-size: 1.15rem; color: var(--text-1); font-family: 'Plus Jakarta Sans', sans-serif; text-align: center; }
.custom-confirm-message { margin: 0; font-size: 0.95rem; color: var(--text-2); line-height: 1.5; font-family: 'Plus Jakarta Sans', sans-serif; text-align: center; padding: 0 20px 20px; }
.custom-confirm-actions { display: flex; border-top: 1px solid var(--border-color); }
.custom-confirm-cancel { flex: 1; padding: 16px; background: transparent; border: none; border-right: 1px solid var(--border-color); color: var(--text-2); font-weight: 600; font-size: 1rem; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: 0.2s; }
.custom-confirm-cancel:hover { background: rgba(255,255,255,0.05); }
.custom-confirm-ok { flex: 1; padding: 16px; background: transparent; border: none; color: #f43f5e; font-weight: 800; font-size: 1rem; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: 0.2s; }
.custom-confirm-ok:hover { background: rgba(244,63,94,0.1); }

/* Nút xóa Modal Alert */
.btn-danger { background: var(--expense); color: white; border: none; padding: 14px; border-radius: var(--radius-md); font-weight: 800; flex: 1; cursor: pointer; transition: all 0.25s ease; box-shadow: 0 4px 15px rgba(255, 68, 68, 0.2); }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255, 68, 68, 0.35); filter: brightness(1.1); }
.btn-danger:active { transform: scale(0.96); box-shadow: 0 2px 10px rgba(255, 68, 68, 0.2); }

.pagination-container { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; }
.pagination-btn { padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; transition: all 0.25s ease;}
.pagination-btn:hover:not(:disabled) { background: var(--bg-card2) !important; color: var(--primary-light); border-color: var(--primary-alpha) !important; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.pagination-btn:active:not(:disabled) { transform: scale(0.95); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-info { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }

.info-card { margin-bottom: 16px; border-radius: var(--radius-lg); transition: all 0.3s ease; padding: 20px;}
.info-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-color: rgba(255,255,255,0.1); }
.info-card .chart-title { margin-bottom: 8px; }
.info-text { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.info-list { font-size: 0.85rem; display: flex; flex-direction: column; gap: 6px; }
.info-list i { color: var(--primary-light); width: 20px; }
.info-list strong { color: var(--text-1); }

.qr-container { text-align: center; padding: 20px 16px; margin-bottom: 20px; transition: transform 0.3s ease; }
.qr-container:hover { transform: scale(1.02); }
.qr-box { background: rgba(255, 255, 255, 0.8); backdrop-filter: var(--glass-effect); -webkit-backdrop-filter: var(--glass-effect); padding: 20px; display: inline-block; border-radius: var(--radius-xl); box-shadow: 0 10px 30px rgba(0,0,0,0.15); width: 100%; max-width: 280px; box-sizing: border-box; }
.qr-image { width: 100%; height: auto; max-width: 240px; border-radius: 12px; display: block; margin: 0 auto; aspect-ratio: 1/1; object-fit: contain; }

select.field-input { background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important; background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 16px !important; padding-right: 36px !important; cursor: pointer; }
.app-branding { text-align: center; font-size: 0.85rem; font-weight: 800; color: var(--text-2); padding-top: 8px; margin-bottom: -12px; letter-spacing: 0.02em; }

/* BOTTOM NAV GLASSMORPHISM */
.bottom-nav { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 450px; height: 64px; background: rgba(15, 23, 42, 0.65) !important; backdrop-filter: var(--glass-effect) !important; -webkit-backdrop-filter: var(--glass-effect) !important; border-radius: 32px !important; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255,255,255,0.1) !important; border: 1px solid rgba(255, 255, 255, 0.15) !important; display: flex; justify-content: space-around; align-items: center; padding: 0 12px; z-index: 1000; }
@media (prefers-color-scheme: light) {
    .bottom-nav { background: rgba(255, 255, 255, 0.75) !important; }
}

.bottom-nav::before, .bottom-nav::after { display: none !important; }
.nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; border: none; cursor: pointer; min-width: 60px; height: 54px; border-radius: 27px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.nav-icon-wrap { width: 32px; height: 32px; min-width: 32px; min-height: 32px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--text-2); background: transparent; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.nav-label { font-size: 0.65rem; font-weight: 700; color: var(--text-2); transition: all 0.3s ease; }

.nav-btn:hover .nav-icon-wrap { color: var(--primary-light); background: rgba(255,255,255,0.05); transform: translateY(-2px) scale(1.1); }
.nav-btn:hover .nav-label { color: var(--primary-light); }
.nav-btn:active { transform: scale(0.9); }

.nav-btn.active { background: transparent !important; }
.nav-btn.active .nav-icon-wrap { background: var(--primary-alpha) !important; color: var(--primary-light) !important; transform: translateY(-2px); box-shadow: 0 4px 10px var(--primary-alpha); }
.nav-btn.active .nav-label { color: var(--primary-light) !important; font-weight: 800; }

.slide-in-right { animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.slide-out-right { animation: slideOutRight 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.fade-in-view { animation: fadeInView 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
@keyframes fadeInView { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
