:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 20px 25px -5px rgba(0,0,0,0.05);
    --banner-grad: linear-gradient(135deg, var(--primary) 0%, rgba(0,0,0,0.15) 100%);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
    --bg: #090d16;
    --card: #121826;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --banner-grad: linear-gradient(135deg, var(--card) 0%, #090d16 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0; padding: 0;
    display: flex; justify-content: center;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.container { 
    width: 100%; 
    max-width: 600px; 
    padding: 16px 16px calc(85px + var(--safe-bottom)) 16px;
    box-sizing: border-box;
}

/* Top Header Area */
.app-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.app-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.header-controls { display: flex; align-items: center; gap: 10px; }
.backup-status { font-size: 11px; font-weight: 700; color: #10b981; padding: 4px 8px; background: rgba(16, 185, 129, 0.1); border-radius: 8px; display: none;}

/* Banner Component */
.banner {
    background: var(--banner-grad);
    background-color: var(--primary);
    color: white; padding: 1.5rem; border-radius: 20px;
    margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow);
}
.banner-label { margin:0; opacity:0.8; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.banner-amount { margin:4px 0 0 0; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.banner-stats { text-align: right; }
.entry-count { font-size:20px; font-weight:800; }
.stats-label { margin:0; opacity:0.8; font-size: 10px; font-weight: 700; }

.card {
    background: var(--card); padding: 1.25rem; border-radius: 20px;
    box-shadow: var(--shadow); margin-bottom: 16px;
    border: 1px solid var(--border);
}

/* Dashboard Items */
.dashboard-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; }
@media (max-width: 480px) { .dashboard-grid { grid-template-columns: 1fr; } }
.chart-container { height: 160px; }
.summary-card { display:flex; align-items:center; padding: 10px 14px; }
.summary-table { width:100%; border-collapse: collapse; font-size: 12px; }

/* Filters Layout */
.filter-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.search-wrapper { position: relative; width: 100%; }
.search-wrapper input { padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none;}
.date-range-container { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

input, select { 
    padding: 12px; border: 1px solid var(--border); border-radius: 12px; 
    background: var(--card); color: var(--text-main); width: 100%; 
    box-sizing: border-box; outline: none; font-size: 15px;
    transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--primary); }

/* TX LIST */
.transaction-list { display: flex; flex-direction: column; gap: 10px; }
.tx-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: var(--card); border-radius: 16px;
    border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.tx-info { display: flex; flex-direction: column; gap: 2px;}
.tx-desc { font-weight: 600; font-size: 15px; letter-spacing: -0.2px; }
.tx-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.tag { background: var(--bg); color: var(--text-main); padding: 2px 6px; border-radius: 6px; font-weight: 600; text-transform: uppercase; font-size: 9px; border: 1px solid var(--border); }
.tx-amount { font-weight: 700; font-size: 16px; color: var(--text-main); }
.btn-del { color: #94a3b8; border: none; background: none; cursor: pointer; font-size: 20px; padding: 4px 8px; margin-left: 4px; }

/* Floating Action Button */
.fab {
    position: fixed; bottom: 80px; right: 20px;
    width: 56px; height: 56px; border-radius: 28px;
    background: var(--primary); color: white; border: none;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    font-size: 28px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 99; transition: transform 0.2s ease;
    margin-bottom: var(--safe-bottom);
}
.fab:active { transform: scale(0.92); }

/* Sticky Bottom Navigation Bar */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card); border-top: 1px solid var(--border);
    height: 64px; display: flex; justify-content: space-around; align-items: center;
    padding-bottom: var(--safe-bottom); z-index: 98;
}
.nav-item {
    background: none; border: none; color: var(--text-muted);
    font-size: 11px; font-weight: 600; display: flex; flex-direction: column;
    align-items: center; gap: 4px; cursor: pointer; width: 60px;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; }

/* Native Slide-Up Modal Sheet CSS */
.modal-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.4); z-index: 100; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card); border-top-left-radius: 24px; border-top-right-radius: 24px;
    padding: 24px 20px calc(24px + var(--safe-bottom)) 20px; z-index: 101;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
    box-shadow: 0 -8px 30px rgba(0,0,0,0.08);
}
.modal-open .modal-overlay { opacity: 1; pointer-events: auto; }
.modal-open .modal-sheet { transform: translateY(0); }
.modal-handle { width: 36px; height: 5px; background: var(--border); border-radius: 3px; margin: -12px auto 20px auto; }
.modal-title { margin: 0 0 16px 0; font-size: 18px; font-weight: 700; text-align: center; }

/* Forms UI Elements */
.form-layout { display: flex; flex-direction: column; gap: 12px; }
.input-amount { font-size: 24px; text-align: center; font-weight: 700; padding: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-add { background: var(--primary); color: white; border: none; padding: 14px; width: 100%; border-radius: 14px; font-weight: 700; cursor: pointer; font-size: 16px; margin-top: 8px;}

/* Color Picker Custom Styles */
.color-picker-wrapper { width: 32px; height: 32px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px var(--border); overflow: hidden; position: relative; }
.color-picker-wrapper input[type="color"] { position: absolute; top: -10px; left: -10px; width: 50px; height: 50px; border: none; cursor: pointer; background: transparent; }

#importFile { display: none; }
