/* ═══════════════════════════════════════════════════════════════════════════
   REDESIGN V5.0 - CLEAN MINIMAL MODERN
   ═══════════════════════════════════════════════════════════════════════════ */

/* Глобальный отступ для Telegram header */
.app-container {
    padding-top: 50px;
}

/* Modern Header - Clean */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 16px;
    background: transparent;
}

.user-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-avatar-glow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.greeting-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon-glass {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s;
}

.btn-icon-glass:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Balance Hero - Clean Minimal */
.balance-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 40px;
    text-align: center;
}

.balance-label {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 44px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.balance-trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--green-soft);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    margin-bottom: 32px;
}

/* Stats Row - Clean Cards */
.stats-floating-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.stat-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.2s;
}

.stat-pill:active {
    transform: scale(0.98);
}

.pill-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-pill.income .pill-icon {
    background: var(--green-soft);
    color: var(--green);
}

.stat-pill.expense .pill-icon {
    background: var(--red-soft);
    color: var(--red);
}

.pill-data {
    display: flex;
    flex-direction: column;
}

.pill-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.pill-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stats Cards - Modern Design */
.stats-cards {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.stat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.05));
    border-color: rgba(34, 197, 94, 0.3);
    position: relative;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-card-icon.blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.1));
    color: #60a5fa;
}

.stat-card-icon.orange {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(249, 115, 22, 0.1));
    color: #fb923c;
}

.stat-card-icon.green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.1));
    color: #22c55e;
}

.stat-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-card-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-card-trend {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    opacity: 0.8;
}

.stat-card-trend.positive {
    color: #22c55e;
}

.stat-card-trend.negative {
    color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUDGET WIDGET - MODERN DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

.budget-widget {
    margin: 0 20px 20px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    position: relative;
}

/* Мини-версия виджета для главной страницы */
.budget-widget.budget-widget-mini {
    padding: 12px 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.budget-widget.budget-widget-mini:active {
    transform: scale(0.98);
}

.budget-widget.budget-widget-mini .budget-widget-header {
    margin-bottom: 10px;
}

.budget-widget.budget-widget-mini .budget-progress-bar {
    height: 6px;
    margin-bottom: 6px;
}

.budget-widget.budget-widget-mini .budget-progress-info {
    font-size: 13px;
    justify-content: center;
    gap: 4px;
}

.budget-widget.budget-widget-mini .budget-progress-container {
    margin-bottom: 0;
}

.budget-widget.on_track {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), var(--bg-card));
}

.budget-widget.warning {
    border-color: rgba(251, 146, 60, 0.4);
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.08), var(--bg-card));
}

.budget-widget.over_budget {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--bg-card));
}

.budget-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.budget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.budget-title i {
    color: var(--accent);
}

