/* ============================
   CSS VARIABLES & THEMES
   ============================ */
:root {
    --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 56px;
    --header-height: 60px;
    --max-width: 100%;
    /* accent palette */
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --income-color: #00b894;
    --expense-color: #e17055;
    --accent-blue: #0984e3;
    --accent-blue-bg: rgba(9,132,227,0.12);
    --accent-orange: #e17055;
    --accent-orange-bg: rgba(225,112,85,0.12);
    --accent-purple: #6c5ce7;
    --accent-purple-bg: rgba(108,92,231,0.12);
}

[data-theme="dark"] {
    --bg: #0f0f23;
    --bg-secondary: #1a1a3e;
    --surface: rgba(255,255,255,0.06);
    --surface-hover: rgba(255,255,255,0.1);
    --border: rgba(255,255,255,0.08);
    --text: #f0f0f5;
    --text-secondary: #9e9eb8;
    --text-muted: #6c6c8a;
    --glass-bg: rgba(255,255,255,0.05);
    --glass-border: rgba(255,255,255,0.1);
    --glass-shadow: 0 8px 32px rgba(0,0,0,0.3);
    --modal-bg: #1e1e3f;
    --input-bg: rgba(255,255,255,0.06);
    --nav-bg: rgba(15,15,35,0.92);
    --card-gradient: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(162,155,254,0.05));
    --danger: #ff4757;
    --danger-bg: rgba(255,71,87,0.1);
}

[data-theme="light"] {
    --bg: #f5f6fa;
    --bg-secondary: #ffffff;
    --surface: rgba(0,0,0,0.03);
    --surface-hover: rgba(0,0,0,0.06);
    --border: rgba(0,0,0,0.08);
    --text: #1a1a2e;
    --text-secondary: #666680;
    --text-muted: #999;
    --glass-bg: rgba(255,255,255,0.65);
    --glass-border: rgba(255,255,255,0.5);
    --glass-shadow: 0 8px 32px rgba(0,0,0,0.08);
    --modal-bg: #ffffff;
    --input-bg: rgba(0,0,0,0.04);
    --nav-bg: rgba(255,255,255,0.92);
    --card-gradient: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(162,155,254,0.03));
    --danger: #e74c3c;
    --danger-bg: rgba(231,76,60,0.1);
}

/* ============================
   RESET & BASE
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

input, select, button, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    border: none;
    background: none;
}

button { cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ============================
   SPLASH SCREEN
   ============================ */
