:root {
    /* Светлая тема (По умолчанию) */
    --bg-body: #f7f9fc;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    
    --accent-black: #0f172a;
    --accent-gray: #f3f4f6;
    --accent-hover: #e5e7eb;
    
    --color-green: #10b981;
    --color-red: #ef4444;
    --color-blue: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ТЁМНАЯ ТЕМА */
[data-theme="dark"] {
    --bg-body: #0a0a0b;
    --bg-card: #141415;
    --text-main: #ededed;
    --text-muted: #88888e;
    --border-color: #27272a;
    
    --accent-black: #ffffff;
    --accent-gray: #1e1e20;
    --accent-hover: #27272a;
    
    --color-green: #34d399;
    --color-red: #f87171;
    --color-blue: #60a5fa;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Плавный переход при смене темы */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Управление экранами */
.view-section { display: none; opacity: 0; transition: opacity 0.4s ease; }
.view-section.active { display: block; opacity: 1; animation: fadeIn 0.4s forwards;}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- ЭКРАН АВТОРИЗАЦИИ --- */
#auth-view { min-height: 100vh; display: none; place-items: center; }
#auth-view.active { display: grid; }

.auth-card {
    background: var(--bg-card); padding: 40px; border-radius: 24px;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-color);
}
.justify-center { justify-content: center; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.auth-switch { text-align: center; margin-top: 24px; font-size: 0.9rem; color: var(--text-muted); }

/* Навигация */
.navbar { background-color: var(--bg-card); border-bottom: 1px solid var(--border-color); padding: 12px 0; transition: background-color 0.3s ease; }
.nav-container { max-width: 1000px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.nav-actions { display: flex; align-items: center; gap: 20px; }
.profile-menu { display: flex; align-items: center; gap: 12px; }
.profile-placeholder { width: 36px; height: 36px; background-color: var(--color-blue); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: 600; font-size: 1rem; }

/* Основной UI */
.container { max-width: 800px; margin: 40px auto; padding: 0 20px; }
.hero-section { text-align: center; margin-bottom: 32px; }
.subtitle { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; margin-bottom: 8px; }
.hero-section h1 { font-size: 3.5rem; font-weight: 700; letter-spacing: -0.03em; }

/* Кнопки */
.actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 40px; }
.btn { padding: 12px 20px; border-radius: 10px; font-weight: 500; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s ease; border: none; }
.btn:active { transform: scale(0.97); }

.btn-primary { background-color: var(--accent-black); color: var(--bg-card); }
.btn-primary:hover { opacity: 0.9; box-shadow: var(--shadow-md); }

.btn-secondary { background-color: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background-color: var(--accent-gray); }

.btn-outline { background-color: transparent; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-outline:hover { background-color: var(--bg-card); border-color: var(--text-muted); }

.btn-icon { background: var(--accent-gray); border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: 0.2s; color: var(--text-main); font-size: 1.1rem;}
.btn-icon:hover { background: var(--accent-hover); }

.btn-text { background: none; border: none; color: var(--color-blue); font-weight: 500; cursor: pointer; font-size: 0.9rem; }
.text-muted { color: var(--text-muted); }
.w-100 { width: 100%; justify-content: center; padding: 14px; margin-top: 10px; }

/* Статистика и Карточки */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 40px; }
.stat-card, .transactions-card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); transition: background-color 0.3s ease, border-color 0.3s ease; }
.transactions-card { padding: 0; }
.stat-header { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; margin-bottom: 12px; }
.stat-card h2 { font-size: 1.5rem; font-weight: 600; }

.text-green { color: var(--color-green); } .text-red { color: var(--color-red); } .text-blue { color: var(--color-blue); }

/* История */
.section-header { margin-bottom: 16px; }
ul { list-style: none; }
li { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s; }
li:last-child { border-bottom: none; }
li:hover { background-color: var(--accent-gray); }
.li-left { display: flex; align-items: center; gap: 16px; }
.li-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; justify-content: center; align-items: center; background-color: var(--accent-gray); font-size: 1.2rem; }
.li-info { display: flex; flex-direction: column; gap: 4px; }
.li-title { font-weight: 500; font-size: 0.95rem; }
.li-date { font-size: 0.8rem; color: var(--text-muted); }
.li-right { display: flex; align-items: center; gap: 16px; font-weight: 600; }
.delete-btn { color: var(--text-muted); cursor: pointer; font-size: 1.2rem; background: none; border: none; transition: 0.2s;}
li:hover .delete-btn:hover { color: var(--color-red); }

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); display: none; flex-direction: column; align-items: center; gap: 10px; }
.empty-state i { font-size: 2.5rem; opacity: 0.5; }

/* Модальное окно и Формы */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: 0.2s ease; z-index: 100; }
.modal-backdrop.active { opacity: 1; pointer-events: all; }
.modal-box { background-color: var(--bg-card); width: 100%; max-width: 400px; border-radius: 24px; padding: 24px; box-shadow: var(--shadow-lg); transform: translateY(20px) scale(0.95); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid var(--border-color); }
.modal-backdrop.active .modal-box { transform: translateY(0) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.input-wrapper { position: relative; display: flex; align-items: center; }
.currency-symbol { position: absolute; left: 14px; color: var(--text-muted); font-weight: 500; }

input, select { width: 100%; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 1rem; color: var(--text-main); background-color: var(--bg-card); transition: all 0.2s ease; outline: none; }
.input-wrapper input { padding-left: 30px; }
input:focus, select:focus { border-color: var(--color-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

@media (max-width: 650px) { .hero-section h1 { font-size: 2.8rem; } .actions { flex-direction: column; } .stats-grid { grid-template-columns: 1fr; } }