.budget-month {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.budget-progress-container {
    margin-bottom: 12px;
}

.budget-progress-bar {
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.budget-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 5px;
    transition: width 0.5s ease, background 0.3s ease;
}

.budget-widget.warning .budget-progress-fill {
    background: linear-gradient(90deg, #fb923c, #f97316);
}

.budget-widget.over_budget .budget-progress-fill {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.budget-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-spent {
    font-size: 14px;
    color: var(--text-primary);
}

.budget-spent span:first-child {
    font-weight: 600;
}

.budget-separator {
    color: var(--text-muted);
    margin: 0 4px;
}

.budget-percentage {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
}

.budget-widget.warning .budget-percentage {
    color: #fb923c;
}

.budget-widget.over_budget .budget-percentage {
    color: #ef4444;
}

.budget-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.budget-remaining {
    display: flex;
    align-items: center;
    gap: 6px;
}

.budget-remaining-label {
    font-size: 12px;
    color: var(--text-muted);
}

.budget-remaining-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.budget-widget.over_budget .budget-remaining-value {
    color: #ef4444;
}

.budget-edit-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.budget-edit-btn:hover {
    background: var(--accent);
    color: white;
}

.budget-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.budget-empty i {
    font-size: 20px;
    color: var(--accent);
}

.budget-empty:hover {
    color: var(--accent);
}

/* Budget Modal Specific Styles */
.input-with-suffix {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.input-with-suffix input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-with-suffix input:focus {
    outline: none;
}

.input-suffix {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-muted);
    border-left: 1px solid var(--border);
}

.budget-presets-section {
    margin: 16px 0;
}

.budget-presets-section label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.budget-preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.budget-preset-btn {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.budget-preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.budget-preset-btn:active {
    transform: scale(0.95);
}

.budget-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.budget-hint i {
    color: #f59e0b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUDGETS SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.budget-current-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.budget-current-card.on_track {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), var(--bg-card));
}

.budget-current-card.warning {
    border-color: rgba(251, 146, 60, 0.4);
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.08), var(--bg-card));
}

.budget-current-card.over_budget {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--bg-card));
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.budget-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.budget-card-title i {
    color: var(--accent);
}

.budget-card-status {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.budget-current-card.warning .budget-card-status {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.budget-current-card.over_budget .budget-card-status {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.budget-card-progress {
    margin-bottom: 16px;
}

.budget-card-bar {
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.budget-card-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.budget-current-card.warning .budget-card-fill {
    background: linear-gradient(90deg, #fb923c, #f97316);
}

.budget-current-card.over_budget .budget-card-fill {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.budget-card-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
}

.budget-card-numbers span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.budget-card-numbers span:last-child {
    color: var(--text-muted);
}

.budget-card-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.budget-card-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.budget-card-stat .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.budget-card-stat .stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.budget-card-footer .btn-sm {
    margin-left: auto;
    padding: 8px 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.budget-card-footer .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Budget History List */
.budgets-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.budget-history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.budget-history-item:hover {
    border-color: var(--accent);
}

.budget-history-item .month-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
}

.budget-history-item .month-badge .month-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.budget-history-item .budget-info {
    flex: 1;
}

.budget-history-item .budget-info .budget-month-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.budget-history-item .budget-info .budget-amounts {
    font-size: 12px;
    color: var(--text-muted);
}

.budget-history-item .budget-percent {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
}

.budget-history-item .budget-percent.on_track {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.budget-history-item .budget-percent.warning {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.budget-history-item .budget-percent.over_budget {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.empty-state.small {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state.small i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state.small p {
    font-size: 13px;
}

/* Section Headers - Clean */
.section-modern {
    padding: 0 20px 20px;
}

.section-header-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-header-modern h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-text {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

/* Modern Transactions List */
.tx-list-modern {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tx-skeleton {
    height: 70px;
    background: var(--bg-card);
    border-radius: 16px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Modern Categories List */
.categories-list-modern {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-category-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.category-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-compact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.category-compact-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.category-compact-amount {
    font-size: 12px;
    color: var(--text-muted);
}

.category-compact-percent {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ═══════════ CSS VARIABLES ═══════════ */
:root {
    /* Core Colors */
    --bg-base: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a24;
    --bg-hover: #22222e;
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Accent Colors */
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    
    /* Semantic */
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.15);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.15);
    --yellow: #eab308;
    --yellow-soft: rgba(234, 179, 8, 0.15);
    --blue: #3b82f6;
    --blue-soft: rgba(59, 130, 246, 0.15);
    
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-income: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-expense: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
    
    /* Sizes */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 100px;
    
    /* Safe Areas */
    --safe-bottom: max(20px, env(safe-area-inset-bottom));
    --nav-height: 70px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #f1f5f9;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: 16px;
}

/* ═══════════ APP CONTAINER ═══════════ */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
    position: relative;
}

/* ═══════════ SCREENS ═══════════ */
.screen {
    display: none;
    animation: fadeSlideIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen-body {
    padding: 16px;
}

/* ═══════════ TOP BAR (HOME) ═══════════ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.user-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-hero);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    background-size: cover;
    background-position: center;
}

.user-greeting {
    display: flex;
    flex-direction: column;
}

.greeting-text {
    font-size: 13px;
    color: var(--text-muted);
}

.user-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ═══════════ SCREEN HEADER ═══════════ */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: 50px; /* Отступ для Telegram */
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.screen-header h1 {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.btn-back {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ═══════════ BUTTONS ═══════════ */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon.small {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.btn-icon.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-link:hover {
    background: var(--accent-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn.primary {
    background: var(--gradient-hero);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn.secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: var(--bg-hover);
}

/* ═══════════ HERO BALANCE CARD ═══════════ */
.hero-card {
    margin: 16px;
    padding: 28px 24px;
    background: var(--gradient-hero);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.hero-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

.hero-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.hero-amount {
    font-size: 42px;
    font-weight: 800;
    color: white;
    letter-spacing: -1px;
    margin-bottom: 8px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.hero-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
}

/* Period Pills */
.period-pills {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.pill {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.pill:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.pill.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ═══════════ FLOW CARDS (Income/Expense) ═══════════ */
.flow-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 16px;
    margin-top: -8px;
}

.flow-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
}

.flow-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.flow-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.flow-card.income .flow-icon {
    background: var(--green-soft);
    color: var(--green);
}

.flow-card.expense .flow-icon {
    background: var(--red-soft);
    color: var(--red);
}

.flow-data {
    display: flex;
    flex-direction: column;
}

.flow-label {
    font-size: 13px;
    color: var(--text-muted);
}

.flow-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ═══════════ QUICK STATS ═══════════ */
.quick-stats {
    display: flex;
    gap: 8px;
    padding: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.quick-stats::-webkit-scrollbar { display: none; }

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s;
}

.stat-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.stat-chip i {
    color: var(--accent);
}

/* ═══════════ SECTIONS ═══════════ */
.section-block {
    padding: 0 16px;
    margin-bottom: 24px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-head h2 i {
    color: var(--accent);
    font-size: 16px;
}

.badge {
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
}

/* ═══════════ TRANSACTION LIST ═══════════ */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tx-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    cursor: pointer;
}

.tx-item:hover {
    transform: translateX(4px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.tx-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.tx-icon.income {
    background: var(--green-soft);
    color: var(--green);
}

.tx-icon.expense {
    background: var(--red-soft);
    color: var(--red);
}

.tx-info {
    flex: 1;
    min-width: 0;
}

.tx-cat {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.tx-desc {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-right {
    text-align: right;
    flex-shrink: 0;
}

.tx-amount {
    font-size: 16px;
    font-weight: 700;
}

.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--red); }

.tx-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ═══════════ CATEGORIES MINI (Home) ═══════════ */
.categories-mini {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cat-mini {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    cursor: pointer;
}

.cat-mini:hover {
    transform: translateX(4px);
    border-color: var(--accent);
}

.cat-bar {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cat-mini-info {
    flex: 1;
}

.cat-mini-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.cat-mini-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.cat-mini-pct {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ═══════════ KPI ROW (Analytics) ═══════════ */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s;
}

.kpi-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.kpi-icon.income { background: var(--green-soft); color: var(--green); }
.kpi-icon.expense { background: var(--red-soft); color: var(--red); }
.kpi-icon.balance { background: var(--blue-soft); color: var(--blue); }
.kpi-icon.rate { background: var(--accent-glow); color: var(--accent); }

.kpi-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-lbl {
    font-size: 13px;
    color: var(--text-muted);
}

/* ═══════════ CHARTS ═══════════ */
.chart-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.chart-title i {
    color: var(--accent);
}

.chart-wrap {
    position: relative;
    height: 220px;
}

.chart-wrap.donut {
    height: 280px;
}

/* ═══════════ CATEGORY LIST (Analytics) ═══════════ */
.cat-list,
#top-categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-row,
.category-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.cat-icon,
.category-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.cat-info,
.category-info {
    flex: 1;
    min-width: 0;
}

.cat-name,
.category-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.cat-progress,
.category-progress {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.cat-progress-bar,
.category-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.cat-right,
.category-amount {
    text-align: right;
    flex-shrink: 0;
}

.cat-amount,
.category-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.cat-pct,
.category-percent {
    font-size: 13px;
    color: var(--text-muted);
}

/* ═══════════ AI INSIGHTS ═══════════ */
.ai-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 0 16px 24px;
}

.ai-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-insight-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-insight-card.high {
    border-left-color: var(--red);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--bg-elevated));
}

.ai-insight-card.medium {
    border-left-color: var(--yellow);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), var(--bg-elevated));
}

.ai-insight-card.low, .ai-insight-card.normal {
    border-left-color: var(--green);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--bg-elevated));
}

.ai-insight-card.empty {
    border-left-color: var(--green);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), var(--bg-elevated));
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ai-insight-card.empty i {
    font-size: 24px;
    color: var(--green);
    margin-right: 12px;
}

.ai-insight-card.empty span {
    font-size: 14px;
    color: var(--text-primary);
}

.insight-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.insight-content {
    flex: 1;
    min-width: 0;
}

.insight-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.insight-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.insight-saving {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
    display: inline-block;
}

.ai-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.ai-item i {
    font-size: 20px;
    flex-shrink: 0;
}

.ai-item i.success { color: var(--green); }
.ai-item i.warning { color: var(--yellow); }
.ai-item i.danger { color: var(--red); }

.ai-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ai-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

.ai-loading .spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ═══════════ TRENDS & PATTERNS ═══════════ */

.trends-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trends-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.trend-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border);
}

.trend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trend-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-change {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.trend-change.positive {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.trend-change.neutral {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-muted);
}

.trend-values {
    margin-bottom: 10px;
}

.trend-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.trend-prev {
    font-size: 12px;
    color: var(--text-muted);
}

.trend-bar-container {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.trend-bar {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.trend-bar.income {
    background: linear-gradient(90deg, #22c55e, #10b981);
}

.trend-projection {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.trend-projection i {
    color: var(--accent);
}

.trend-projection strong {
    color: var(--text-primary);
}

.projection-days {
    color: var(--text-muted);
    font-size: 12px;
}

/* Weekday Chart */
.weekday-chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.weekday-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    padding: 0 8px;
    gap: 8px;
}

.weekday-bars:has(.empty-state-card) {
    height: auto;
    min-height: 140px;
    align-items: stretch;
    padding: 0;
}

.weekday-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.weekday-bar-wrap {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.weekday-bar {
    width: 100%;
    max-width: 32px;
    background: linear-gradient(180deg, var(--accent), var(--primary));
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    position: relative;
}

.weekday-bar.highlight {
    background: linear-gradient(180deg, #f97316, #ef4444);
}

.weekday-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.weekday-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.weekday-bar-item.highlight .weekday-label {
    color: var(--accent);
}

.weekday-insight {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), var(--bg-elevated));
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    font-size: 13px;
    color: var(--text-secondary);
}

.weekday-insight i {
    color: var(--yellow);
    font-size: 16px;
}

/* Category Trends */
.category-trends-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-trend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.category-trend-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.category-trend-info {
    flex: 1;
    min-width: 0;
}

.category-trend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.category-trend-values {
    font-size: 12px;
    color: var(--text-muted);
}

.category-trend-change {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}

.category-trend-change.up {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.category-trend-change.down {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.category-trend-change.stable {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-muted);
}

/* ═══════════ HISTORY ═══════════ */

/* Search Bar */
.search-bar-container {
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: var(--danger);
    color: white;
}

/* Filters Panel */
.filters-panel {
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.filters-panel.collapsed {
    max-height: 0;
    padding: 0 16px;
}

.filters-panel:not(.collapsed) {
    max-height: 300px;
    padding: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.select-filter {
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    appearance: none;
    cursor: pointer;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-amount-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.input-filter {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 0;
}

.input-filter:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-separator {
    color: var(--text-muted);
    font-size: 14px;
}

.btn-reset-filters {
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-reset-filters:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Active filters chips */
.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-chip-label {
    color: var(--text-muted);
}

.filter-chip-value {
    color: var(--text-primary);
    font-weight: 500;
}

.filter-chip-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.filter-chip-remove:hover {
    background: var(--danger);
    color: white;
}

.tx-history {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.date-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 4px;
}

.btn-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-load-more:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Transaction Item (History) */
.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}

.transaction-item:hover {
    border-color: var(--accent);
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.transaction-icon.expense {
    background: var(--red-soft);
    color: var(--red);
}

.transaction-icon.income {
    background: var(--green-soft);
    color: var(--green);
}

.transaction-info {
    flex: 1;
    min-width: 0;
}

.transaction-category {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.transaction-description {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-amount {
    text-align: right;
    flex-shrink: 0;
}

.transaction-value {
    font-size: 15px;
    font-weight: 700;
}

.transaction-value.expense {
    color: var(--red);
}

.transaction-value.income {
    color: var(--green);
}

/* ═══════════ SETTINGS ═══════════ */
.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-group h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-row:first-of-type {
    padding-top: 0;
}

.setting-row.clickable {
    cursor: pointer;
    margin: 0 -20px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.setting-row.clickable:hover {
    background: var(--bg-hover);
}

.setting-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.setting-left > i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
}

.setting-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.setting-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.select-setting {
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    appearance: none;
}

.select-minimal {
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.version-tag {
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-full);
    font-family: monospace;
}

/* ═══════════ CATEGORIES SCREEN ═══════════ */

/* Type Toggle */
.category-type-toggle {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.type-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.type-btn.active[data-type="expense"] {
    background: var(--red);
    color: white;
}

.type-btn.active[data-type="income"] {
    background: var(--green);
    color: white;
}

.type-btn i {
    font-size: 12px;
}

/* Category Section */
.cat-section {
    margin-bottom: 24px;
}

.cat-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title i {
    font-size: 11px;
    opacity: 0.7;
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--accent);
    color: white;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: default;
    transition: all 0.2s;
    position: relative;
}

.category-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.category-card .category-icon {
    font-size: 28px;
    line-height: 1;
}

.category-card .category-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.category-card.user-category {
    cursor: pointer;
}

.category-card .delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
    cursor: pointer;
}

.category-card:hover .delete-btn {
    opacity: 1;
    transform: scale(1);
}

.empty-user-cats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-user-cats i {
    font-size: 32px;
    opacity: 0.5;
}

/* Type Selector in Modal */
.type-selector {
    display: flex;
    gap: 10px;
}

.type-option {
    flex: 1;
    cursor: pointer;
}

.type-option input {
    display: none;
}

.type-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.type-option input:checked + .type-label.expense {
    border-color: var(--red);
    background: var(--red-soft);
    color: var(--red);
}

.type-option input:checked + .type-label.income {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
}

/* Emoji Picker */
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.emoji-picker-grid .emoji {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.emoji-picker-grid .emoji:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.emoji-picker-grid .emoji.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* Export Modal */
.export-options {
    padding: 0;
}

.export-format-selector {
    display: flex;
    gap: 10px;
}

.format-option {
    flex: 1;
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.format-label i {
    font-size: 24px;
}

.format-option input:checked + .format-label {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}

.format-option:hover .format-label {
    background: var(--bg-hover);
}

.date-range-row {
    display: flex;
    gap: 12px;
}

.date-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-input-group label {
    font-size: 12px;
    color: var(--text-muted);
}

.date-input-group input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
}

.date-input-group input[type="date"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* ═══════════ MODALS ═══════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open,
.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-bottom));
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-box.large {
    max-height: 95vh;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-head h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
}

/* ═══════════ FORMS ═══════════ */
.form-field {
    margin-bottom: 18px;
}

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

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-field small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-field.checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-field.checkbox input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.toggle-row {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--accent);
}

.toggle-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.emoji {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.emoji:hover {
    transform: scale(1.1);
}

.emoji.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ═══════════ RECURRING ═══════════ */
.summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.summary-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.summary-icon.upcoming {
    background: var(--yellow-soft);
    color: var(--yellow);
}

.summary-icon.active {
    background: var(--green-soft);
    color: var(--green);
}

.summary-data {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 13px;
    color: var(--text-muted);
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.recurring-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Recurring Item - Modern Card */
.recurring-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
}

.recurring-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recurring-item.overdue {
    border-left: 3px solid var(--red);
}

.recurring-item.due-soon {
    border-left: 3px solid var(--yellow);
}

.recurring-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.recurring-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.recurring-info {
    flex: 1;
    min-width: 0;
}

.recurring-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recurring-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.recurring-category {
    display: flex;
    align-items: center;
    gap: 4px;
}

.recurring-category i {
    font-size: 10px;
    opacity: 0.7;
}

.recurring-frequency {
    opacity: 0.8;
}

.recurring-amount {
    text-align: right;
    flex-shrink: 0;
}

.recurring-amount .amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.recurring-amount .next-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.recurring-amount .next-date.overdue {
    color: var(--red);
    font-weight: 600;
}

.recurring-amount .next-date.due-soon {
    color: var(--yellow);
    font-weight: 500;
}

.recurring-actions {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}

.recurring-actions button {
    flex: 1;
    padding: 10px;
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.recurring-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.recurring-actions .btn-mark-paid:hover {
    color: var(--green);
}

.recurring-actions .btn-delete:hover {
    color: var(--red);
}

/* ═══════════ DEBTS ═══════════ */
.debt-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.debt-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.debt-box i {
    font-size: 16px;
    margin-bottom: 2px;
}

.debt-box.positive i { color: var(--green); }
.debt-box.negative i { color: var(--red); }
.debt-box.neutral i { color: var(--blue); }

.debt-label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.debt-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.debt-box.positive .debt-value { color: var(--green); }
.debt-box.negative .debt-value { color: var(--red); }

/* Tab bar for filters */
#debts-screen .tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

#debts-screen .tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#debts-screen .tab.active {
    background: var(--accent);
    color: white;
}

#debts-screen .tab:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.debts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Debt Item - Modern Card */
.debt-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.2s;
}

.debt-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.debt-item.overdue {
    border-left: 3px solid var(--red);
}

.debt-item.settled {
    opacity: 0.6;
}

.debt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.debt-person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.debt-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.debt-avatar.given {
    background: linear-gradient(135deg, var(--green), #059669);
}

.debt-avatar.received {
    background: linear-gradient(135deg, var(--red), #dc2626);
}

.debt-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.debt-type-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 500;
}

.debt-type-badge.given {
    background: var(--green-soft);
    color: var(--green);
}

.debt-type-badge.received {
    background: var(--red-soft);
    color: var(--red);
}

.debt-amount-info {
    text-align: right;
}

.debt-amount {
    font-size: 17px;
    font-weight: 700;
}

.debt-amount.given {
    color: var(--green);
}

.debt-amount.received {
    color: var(--red);
}

.debt-remaining {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.debt-progress {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 12px;
}

.debt-progress-bar {
    height: 100%;
    border-radius: 100px;
    transition: width 0.3s;
}

.debt-progress-bar.given {
    background: var(--green);
}

.debt-progress-bar.received {
    background: var(--red);
}

.debt-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.debt-due-date {
    font-weight: 500;
}

.debt-due-date.overdue {
    color: var(--red);
}

.debt-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.debt-actions button {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.debt-actions button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

.debt-actions .btn-add-payment:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.debt-actions .btn-settle:hover {
    border-color: var(--green);
    color: var(--green);
}

.debt-actions .btn-debt-delete {
    flex: 0 0 auto;
    width: 36px;
    padding: 8px;
}

.debt-actions .btn-debt-delete:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ═══════════ SAVINGS GOALS ═══════════ */
.goals-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.goal-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.goal-stat-box i {
    font-size: 18px;
    color: var(--accent);
    margin-bottom: 2px;
}

.goal-stat-box.highlight {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-color: transparent;
}

.goal-stat-box.highlight i,
.goal-stat-box.highlight .goal-stat-label,
.goal-stat-box.highlight .goal-stat-value {
    color: white;
}

.goal-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.goal-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Goals Tab Bar */
#goals-screen .tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

#goals-screen .tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#goals-screen .tab.active {
    background: var(--accent);
    color: white;
}

#goals-screen .tab:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Goals List */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Goal Card */
.goal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.goal-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.goal-card.completed {
    opacity: 0.7;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.1));
    border-color: var(--green);
}

.goal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.goal-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.goal-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.goal-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.goal-deadline-badge {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.goal-deadline-badge.urgent {
    color: var(--red);
}

.goal-amounts {
    text-align: right;
}

.goal-current-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.goal-target-amount {
    font-size: 12px;
    color: var(--text-muted);
}

/* Goal Progress Bar */
.goal-progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.goal-progress-bar.large {
    height: 12px;
    border-radius: 6px;
    margin-top: 8px;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--accent), #7c3aed);
}

.goal-card.completed .goal-progress-fill {
    background: linear-gradient(90deg, var(--green), #059669);
}

.goal-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.goal-progress-percent {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.goal-card.completed .goal-progress-percent {
    color: var(--green);
}

.goal-remaining {
    font-size: 12px;
    color: var(--text-muted);
}

/* Goal Modal Styles */
.icon-color-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.icon-picker,
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.icon-btn.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-card);
}

/* Goal Detail Modal */
.goal-detail-content {
    padding: 0;
}

.goal-detail-hero {
    text-align: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    color: white;
}

.goal-detail-hero .goal-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.goal-detail-hero .goal-amounts {
    text-align: center;
}

.goal-detail-hero .goal-current {
    font-size: 32px;
    font-weight: 700;
}

.goal-detail-hero .goal-separator {
    font-size: 20px;
    margin: 0 8px;
    opacity: 0.7;
}

.goal-detail-hero .goal-target {
    font-size: 20px;
    opacity: 0.9;
}

.goal-detail-hero .goal-progress-bar {
    background: rgba(255, 255, 255, 0.2);
    margin-top: 16px;
}

.goal-detail-hero .goal-progress-fill {
    background: white;
}

.goal-detail-hero .goal-progress-text {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
}

.goal-detail-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 16px;
}

.goal-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.goal-info-row:last-child {
    border-bottom: none;
}

.goal-info-row i {
    font-size: 16px;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.goal-info-row span {
    flex: 1;
    font-size: 14px;
    color: var(--text-muted);
}

.goal-info-row strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Quick Deposit */
.goal-quick-deposit {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.goal-quick-deposit h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.quick-deposit-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-deposit-row input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.quick-deposit-row .btn {
    padding: 12px 20px;
}

.quick-deposit-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Goal History */
.goal-history {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.goal-history h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.contributions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.contribution-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.contribution-item:last-child {
    border-bottom: none;
}

.contribution-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contribution-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.contribution-icon.deposit {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
}

.contribution-icon.withdraw {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.contribution-details {
    display: flex;
    flex-direction: column;
}

.contribution-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.contribution-amount.deposit {
    color: var(--green);
}

.contribution-amount.withdraw {
    color: var(--red);
}

.contribution-date {
    font-size: 11px;
    color: var(--text-muted);
}

.contribution-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════ REPORTS ═══════════ */
.info-box {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--blue-soft);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.info-box i {
    font-size: 18px;
    color: var(--blue);
    flex-shrink: 0;
}

.info-box p {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.report-item:hover {
    transform: translateX(4px);
    border-color: var(--red);
}

.report-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--red-soft);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.report-info {
    flex: 1;
}

.report-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.report-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* ═══════════ EMPTY STATES ═══════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-mini i {
    font-size: 24px;
    opacity: 0.5;
}

.empty-msg {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ═══════════ LOADING ═══════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
}

.spinner,
.spinner-large {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-glow);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 16px;
    min-height: 200px;
}

.loading-state .loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color, rgba(128, 128, 128, 0.2));
    border-top-color: var(--accent-primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    padding: 0;
}

.loading-state .loading-spinner::before {
    display: none;
}

.loading-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-row {
    height: 76px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-lg);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══════════ TOAST ═══════════ */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
}

.toast.success {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.toast.error {
    background: var(--red);
    border-color: var(--red);
    color: white;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Achievement Toast */
.toast.achievement-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid var(--accent);
    text-align: left;
    padding: 16px 20px;
}

.toast.achievement-toast .toast-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.toast.achievement-toast .toast-content {
    flex: 1;
}

.toast.achievement-toast .toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast.achievement-toast .toast-message {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ═══════════ PROFILE & GAMIFICATION ═══════════ */

/* Clickable user block in header */
.user-block.clickable {
    cursor: pointer;
    padding: 8px 12px 8px 8px;
    margin: -8px;
    border-radius: 16px;
    transition: background 0.2s ease;
    flex: 1;
}

.user-block.clickable:active {
    background: var(--glass-bg);
}

.header-greeting {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-level-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.user-level-badge .level-icon {
    font-size: 10px;
}

.profile-arrow {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-left: auto;
}

/* Profile Screen */
.profile-gamification-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.profile-user-info h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-level-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--accent-primary);
}

.profile-level-badge .level-icon {
    font-size: 16px;
}

.profile-level-badge .level-number {
    color: var(--text-secondary);
    font-size: 12px;
}

/* XP Bar */
.profile-xp-section {
    margin-bottom: 20px;
}

.xp-bar-container {
    height: 8px;
    background: var(--bg-tertiary, rgba(128, 128, 128, 0.15));
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.xp-info {
    display: flex;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Profile Stats */
.profile-stats-row {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
    border-top: 1px solid var(--border-color, rgba(128, 128, 128, 0.2));
    border-bottom: 1px solid var(--border-color, rgba(128, 128, 128, 0.2));
    margin-bottom: 16px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.profile-stat .stat-icon {
    font-size: 20px;
}

.profile-stat .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-stat .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
}

/* Achievements Button */
.btn-achievements {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary, rgba(128, 128, 128, 0.1));
    border: 1px solid var(--border-color, rgba(128, 128, 128, 0.2));
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-achievements:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.btn-achievements i:first-child {
    color: #fbbf24;
    font-size: 18px;
}

.btn-achievements i:last-child {
    margin-left: auto;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ═══════════ ACHIEVEMENTS SCREEN ═══════════ */

.achievements-stats {
    display: flex;
    justify-content: center;
    padding: 20px 0 30px;
}

.achievements-progress-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.achievements-progress-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.achievements-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.achievements-progress-ring .ring-fill {
    fill: none;
    stroke: url(#gradient) #6366f1;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ring-text span {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.achievements-filter {
    display: flex;
    gap: 8px;
    padding: 0 0 16px;
    overflow-x: auto;
}

.achievements-filter .filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary, rgba(128, 128, 128, 0.1));
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.achievements-filter .filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.2s ease;
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-card.unlocked {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), transparent);
}

.achievement-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-secondary, rgba(128, 128, 128, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.achievement-info {
    flex: 1;
    min-width: 0;
}

.achievement-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.achievement-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.achievement-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.achievement-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary, rgba(128, 128, 128, 0.15));
    border-radius: 2px;
    overflow: hidden;
}

.achievement-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.achievement-progress-text {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.achievement-xp {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(251, 191, 36, 0.15);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fbbf24;
    flex-shrink: 0;
}

.achievement-rarity {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.achievement-rarity.common { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }
.achievement-rarity.rare { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.achievement-rarity.epic { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.achievement-rarity.legendary { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }

/* Light theme fixes for achievements */
[data-theme="light"] .achievement-card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(255, 255, 255, 1));
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .achievement-card.locked {
    opacity: 0.6;
}

[data-theme="light"] .achievement-icon {
    background: #f3f4f6;
}

[data-theme="light"] .achievement-progress-bar {
    background: #e5e7eb;
}

[data-theme="light"] .achievements-stats {
    background: #f9fafb;
}

[data-theme="light"] .achievements-filter .filter-btn {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

[data-theme="light"] .achievements-filter .filter-btn.active {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
}

[data-theme="light"] .profile-gamification-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .xp-bar-container {
    background: #e5e7eb;
}

[data-theme="light"] .profile-stats-row {
    border-color: #e5e7eb;
}

[data-theme="light"] .btn-achievements {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .btn-achievements:hover {
    background: #e5e7eb;
}

/* ═══════════ DAILY QUESTS ═══════════ */
.daily-quests-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.daily-quests-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.daily-quests-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quest-icon {
    font-size: 18px;
}

.daily-quests-bonus {
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #22c55e;
}

.daily-quests-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.daily-quest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary, rgba(128, 128, 128, 0.08));
    border-radius: 12px;
    transition: all 0.2s ease;
}

.daily-quest-item.completed {
    background: rgba(34, 197, 94, 0.1);
}

.daily-quest-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.daily-quest-item.completed .daily-quest-check {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.daily-quest-info {
    flex: 1;
    min-width: 0;
}

.daily-quest-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.daily-quest-progress-bar {
    height: 4px;
    background: var(--bg-tertiary, rgba(128, 128, 128, 0.15));
    border-radius: 2px;
    overflow: hidden;
}

.daily-quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.daily-quest-item.completed .daily-quest-progress-fill {
    background: #22c55e;
}

.daily-quest-xp {
    padding: 4px 8px;
    background: rgba(251, 191, 36, 0.15);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fbbf24;
    flex-shrink: 0;
}

.daily-quests-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.all-completed-text {
    font-size: 14px;
    font-weight: 500;
    color: #22c55e;
}

/* Profile action buttons */
.profile-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ═══════════ LEADERBOARD ═══════════ */
.leaderboard-user-position {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    margin-bottom: 16px;
}

.position-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.position-info {
    flex: 1;
}

.position-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.position-level {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.position-xp {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

.leaderboard-period-filter {
    display: flex;
    gap: 8px;
    padding: 0 0 16px;
}

.leaderboard-period-filter .period-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary, rgba(128, 128, 128, 0.1));
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-period-filter .period-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.leaderboard-item.current-user {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.leaderboard-item.top-3 {
    border-color: rgba(251, 191, 36, 0.3);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary, rgba(128, 128, 128, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.leaderboard-item.top-3:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.leaderboard-item.top-3:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
}

.leaderboard-item.top-3:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.leaderboard-user-info {
    flex: 1;
}

.leaderboard-level-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.leaderboard-streak {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.leaderboard-xp {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* XP Popup Animation */
.xp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--accent-primary);
    border-radius: 20px;
    padding: 30px 50px;
    text-align: center;
    animation: xpPopupIn 0.4s ease, xpPopupOut 0.4s ease 2s forwards;
}

.xp-popup-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.xp-popup-amount {
    font-size: 36px;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.xp-popup-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

@keyframes xpPopupIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes xpPopupOut {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8) translateY(-30px); opacity: 0; }
}

/* Level Up Animation */
.level-up-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: levelUpBgIn 0.3s ease;
}

.level-up-content {
    text-align: center;
    animation: levelUpContentIn 0.5s ease 0.2s both;
}

.level-up-icon {
    font-size: 80px;
    margin-bottom: 16px;
    animation: levelUpIconPulse 1s ease infinite;
}

.level-up-title {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.level-up-level {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.level-up-name {
    font-size: 18px;
    color: var(--text-secondary);
}

@keyframes levelUpBgIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes levelUpContentIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes levelUpIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Light theme fixes */
[data-theme="light"] .daily-quests-card {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .daily-quest-item {
    background: #f3f4f6;
}

[data-theme="light"] .daily-quest-item.completed {
    background: rgba(34, 197, 94, 0.1);
}

[data-theme="light"] .leaderboard-user-position {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
}

[data-theme="light"] .leaderboard-item {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .leaderboard-item.current-user {
    background: rgba(99, 102, 241, 0.05);
}

[data-theme="light"] .leaderboard-period-filter .period-btn {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* ═══════════ BOTTOM NAV ═══════════ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: var(--nav-height);
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 8px;
    z-index: 900;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.nav-btn i {
    font-size: 22px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
    transition: transform 0.2s;
}

.nav-btn:hover {
    color: var(--text-secondary);
}

.nav-btn.active {
    color: var(--accent);
}

.nav-btn.active i {
    transform: scale(1.1);
}

.nav-btn.active::before {
    transform: translateX(-50%) scaleX(1);
}

/* ═══════════ SCROLLBAR ═══════════ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* --- Modern Transactions List --- */
.tx-item-modern {
    display: flex;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tx-item-modern:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.08);
}

.tx-icon-modern {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 16px;
    flex-shrink: 0;
}

.tx-icon-modern.income {
    background: rgba(0, 255, 157, 0.15);
    color: #00ff9d;
}

.tx-icon-modern.expense {
    background: rgba(255, 99, 132, 0.15);
    color: #ff6384;
}

.tx-info-modern {
    flex: 1;
    overflow: hidden;
}

.tx-cat-modern {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-desc-modern {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-amount-modern {
    font-weight: 700;
    font-size: 15px;
    margin-left: 12px;
    white-space: nowrap;
}

.tx-amount-modern.income {
    color: #00ff9d;
}

.tx-amount-modern.expense {
    color: var(--text-primary);
}

/* ═══════════ ERROR/SUCCESS TOAST ═══════════ */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 14px 24px;
    background: var(--red);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

/* ═══════════ EXPORT FORMAT SELECTOR ═══════════ */
.export-format-selector {
    display: flex;
    gap: 10px;
}

.format-option {
    flex: 1;
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.format-label i {
    font-size: 24px;
}

.format-option input:checked + .format-label {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}

.date-range-row {
    display: flex;
    gap: 12px;
}

.date-input-group {
    flex: 1;
}

.date-input-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.date-input-group input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ═══════════ HEADER ACTIONS ═══════════ */
.screen-header .header-actions {
    display: flex;
    gap: 8px;
}

.error-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.success-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 14px 24px;
    background: var(--green);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

.success-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== LOADING PLACEHOLDERS ===== */
.loading-placeholder {
    padding: 16px;
}

.skeleton-item {
    height: 60px;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 25%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.skeleton-item:last-child {
    margin-bottom: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    width: 100%;
}

.loading-spinner::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, rgba(128, 128, 128, 0.2));
    border-top-color: var(--accent-primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════════ BEAUTIFUL EMPTY STATES ═══════════ */
.empty-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 1px dashed rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    text-align: center;
    width: 100%;
    flex: 1;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.empty-state-icon i {
    font-size: 22px;
    color: var(--accent);
    opacity: 0.7;
}

.empty-state-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-state-hint {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 200px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--yellow); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.text-xs { font-size: 10px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 20px; }
.truncate { 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}

/* Spacing utilities */
.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-4 { margin: 16px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

/* Display utilities */
.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Sizing utilities */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Border radius utilities */
.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

/* Shadow utilities */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Background utilities */
.bg-card { background: var(--bg-card); }
.bg-elevated { background: var(--bg-elevated); }
.bg-transparent { background: transparent; }

/* Opacity utilities */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Overflow utilities */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Z-index utilities */
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }

/* Transition utilities */
.transition { transition: all 0.2s ease; }
.transition-fast { transition: all 0.15s ease; }
.transition-slow { transition: all 0.3s ease; }

/* Active state improvements */
.pressable {
    transition: transform 0.1s ease, opacity 0.1s ease;
}

.pressable:active {
    transform: scale(0.97);
    opacity: 0.8;
}

/* Disabled state */
.disabled,
[disabled] {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - Mobile First Approach
   ═══════════════════════════════════════════════════════════════════════════ */

/* Extra Small Devices (320px - very small phones) */
@media (max-width: 320px) {
    .app-container {
        padding-top: 40px;
    }
    
    .balance-amount {
        font-size: 32px !important;
    }
    
    .balance-hero {
        padding: 20px 12px 28px;
    }
    
    .home-header {
        padding: 12px 12px;
    }
    
    .greeting-name {
        font-size: 15px;
    }
    
    .user-avatar-glow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .btn-icon-glass {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
    
    .income-expense-pills {
        gap: 6px;
    }
    
    .ie-pill {
        padding: 8px 10px;
        min-width: 0;
        flex: 1;
    }
    
    .pill-amount {
        font-size: 14px;
    }
    
    .pill-label {
        font-size: 10px;
    }
    
    .stats-cards {
        gap: 6px;
    }
    
    .stat-card {
        padding: 10px 6px;
    }
    
    .stat-card-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .stat-card-value {
        font-size: 14px;
    }
    
    .stat-card-label {
        font-size: 9px;
    }
    
    .section-header h2 {
        font-size: 15px;
    }
    
    .screen-header h1 {
        font-size: 17px;
    }
    
    .screen-body {
        padding: 12px;
    }
    
    /* Profile */
    .profile-gamification-card {
        padding: 14px;
    }
    
    .profile-avatar-large {
        width: 50px;
        height: 50px;
    }
    
    .profile-user-info h2 {
        font-size: 16px;
    }
    
    .profile-stats-row {
        gap: 8px;
    }
    
    .profile-stat .stat-value {
        font-size: 16px;
    }
    
    .profile-stat .stat-label {
        font-size: 10px;
    }
    
    /* Achievements */
    .achievement-card {
        padding: 12px;
        gap: 10px;
    }
    
    .achievement-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .achievement-name {
        font-size: 13px;
    }
    
    .achievement-desc {
        font-size: 11px;
    }
    
    .achievement-xp {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Daily Quests */
    .daily-quest-item {
        padding: 10px;
        gap: 10px;
    }
    
    .daily-quest-check {
        width: 20px;
        height: 20px;
    }
    
    .daily-quest-title {
        font-size: 12px;
    }
    
    /* Leaderboard */
    .leaderboard-item {
        padding: 10px 12px;
    }
    
    .leaderboard-rank {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .leaderboard-level-name {
        font-size: 13px;
    }
    
    /* Transactions */
    .tx-item-modern {
        padding: 12px;
    }
    
    .tx-icon-modern {
        width: 36px;
        height: 36px;
        font-size: 14px;
        margin-right: 10px;
    }
    
    .tx-title-modern {
        font-size: 13px;
    }
    
    .tx-amount-modern {
        font-size: 14px;
    }
    
    /* Bottom Nav */
    .bottom-nav {
        height: 56px;
    }
    
    .nav-item i {
        font-size: 18px;
    }
    
    .nav-item span {
        font-size: 9px;
    }
    
    /* Budget */
    .budget-card-header h4 {
        font-size: 14px;
    }
    
    /* Forms */
    .form-input, .form-select {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    /* Settings */
    .setting-row {
        padding: 12px;
    }
    
    .setting-title {
        font-size: 13px;
    }
    
    .setting-desc {
        font-size: 11px;
    }
    
    /* Modals */
    .modal-content {
        padding: 16px;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    /* Emoji Grid */
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    
    .emoji {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* Summary boxes */
    .summary-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .summary-box {
        padding: 12px;
    }
    
    .summary-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* Small Devices (321px - 375px - iPhone SE, small Android) */
@media (min-width: 321px) and (max-width: 375px) {
    .balance-amount {
        font-size: 36px;
    }
    
    .balance-hero {
        padding: 24px 16px 32px;
    }
    
    .ie-pill {
        padding: 10px 12px;
    }
    
    .pill-amount {
        font-size: 15px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
    
    .stat-card-value {
        font-size: 15px;
    }
    
    .screen-body {
        padding: 14px;
    }
    
    .achievement-icon {
        width: 42px;
        height: 42px;
    }
    
    .profile-stats-row {
        gap: 12px;
    }
    
    /* Filters on small devices */
    .filter-row {
        flex-wrap: wrap;
    }
    
    .filter-amount-group {
        flex: 100%;
    }
    
    .achievements-filter .filter-btn,
    .leaderboard-period-filter .period-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

/* Medium Devices (376px - 414px - iPhone 6/7/8, most Android) */
@media (min-width: 376px) and (max-width: 414px) {
    .balance-amount {
        font-size: 40px;
    }
    
    .stat-card {
        padding: 14px 10px;
    }
    
    .stat-card-value {
        font-size: 16px;
    }
}

/* Large Devices (415px - 480px - iPhone Plus/Max, large Android) */
@media (min-width: 415px) and (max-width: 480px) {
    .balance-amount {
        font-size: 44px;
    }
    
    .ie-pill {
        padding: 12px 20px;
    }
    
    .pill-amount {
        font-size: 18px;
    }
    
    .stat-card {
        padding: 16px 12px;
    }
    
    .screen-body {
        padding: 20px;
    }
}

/* Safe Area Support for notched devices */
@supports (padding: max(0px)) {
    .app-container {
        padding-top: max(50px, env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .screen-body {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .balance-hero {
        padding: 16px 20px 24px;
    }
    
    .balance-amount {
        font-size: 32px;
    }
    
    .stats-floating-row {
        margin-top: -20px;
    }
    
    .screen-body {
        padding-bottom: 70px;
    }
    
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Hide some elements in landscape to save space */
    .balance-trend-pill {
        display: none;
    }
}

/* High DPI / Retina display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .user-avatar-glow,
    .stat-card-icon,
    .achievement-icon,
    .tx-icon-modern {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .xp-popup,
    .level-up-popup,
    .toast {
        animation: none !important;
    }
}

/* Dark mode specific optimizations */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
}

/* Light mode specific optimizations */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
    }
}

/* Touch-friendly hit areas */
@media (hover: none) and (pointer: coarse) {
    .btn-icon-glass,
    .nav-item,
    .setting-row.clickable,
    .filter-btn,
    .period-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-achievements {
        min-height: 48px;
    }
    
    .achievement-card,
    .daily-quest-item,
    .leaderboard-item,
    .tx-item-modern {
        min-height: 52px;
    }
}

/* Fix for iOS input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Improved focus states for accessibility */
@media (hover: hover) {
    .btn-achievements:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    }
    
    .achievement-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }
    
    .leaderboard-item:hover {
        background: rgba(99, 102, 241, 0.05);
    }
    
    .daily-quest-item:hover {
        background: rgba(99, 102, 241, 0.08);
    }
    
    .tx-item-modern:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* Print styles (for export) */
@media print {
    .bottom-nav,
    .home-header,
    .screen-header,
    .btn-back {
        display: none !important;
    }
    
    .screen {
        padding: 0 !important;
    }
    
    .screen-body {
        padding: 10px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLET & DESKTOP RESPONSIVE (iPad, Tablets, Laptops)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Small Tablets (481px - 768px - iPad Mini, small tablets) */
@media (min-width: 481px) {
    /* Remove max-width constraint for tablets */
    .app {
        max-width: 600px;
    }
    
    .bottom-nav {
        max-width: 600px;
    }
    
    /* Larger balance display */
    .balance-amount {
        font-size: 52px;
    }
    
    .balance-hero {
        padding: 32px 24px 40px;
        border-radius: 0 0 32px 32px;
    }
    
    /* Better stats cards layout */
    .stats-cards {
        gap: 16px;
        padding: 0 24px 24px;
    }
    
    .stat-card {
        padding: 20px 16px;
    }
    
    .stat-card-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .stat-card-value {
        font-size: 20px;
    }
    
    .stat-card-label {
        font-size: 12px;
    }
    
    /* Income/Expense pills */
    .ie-pill {
        padding: 14px 24px;
    }
    
    .pill-amount {
        font-size: 20px;
    }
    
    /* Screen body padding */
    .screen-body {
        padding: 24px;
    }
    
    /* Larger section headers */
    .section-header h2 {
        font-size: 18px;
    }
    
    /* Transactions */
    .tx-item-modern {
        padding: 18px;
    }
    
    .tx-icon-modern {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .tx-title-modern {
        font-size: 16px;
    }
    
    .tx-amount-modern {
        font-size: 18px;
    }
    
    /* Profile */
    .profile-avatar-large {
        width: 80px;
        height: 80px;
    }
    
    .profile-user-info h2 {
        font-size: 22px;
    }
    
    /* Achievements grid for tablets */
    .achievements-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .achievement-card {
        padding: 18px;
    }
    
    .achievement-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    /* Leaderboard */
    .leaderboard-list {
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* Daily quests */
    .daily-quests-section {
        max-width: 500px;
    }
    
    /* Modal improvements */
    .modal-box {
        max-width: 500px;
        border-radius: var(--radius-xl);
        margin: auto;
    }
    
    /* Forms */
    .form-field input,
    .form-field select,
    .form-field textarea {
        padding: 16px 18px;
        font-size: 16px;
    }
    
    /* Emoji grid */
    .emoji-grid {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .emoji {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
}

/* Medium Tablets (769px - 1024px - iPad, iPad Air) */
@media (min-width: 769px) {
    .app {
        max-width: 720px;
    }
    
    .bottom-nav {
        max-width: 720px;
    }
    
    .balance-amount {
        font-size: 60px;
    }
    
    .balance-hero {
        padding: 40px 32px 48px;
        margin: 0 16px;
        border-radius: 24px;
        margin-top: 16px;
    }
    
    /* Stats as 4 columns */
    .stats-cards {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        padding: 0 32px 32px;
    }
    
    .stat-card {
        padding: 24px 16px;
    }
    
    /* Two-column layout for income/expense */
    .income-expense-pills {
        gap: 20px;
    }
    
    .ie-pill {
        padding: 16px 32px;
    }
    
    /* Screen body */
    .screen-body {
        padding: 32px;
    }
    
    /* Transactions in grid */
    .transactions-list-modern {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .tx-item-modern {
        margin-bottom: 0;
    }
    
    /* Profile stats */
    .profile-stats-row {
        gap: 32px;
    }
    
    .profile-stat .stat-value {
        font-size: 24px;
    }
    
    /* Achievements 3 columns */
    .achievements-list {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Settings two columns */
    .settings-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Budget cards grid */
    .budget-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* Recurring payments grid */
    .recurring-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Large Tablets & Small Laptops (1025px - 1280px - iPad Pro, small laptops) */
@media (min-width: 1025px) {
    .app {
        max-width: 900px;
    }
    
    .bottom-nav {
        max-width: 900px;
        /* Optional: convert to sidebar on large screens */
    }
    
    .balance-amount {
        font-size: 68px;
    }
    
    .balance-hero {
        padding: 48px 40px 56px;
    }
    
    /* Stats */
    .stat-card {
        padding: 28px 20px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
    
    /* Screen body */
    .screen-body {
        padding: 40px;
    }
    
    /* Achievements 4 columns */
    .achievements-list {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Analytics charts side by side */
    .analytics-charts {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    /* Categories grid */
    .categories-breakdown {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* Larger modals */
    .modal-box {
        max-width: 600px;
        padding: 32px;
    }
}

/* Desktop & Large Laptops (1281px+) */
@media (min-width: 1281px) {
    .app {
        max-width: 1080px;
    }
    
    .bottom-nav {
        max-width: 1080px;
    }
    
    .balance-amount {
        font-size: 76px;
    }
    
    /* Home screen layout */
    .home-content {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 32px;
        align-items: start;
    }
    
    /* Main content area */
    .home-main {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
    
    /* Sidebar area */
    .home-sidebar {
        position: sticky;
        top: 80px;
    }
    
    /* Transactions 3 columns */
    .transactions-list-modern {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Screen body */
    .screen-body {
        padding: 48px;
    }
    
    /* Better spacing */
    .section-header {
        margin-bottom: 24px;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
}

/* Ultra Wide / 4K Displays (1600px+) */
@media (min-width: 1600px) {
    .app {
        max-width: 1280px;
    }
    
    .bottom-nav {
        max-width: 1280px;
    }
    
    .balance-hero {
        padding: 56px 48px 64px;
    }
    
    .balance-amount {
        font-size: 84px;
    }
    
    /* Even larger stats */
    .stat-card {
        padding: 32px 24px;
    }
    
    .stat-card-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .stat-card-value {
        font-size: 28px;
    }
    
    /* Screen body */
    .screen-body {
        padding: 56px;
    }
}

/* iPad specific orientation handling */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    /* iPad Portrait */
    .balance-hero {
        margin: 16px;
        border-radius: 24px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .achievements-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    /* iPad Landscape */
    .stats-cards {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .achievements-list {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .transactions-list-modern {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Hover states for devices with mouse/trackpad */
@media (hover: hover) and (pointer: fine) {
    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }
    
    .tx-item-modern:hover {
        transform: translateX(4px);
        background: rgba(99, 102, 241, 0.05);
    }
    
    .setting-row.clickable:hover {
        background: var(--bg-hover);
    }
    
    .nav-btn:hover {
        background: rgba(99, 102, 241, 0.1);
        border-radius: 12px;
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
    
    /* Cursor pointer for interactive elements */
    .stat-card,
    .tx-item-modern,
    .achievement-card,
    .leaderboard-item,
    .daily-quest-item {
        cursor: pointer;
    }
}

/* Desktop-specific bottom nav style (optional sidebar conversion) */
@media (min-width: 1025px) and (hover: hover) {
    /* Keep bottom nav but make it more prominent */
    .bottom-nav {
        background: rgba(18, 18, 26, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-btn {
        padding: 12px 20px;
        border-radius: 12px;
        transition: all 0.2s ease;
    }
    
    .nav-btn:hover {
        background: rgba(99, 102, 241, 0.15);
    }
    
    .nav-btn i {
        font-size: 24px;
    }
    
    .nav-btn span {
        font-size: 12px;
    }
}

/* ===== GOAL SKELETON & LOADING ===== */
.goal-card.skeleton {
    pointer-events: none;
    background: var(--card-bg);
}

.skeleton-line {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 25%, 
        rgba(255,255,255,0.15) 50%, 
        rgba(255,255,255,0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

.goal-detail-modal.loading .goal-detail-actions button {
    pointer-events: none;
    opacity: 0.5;
}

button:disabled {
    pointer-events: none;
    opacity: 0.6;
}

.contributions-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