.splash {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-content { text-align: center; }
.splash-icon {
    font-size: 64px;
    animation: bounce 1s ease infinite;
}
.splash-content h1 {
    font-size: 32px; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 12px;
}
.splash-content p { color: var(--text-secondary); margin-top: 4px; }
.splash-loader {
    width: 40px; height: 4px; margin: 24px auto 0;
    background: var(--surface); border-radius: 2px; overflow: hidden;
}
.splash-loader div {
    width: 60%; height: 100%; border-radius: 2px;
    background: var(--accent);
    animation: loading 1.2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* ============================
   APP CONTAINER
   ============================ */
.app {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
}
.app.hidden { display: none; }

/* ============================
   HEADER
   ============================ */
.header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    height: var(--header-height);
    background: var(--nav-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.header-title {
    font-size: 22px; font-weight: 700;
}
.header-right { display: flex; gap: 6px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); transition: background var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); }

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

/* ============================
   SEARCH BAR
   ============================ */
.search-bar {
    padding: 12px 20px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.3s ease;
}
.search-bar.hidden { display: none; }
.search-input-wrap {
    display: flex; align-items: center; gap: 8px;
    background: var(--input-bg); border-radius: var(--radius-sm);
    padding: 10px 14px; border: 1px solid var(--border);
}
.search-input-wrap input {
    flex: 1; background: none; font-size: 15px;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-close {
    font-size: 20px; color: var(--text-muted);
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
}
.search-filters {
    display: flex; gap: 8px; margin-top: 10px;
}
.search-filters select, .search-filters input {
    flex: 1; padding: 8px 12px; border-radius: var(--radius-xs);
    background: var(--input-bg); border: 1px solid var(--border);
    font-size: 13px; color: var(--text);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   PAGES
   ============================ */
.pages {
    padding: 16px 20px;
    padding-bottom: calc(var(--nav-height) + 24px);
}
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   GLASS CARD
   ============================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--glass-shadow);
    margin-bottom: 16px;
    transition: background var(--transition), border var(--transition);
}

/* ============================
   BALANCE CARD
   ============================ */
.balance-card {
    background: var(--card-gradient);
    text-align: center; padding: 28px 20px;
}
.balance-label { color: var(--text-secondary); font-size: 14px; }
.balance-amount {
    font-size: 40px; font-weight: 800; margin: 8px 0 20px;
    background: linear-gradient(135deg, var(--text), var(--accent-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.balance-row {
    display: flex; align-items: center; justify-content: center; gap: 0;
}
.balance-item {
    display: flex; align-items: center; gap: 10px;
    flex: 1; justify-content: center;
}
.balance-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.income .balance-icon { background: rgba(0,184,148,0.15); color: var(--income-color); }
.expense .balance-icon { background: rgba(225,112,85,0.15); color: var(--expense-color); }
.balance-sub-label { font-size: 12px; color: var(--text-muted); text-align: left; }
.balance-sub-amount { font-size: 16px; font-weight: 700; text-align: left; }
.income .balance-sub-amount { color: var(--income-color); }
.expense .balance-sub-amount { color: var(--expense-color); }
.divider-v { width: 1px; height: 40px; background: var(--border); margin: 0 8px; }

/* ============================
   QUICK STATS
   ============================ */
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { text-align: center; padding: 14px 8px; }
.stat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
}
.stat-value { font-size: 16px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================
   CARD HEADERS
   ============================ */
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.badge {
    font-size: 11px; padding: 4px 10px; border-radius: 20px;
    background: var(--accent); color: #fff; font-weight: 600;
}
.text-btn {
    font-size: 13px; color: var(--accent); font-weight: 600;
    transition: opacity var(--transition);
}
.text-btn:hover { opacity: 0.7; }

/* ============================
   CHART CARD
   ============================ */
.chart-card { position: relative; }
.chart-card canvas { width: 100% !important; max-height: 260px; }

/* ============================
   BUDGET
   ============================ */
.progress-bar {
    height: 8px; border-radius: 4px; background: var(--surface);
    overflow: hidden; margin-bottom: 8px;
}
.progress-fill {
    height: 100%; border-radius: 4px; transition: width 0.6s ease;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.progress-fill.warning { background: linear-gradient(90deg, #fdcb6e, #e17055); }
.progress-fill.danger { background: linear-gradient(90deg, #e17055, #d63031); }
.budget-percent { font-size: 14px; font-weight: 700; color: var(--accent); }
.budget-text { font-size: 13px; color: var(--text-secondary); }

/* ============================
   GOALS
   ============================ */
.goals-list { display: flex; flex-direction: column; gap: 12px; }
.goal-item {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px; border-radius: var(--radius-sm);
    background: var(--surface); position: relative;
}
.goal-top { display: flex; justify-content: space-between; align-items: center; }
.goal-name { font-size: 14px; font-weight: 600; }
.goal-amount { font-size: 12px; color: var(--text-secondary); }
.goal-progress {
    height: 6px; border-radius: 3px; background: var(--border); overflow: hidden;
}
.goal-progress-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--income-color), #55efc4);
    transition: width 0.6s ease;
}
.goal-delete {
    position: absolute; top: 8px; right: 8px;
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--text-muted);
    opacity: 0; transition: opacity var(--transition);
}
.goal-item:hover .goal-delete { opacity: 1; }

/* ============================
   TRANSACTIONS LIST
   ============================ */
.transactions-list { display: flex; flex-direction: column; gap: 8px; }
.tx-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius-sm);
    background: var(--surface); transition: background var(--transition);
    cursor: pointer; position: relative;
}
.tx-item:hover { background: var(--surface-hover); }
.tx-item:active { transform: scale(0.98); }
.tx-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.tx-details { flex: 1; min-width: 0; }
.tx-category { font-size: 14px; font-weight: 600; }
.tx-note { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.income { color: var(--income-color); }
.tx-amount.expense { color: var(--expense-color); }
.tx-date { font-size: 11px; color: var(--text-muted); }

.tx-actions {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition);
}
.tx-item:hover .tx-actions { opacity: 1; }
.tx-action-btn {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); font-size: 14px;
    transition: background var(--transition);
}
.tx-action-btn:hover { background: var(--surface-hover); }
.tx-action-btn.delete:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================
   TRANSACTION TABS
   ============================ */
.tx-header { margin-bottom: 16px; }
.tx-tabs { display: flex; gap: 8px; }
.tx-tab {
    padding: 8px 18px; border-radius: 20px; font-size: 14px; font-weight: 600;
    background: var(--surface); color: var(--text-secondary);
    transition: all var(--transition);
}
.tx-tab.active { background: var(--accent); color: #fff; }

/* ============================
   ANALYTICS
   ============================ */
.analytics-period {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.period-btn {
    flex: 1; padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    background: var(--surface); color: var(--text-secondary); text-align: center;
    transition: all var(--transition);
}
.period-btn.active { background: var(--accent); color: #fff; }

.insights-card h3 { margin-bottom: 14px; }
.insights-list { display: flex; flex-direction: column; gap: 10px; }
.insight-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px; border-radius: var(--radius-xs); background: var(--surface);
}
.insight-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.insight-text { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* ============================
   CONVERTER
   ============================ */
.converter-card { text-align: center; }
.converter-card h3 { margin-bottom: 20px; }
.converter-input-group { text-align: left; margin-bottom: 8px; }
.converter-input-group label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: block; }
.converter-row { display: flex; gap: 10px; }
.converter-row input, .converter-row select {
    flex: 1; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--input-bg); border: 1px solid var(--border);
    font-size: 16px; font-weight: 600; color: var(--text);
    transition: border var(--transition);
}
.converter-row input:focus, .converter-row select:focus {
    border-color: var(--accent);
}
.swap-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    margin: 8px auto; transition: transform var(--transition);
}
.swap-btn:hover { transform: rotate(180deg); }
.rate-info { font-size: 15px; font-weight: 600; margin-top: 16px; color: var(--accent); }
.rate-update { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.rates-table { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border-radius: var(--radius-xs); background: var(--surface);
}
.rate-currency { font-weight: 600; font-size: 14px; }
.rate-value { font-size: 14px; color: var(--text-secondary); }

/* ============================
   SETTINGS
   ============================ */
.settings-group h3 { margin-bottom: 16px; font-size: 16px; }
.setting-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 0; }
.setting-label { font-size: 15px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.setting-select, .setting-input {
    padding: 8px 12px; border-radius: var(--radius-xs);
    background: var(--input-bg); border: 1px solid var(--border);
    font-size: 14px; color: var(--text); max-width: 120px; text-align: right;
}
.setting-item.clickable { cursor: pointer; transition: background var(--transition); border-radius: var(--radius-xs); padding: 12px; margin: -12px 0; margin-bottom: 0; }
.setting-item.clickable:hover { background: var(--surface-hover); }
.setting-item.danger .setting-label { color: var(--danger); }
.about-info { text-align: center; padding: 8px 0; }
.about-info p { margin-bottom: 4px; }
.about-copy { color: var(--text-muted); font-size: 13px; }

/* Toggle Switch */
.toggle { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-slider {
    position: absolute; inset: 0; border-radius: 14px; cursor: pointer;
    background: var(--surface); transition: background var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; left: 3px; top: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--text-muted); transition: all var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* ============================
   FAB BUTTON
   ============================ */
.fab {
    position: fixed; bottom: calc(var(--nav-height) + 16px);
    left: 50%; transform: translateX(-50%);
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff; box-shadow: 0 4px 20px rgba(108,92,231,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 90; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fab:hover { transform: translateX(-50%) scale(1.08); box-shadow: 0 6px 28px rgba(108,92,231,0.5); }
.fab:active { transform: translateX(-50%) scale(0.95); }

/* ============================
   BOTTOM NAVIGATION
   ============================ */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--max-width);
    height: var(--nav-height);
    display: flex; align-items: center; justify-content: space-around;
    background: var(--nav-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}
.nav-item {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 0; flex: 1;
    color: var(--text-muted); transition: color var(--transition);
    position: relative;
}
.nav-item.active { color: var(--accent); }
.nav-item span { font-size: 11px; font-weight: 600; }
.nav-item::after {
    content: ''; position: absolute; top: -1px;
    width: 20px; height: 3px; border-radius: 0 0 3px 3px;
    background: var(--accent); opacity: 0; transition: opacity var(--transition);
}
.nav-item.active::after { opacity: 1; }
.nav-spacer { width: 56px; }

/* ============================
   MODAL
   ============================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    width: 100%; max-width: var(--max-width);
    max-height: 90dvh; overflow-y: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px 20px 32px;
    background: var(--modal-bg);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-sm { max-width: 360px; border-radius: var(--radius); align-self: center; text-align: center; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.modal-close { font-size: 28px; color: var(--text-muted); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: center; }
#alertMessage { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 0 8px; }

/* ============================
   FORM
   ============================ */
.form-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.form-tab {
    flex: 1; padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    background: var(--surface); color: var(--text-secondary); text-align: center;
    transition: all var(--transition);
}
.form-tab.active { background: var(--accent); color: #fff; }

.form-group { margin-bottom: 18px; }
.form-group label { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: block; color: var(--text-secondary); }

.amount-input {
    display: flex; align-items: center;
    background: var(--input-bg); border-radius: var(--radius-sm);
    padding: 4px 14px; border: 2px solid var(--border);
    transition: border var(--transition);
}
.amount-input:focus-within { border-color: var(--accent); }
.currency-symbol { font-size: 22px; font-weight: 700; color: var(--accent); margin-right: 8px; }
.amount-input input {
    flex: 1; padding: 12px 0; font-size: 24px; font-weight: 700;
    background: none;
}
.amount-input input::placeholder { color: var(--text-muted); }

.form-group input[type="date"],
.form-group input[type="text"] {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--input-bg); border: 2px solid var(--border);
    font-size: 15px; transition: border var(--transition);
}
.form-group input:focus { border-color: var(--accent); }

/* Category Grid */
.category-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.cat-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; border-radius: var(--radius-sm); cursor: pointer;
    background: var(--surface); transition: all var(--transition);
    border: 2px solid transparent;
}
.cat-item.active { border-color: var(--accent); background: rgba(108,92,231,0.1); }
.cat-item:hover { background: var(--surface-hover); }
.cat-emoji { font-size: 22px; }
.cat-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; }

/* Buttons */
.btn-primary {
    width: 100%; padding: 14px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff; font-size: 16px; font-weight: 700;
    transition: opacity var(--transition), transform 0.15s ease;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
    padding: 10px 24px; border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
    transition: background var(--transition);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); }

/* ============================
   TOAST
   ============================ */
.toast {
    position: fixed; bottom: calc(var(--nav-height) + 80px);
    left: 50%; transform: translateX(-50%) translateY(20px);
    padding: 12px 24px; border-radius: var(--radius-sm);
    background: var(--text); color: var(--bg);
    font-size: 14px; font-weight: 600;
    opacity: 0; visibility: hidden; z-index: 300;
    transition: all 0.3s ease; white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
    text-align: center; padding: 24px;
    color: var(--text-muted); font-size: 14px;
}

/* ============================
   SCROLLBAR
   ============================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

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

/* Small phones */
@media (max-width: 360px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-stats { grid-template-columns: repeat(2, 1fr); }
    .quick-stats .stat-card:last-child { grid-column: span 2; }
    .balance-amount { font-size: 32px; }
    .pages { padding: 12px 14px; padding-bottom: calc(var(--nav-height) + 20px); }
    .converter-row { flex-direction: column; }
}

/* Tablets (768px+) */
@media (min-width: 768px) {
    .pages { padding: 24px 32px; padding-bottom: calc(var(--nav-height) + 32px); max-width: 760px; margin: 0 auto; }
    .header { padding: 14px 32px; }

    .balance-card { padding: 36px 32px; }
    .balance-amount { font-size: 48px; }
    .balance-sub-amount { font-size: 20px; }

    .quick-stats { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .stat-card { padding: 20px 12px; }
    .stat-value { font-size: 20px; }

    .glass-card { padding: 24px; margin-bottom: 20px; border-radius: 20px; }
    .card-header h3 { font-size: 18px; }

    .category-grid { grid-template-columns: repeat(5, 1fr); gap: 10px; }
    .cat-item { padding: 14px 8px; }

    .transactions-list { gap: 10px; }
    .tx-item { padding: 16px; border-radius: 14px; }
    .tx-icon { width: 48px; height: 48px; font-size: 24px; }
    .tx-category { font-size: 16px; }
    .tx-amount { font-size: 17px; }

    .converter-row input, .converter-row select { padding: 14px 16px; font-size: 18px; }
    .swap-btn { width: 50px; height: 50px; }
    .rates-table { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .rate-item { padding: 14px 16px; }

    .setting-item { padding: 16px 0; }
    .setting-label { font-size: 16px; }

    .insights-list { gap: 12px; }
    .insight-item { padding: 14px; }
    .insight-text { font-size: 14px; }

    .bottom-nav { max-width: 760px; border-radius: 20px 20px 0 0; }
    .fab { bottom: calc(var(--nav-height) + 20px); width: 62px; height: 62px; }

    .modal { max-width: 520px; padding: 28px 28px 36px; }
    .amount-input input { font-size: 28px; }
    .form-group label { font-size: 15px; }
}

/* Large tablets / small desktops (1024px+) */
@media (min-width: 1024px) {
    .pages { max-width: 900px; padding: 28px 40px; padding-bottom: calc(var(--nav-height) + 40px); }
    .header { max-width: 900px; margin: 0 auto; padding: 14px 40px; }

    .balance-card { display: flex; flex-direction: column; align-items: center; padding: 44px 40px; }
    .balance-amount { font-size: 56px; }
    .balance-row { gap: 40px; }
    .balance-sub-amount { font-size: 22px; }

    .quick-stats { gap: 20px; }
    .stat-card { padding: 24px 16px; }
    .stat-value { font-size: 22px; }

    .category-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; }
    .cat-item { padding: 16px 10px; }
    .cat-emoji { font-size: 26px; }
    .cat-label { font-size: 12px; }

    .rates-table { grid-template-columns: repeat(4, 1fr); }

    .bottom-nav { max-width: 900px; }
    .modal { max-width: 560px; }

    /* Two-column layout for analytics charts */
    #analyticsPage .chart-card { display: inline-block; vertical-align: top; }
}

/* Full-list scrollable */
.full-list {
    max-height: calc(100dvh - var(--header-height) - var(--nav-height) - 120px);
    overflow-y: auto; padding-bottom: 20px;
}
