:root { 
    --bg: #f3f4f6; 
    --card: #ffffff; 
    --text: #111827; 
    --text-muted: #6b7280;
    --primary: #2563eb; 
    --primary-light: #eff6ff;
    --green: #10b981; 
    --red: #ef4444; 
    --orange: #f59e0b; 
    --border: #e5e7eb;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg); color: var(--text); padding-bottom: 80px; -webkit-font-smoothing: antialiased; }
.container { max-width: 800px; margin: 0 auto; padding: 16px; }

/* АВТОРИЗАЦИЯ */
.auth-body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
.login-box { background: white; padding: 32px 24px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); width: 100%; max-width: 340px; }
.login-box input { width: 100%; padding: 14px; margin-bottom: 16px; border: 1px solid var(--border); background: #f9fafb; border-radius: 10px; box-sizing: border-box; font-size: 16px; transition: border 0.2s; }
.login-box input:focus { outline: none; border-color: var(--primary); background: white; }
.login-box button { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.login-box button:hover { background: #1d4ed8; }
.login-box .error { color: var(--red); margin-bottom: 16px; text-align: center; font-size: 14px; background: #fef2f2; padding: 10px; border-radius: 8px; }
.login-box .switch-link { display: block; text-align: center; margin-top: 20px; color: var(--primary); text-decoration: none; font-size: 14px; font-weight: 500; }
.login-box h2 { text-align: center; margin-top: 0; margin-bottom: 24px; color: var(--text); font-size: 24px; }

/* ОСНОВНОЙ ИНТЕРФЕЙС */
.card { background: var(--card); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: 0 4px 6px rgba(0,0,0,0.02), 0 1px 3px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.02); }

.top-nav { display: flex; gap: 8px; margin-bottom: 20px; background: var(--card); padding: 8px; border-radius: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.top-nav a { flex: 1; text-align: center; padding: 12px 16px; text-decoration: none; color: var(--text-muted); border-radius: 10px; font-weight: 600; white-space: nowrap; font-size: 14px; transition: all 0.2s; }
.top-nav a.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3); }

.alert { background: #fef2f2; color: #b91c1c; padding: 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid #fecaca; font-weight: 500; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }

.date-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: var(--card); padding: 8px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.date-nav a { font-size: 20px; text-decoration: none; color: var(--primary); padding: 8px 16px; font-weight: bold; background: var(--primary-light); border-radius: 8px; }
.date-nav h2 { font-size: 18px; font-weight: 700; }

.period-nav { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.period-nav a { flex: 1; text-align: center; padding: 10px; text-decoration: none; color: var(--text-muted); border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.2s; }
.period-nav a.active { background: var(--text); color: white; }

.stats { display: flex; justify-content: space-between; text-align: center; }
.stat-item { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
input, select, button { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); font-size: 16px; width: 100%; background: #f9fafb; transition: all 0.2s; }
input:focus, select:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px var(--primary-light); }
button { background: var(--primary); color: white; border: none; font-weight: 600; cursor: pointer; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); }
button:hover { background: #1d4ed8; }
button:active { opacity: 0.8; transform: translateY(1px); }
.btn-danger { background: #fee2e2; color: var(--red); width: auto; padding: 8px 12px; font-size: 14px; box-shadow: none; }
.btn-danger:hover { background: #fecaca; }

.tx-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.tx-item:last-child { border-bottom: none; padding-bottom: 0; }
.tx-cat { font-weight: 600; font-size: 15px; color: var(--text); }
.tx-note { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.tx-actions { display: flex; align-items: center; gap: 12px; }

.plan-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.plan-row:last-child { border-bottom: none; }
.plan-input { width: 130px; padding: 10px 12px; font-size: 15px; text-align: right; }

/* ШКАЛЫ ПЛАНА */
.cat-stat { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.cat-stat:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.cat-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.cat-title { font-weight: 400; font-size: 15px; color: var(--text); -webkit-tap-highlight-color: transparent; user-select: none; }
.cat-values { font-size: 13px; color: var(--text-muted); font-weight: 500; text-align: right; }
.compare-bar-bg { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; position: relative; }
.compare-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.compare-bar-fill.green { background: var(--green); }
.compare-bar-fill.red { background: var(--red); }
.compare-bar-fill.blue { background: var(--primary); }

.daily-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.daily-table th { color: var(--text-muted); font-weight: 600; font-size: 13px; padding: 12px 8px; text-align: left; border-bottom: 2px solid var(--border); }
.daily-table td { padding: 14px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.daily-table tr:last-child td { border-bottom: none; }

.cat-list { list-style: none; margin-bottom: 24px; }
.cat-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #f9fafb; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--border); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-left: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.in { background: #d1fae5; color: #065f46; }
.badge.out { background: #fee2e2; color: #991b1b; }

.summary-box { border-radius: 16px; padding: 24px; margin-bottom: 20px; text-align: center; }
.summary-box.good { background: #ecfdf5; border: 1px solid #a7f3d0; }
.summary-box.bad { background: #fef2f2; border: 1px solid #fecaca; }
.summary-title { font-size: 15px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.summary-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.summary-box.good .summary-value { color: var(--green); }
.summary-box.bad .summary-value { color: var(--red); }

.logout-btn { display: block; text-align: center; margin-top: 32px; color: var(--red); text-decoration: none; font-weight: 600; padding: 16px; background: white; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }

/* НАВИГАЦИЯ ПО МЕСЯЦАМ */
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: var(--card); padding: 10px; border-radius: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.month-nav a { text-decoration: none; color: var(--primary); font-weight: bold; padding: 8px 20px; font-size: 20px; background: var(--primary-light); border-radius: 12px; transition: background 0.2s; }
.month-nav a:hover { background: #dbeafe; }
.month-nav .title { font-size: 18px; font-weight: 800; color: var(--text); text-align: center; }

.section-title { font-size: 15px; font-weight: 800; margin: 24px 0 16px; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; }
.section-title:first-child { margin-top: 0; }
