472 lines
16 KiB
HTML
472 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-bs-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}PFM{% endblock %} — Personal Finance</title>
|
|
|
|
<!-- Bootstrap 5 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<!-- Bootstrap Icons -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
|
<!-- Google Fonts -->
|
|
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
|
|
<style>
|
|
:root {
|
|
--sidebar-width: 240px;
|
|
--sidebar-collapsed-width: 64px;
|
|
--sidebar-bg: #0f172a;
|
|
--sidebar-text: #94a3b8;
|
|
--sidebar-text-active: #f1f5f9;
|
|
--sidebar-hover-bg: #1e293b;
|
|
--sidebar-active-bg: #1e3a5f;
|
|
--sidebar-accent: #3b82f6;
|
|
--topbar-height: 56px;
|
|
--body-bg: #f8fafc;
|
|
--card-bg: #ffffff;
|
|
--text-primary: #0f172a;
|
|
--text-muted: #64748b;
|
|
--border-color: #e2e8f0;
|
|
--income-color: #10b981;
|
|
--expense-color: #ef4444;
|
|
--investment-color: #3b82f6;
|
|
--transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
body {
|
|
font-family: 'DM Sans', sans-serif;
|
|
background: var(--body-bg);
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
/* ── SIDEBAR ──────────────────────────────── */
|
|
#sidebar {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100vh;
|
|
width: var(--sidebar-width);
|
|
background: var(--sidebar-bg);
|
|
display: flex;
|
|
flex-direction: column;
|
|
z-index: 1040;
|
|
transition: var(--transition);
|
|
overflow: hidden;
|
|
}
|
|
|
|
#sidebar.collapsed {
|
|
width: var(--sidebar-collapsed-width);
|
|
}
|
|
|
|
.sidebar-brand {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 0 16px;
|
|
height: var(--topbar-height);
|
|
border-bottom: 1px solid #1e293b;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.sidebar-brand .brand-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
background: var(--sidebar-accent);
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
font-size: 16px;
|
|
color: #fff;
|
|
}
|
|
|
|
.sidebar-brand .brand-text {
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
color: var(--sidebar-text-active);
|
|
letter-spacing: 0.02em;
|
|
transition: var(--transition);
|
|
opacity: 1;
|
|
}
|
|
|
|
#sidebar.collapsed .brand-text { opacity: 0; width: 0; }
|
|
|
|
.sidebar-nav {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 8px 0;
|
|
scrollbar-width: none;
|
|
}
|
|
.sidebar-nav::-webkit-scrollbar { display: none; }
|
|
|
|
.nav-section-label {
|
|
font-size: 10px;
|
|
font-weight: 600;
|
|
letter-spacing: 0.1em;
|
|
text-transform: uppercase;
|
|
color: #475569;
|
|
padding: 16px 20px 4px;
|
|
white-space: nowrap;
|
|
transition: var(--transition);
|
|
}
|
|
#sidebar.collapsed .nav-section-label { opacity: 0; }
|
|
|
|
.sidebar-link {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
padding: 9px 16px;
|
|
color: var(--sidebar-text);
|
|
text-decoration: none;
|
|
font-size: 13.5px;
|
|
font-weight: 400;
|
|
border-radius: 6px;
|
|
margin: 1px 8px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
transition: var(--transition);
|
|
position: relative;
|
|
}
|
|
|
|
.sidebar-link:hover {
|
|
background: var(--sidebar-hover-bg);
|
|
color: var(--sidebar-text-active);
|
|
}
|
|
|
|
.sidebar-link.active {
|
|
background: var(--sidebar-active-bg);
|
|
color: var(--sidebar-text-active);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.sidebar-link.active::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: 0;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
width: 3px;
|
|
height: 60%;
|
|
background: var(--sidebar-accent);
|
|
border-radius: 0 2px 2px 0;
|
|
}
|
|
|
|
.sidebar-link i {
|
|
font-size: 16px;
|
|
flex-shrink: 0;
|
|
width: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.sidebar-link .link-text {
|
|
opacity: 1;
|
|
transition: var(--transition);
|
|
}
|
|
#sidebar.collapsed .link-text { opacity: 0; width: 0; overflow: hidden; }
|
|
|
|
.sidebar-footer {
|
|
padding: 8px;
|
|
border-top: 1px solid #1e293b;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* ── TOPBAR ───────────────────────────────── */
|
|
#topbar {
|
|
position: fixed;
|
|
top: 0;
|
|
left: var(--sidebar-width);
|
|
right: 0;
|
|
height: var(--topbar-height);
|
|
background: var(--card-bg);
|
|
border-bottom: 1px solid var(--border-color);
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 20px;
|
|
z-index: 1030;
|
|
gap: 12px;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
#sidebar.collapsed ~ #topbar,
|
|
#sidebar.collapsed ~ * #topbar {
|
|
left: var(--sidebar-collapsed-width);
|
|
}
|
|
|
|
.topbar-toggle {
|
|
background: none;
|
|
border: none;
|
|
color: var(--text-muted);
|
|
font-size: 18px;
|
|
cursor: pointer;
|
|
padding: 4px 6px;
|
|
border-radius: 6px;
|
|
line-height: 1;
|
|
transition: var(--transition);
|
|
}
|
|
.topbar-toggle:hover { background: var(--border-color); color: var(--text-primary); }
|
|
|
|
.topbar-title {
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
flex: 1;
|
|
}
|
|
|
|
.topbar-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
/* ── MAIN CONTENT ─────────────────────────── */
|
|
#main-content {
|
|
margin-left: var(--sidebar-width);
|
|
margin-top: var(--topbar-height);
|
|
padding: 24px;
|
|
min-height: calc(100vh - var(--topbar-height));
|
|
transition: var(--transition);
|
|
}
|
|
|
|
#sidebar.collapsed ~ #main-content {
|
|
margin-left: var(--sidebar-collapsed-width);
|
|
}
|
|
|
|
/* ── CARDS ────────────────────────────────── */
|
|
.pfm-card {
|
|
background: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
|
|
}
|
|
|
|
.pfm-card-title {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.06em;
|
|
color: var(--text-muted);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
/* ── FLASH MESSAGES ───────────────────────── */
|
|
.flash-container {
|
|
position: fixed;
|
|
top: calc(var(--topbar-height) + 12px);
|
|
right: 16px;
|
|
z-index: 2000;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
max-width: 360px;
|
|
}
|
|
|
|
/* ── RESPONSIVE ───────────────────────────── */
|
|
@media (max-width: 768px) {
|
|
#sidebar {
|
|
transform: translateX(-100%);
|
|
width: var(--sidebar-width) !important;
|
|
}
|
|
#sidebar.mobile-open {
|
|
transform: translateX(0);
|
|
}
|
|
#topbar {
|
|
left: 0 !important;
|
|
}
|
|
#main-content {
|
|
margin-left: 0 !important;
|
|
}
|
|
.sidebar-overlay {
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
.sidebar-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0,0,0,0.4);
|
|
z-index: 1039;
|
|
}
|
|
.sidebar-overlay.active { display: block; }
|
|
|
|
/* ── UTILITIES ────────────────────────────── */
|
|
.text-income { color: var(--income-color) !important; }
|
|
.text-expense { color: var(--expense-color) !important; }
|
|
.text-invest { color: var(--investment-color) !important; }
|
|
.badge-income { background: #d1fae5; color: #065f46; }
|
|
.badge-expense { background: #fee2e2; color: #991b1b; }
|
|
.badge-transfer { background: #dbeafe; color: #1e40af; }
|
|
|
|
code, .mono { font-family: 'DM Mono', monospace; }
|
|
|
|
{% block extra_css %}{% endblock %}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Sidebar overlay (mobile) -->
|
|
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
|
|
<!-- ── SIDEBAR ────────────────────────────────────── -->
|
|
<nav id="sidebar">
|
|
<div class="sidebar-brand">
|
|
<div class="brand-icon"><i class="bi bi-currency-exchange"></i></div>
|
|
<span class="brand-text">PFM</span>
|
|
</div>
|
|
|
|
<div class="sidebar-nav">
|
|
<a href="{{ url_for('dashboard.index') }}"
|
|
class="sidebar-link {% if request.endpoint == 'dashboard.index' %}active{% endif %}">
|
|
<i class="bi bi-grid-1x2"></i>
|
|
<span class="link-text">Dashboard</span>
|
|
</a>
|
|
|
|
<div class="nav-section-label">Money</div>
|
|
|
|
<a href="#" class="sidebar-link {% if 'transactions' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-arrow-left-right"></i>
|
|
<span class="link-text">Transactions</span>
|
|
</a>
|
|
<a href="#" class="sidebar-link {% if 'income' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-arrow-down-circle"></i>
|
|
<span class="link-text">Income</span>
|
|
</a>
|
|
<a href="#" class="sidebar-link {% if 'expenses' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-arrow-up-circle"></i>
|
|
<span class="link-text">Expenses</span>
|
|
</a>
|
|
<a href="#" class="sidebar-link {% if 'accounts' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-wallet2"></i>
|
|
<span class="link-text">Accounts</span>
|
|
</a>
|
|
|
|
<div class="nav-section-label">Planning</div>
|
|
|
|
<a href="#" class="sidebar-link {% if 'budgets' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-pie-chart"></i>
|
|
<span class="link-text">Budgets</span>
|
|
</a>
|
|
<a href="#" class="sidebar-link {% if 'goals' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-bullseye"></i>
|
|
<span class="link-text">Goals</span>
|
|
</a>
|
|
|
|
<div class="nav-section-label">Growth</div>
|
|
|
|
<a href="#" class="sidebar-link {% if 'investments' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-graph-up-arrow"></i>
|
|
<span class="link-text">Investments</span>
|
|
</a>
|
|
<a href="#" class="sidebar-link {% if 'reports' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-file-earmark-bar-graph"></i>
|
|
<span class="link-text">Reports</span>
|
|
</a>
|
|
|
|
<div class="nav-section-label">AI</div>
|
|
|
|
<a href="#" class="sidebar-link {% if 'ai' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-stars"></i>
|
|
<span class="link-text">AI Assistant</span>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="sidebar-footer">
|
|
<a href="{{ url_for('settings.index') if 'settings' in request.blueprints else '#' }}"
|
|
class="sidebar-link {% if 'settings' in request.endpoint|default('') %}active{% endif %}">
|
|
<i class="bi bi-gear"></i>
|
|
<span class="link-text">Settings</span>
|
|
</a>
|
|
<a href="{{ url_for('auth.logout') }}" class="sidebar-link">
|
|
<i class="bi bi-box-arrow-right"></i>
|
|
<span class="link-text">Logout</span>
|
|
</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- ── TOPBAR ──────────────────────────────────────── -->
|
|
<header id="topbar">
|
|
<button class="topbar-toggle" id="sidebarToggle" title="Toggle sidebar">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
<span class="topbar-title">{% block page_title %}{% endblock %}</span>
|
|
<div class="topbar-right">
|
|
<span class="d-none d-sm-inline small text-muted mono">
|
|
{{ current_user.display_name or current_user.username }}
|
|
</span>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- ── FLASH MESSAGES ─────────────────────────────── -->
|
|
<div class="flash-container" id="flashContainer">
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% for category, message in messages %}
|
|
<div class="alert alert-{{ 'danger' if category == 'error' else category }} alert-dismissible fade show shadow-sm mb-0 py-2 px-3"
|
|
style="font-size:13.5px; border-radius:8px;" role="alert">
|
|
{{ message }}
|
|
<button type="button" class="btn-close btn-close-sm" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endwith %}
|
|
</div>
|
|
|
|
<!-- ── MAIN CONTENT ───────────────────────────────── -->
|
|
<main id="main-content">
|
|
{% block content %}{% endblock %}
|
|
</main>
|
|
|
|
<!-- Bootstrap JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<script>
|
|
(function () {
|
|
const sidebar = document.getElementById('sidebar');
|
|
const toggleBtn = document.getElementById('sidebarToggle');
|
|
const overlay = document.getElementById('sidebarOverlay');
|
|
const STORAGE_KEY = 'pfm_sidebar_collapsed';
|
|
const isMobile = () => window.innerWidth < 769;
|
|
|
|
// Restore desktop collapsed state
|
|
if (!isMobile() && localStorage.getItem(STORAGE_KEY) === '1') {
|
|
sidebar.classList.add('collapsed');
|
|
}
|
|
|
|
function toggleSidebar() {
|
|
if (isMobile()) {
|
|
sidebar.classList.toggle('mobile-open');
|
|
overlay.classList.toggle('active');
|
|
} else {
|
|
sidebar.classList.toggle('collapsed');
|
|
localStorage.setItem(STORAGE_KEY, sidebar.classList.contains('collapsed') ? '1' : '0');
|
|
}
|
|
}
|
|
|
|
toggleBtn.addEventListener('click', toggleSidebar);
|
|
overlay.addEventListener('click', function () {
|
|
sidebar.classList.remove('mobile-open');
|
|
overlay.classList.remove('active');
|
|
});
|
|
|
|
// Auto-dismiss flash messages after 4s
|
|
document.querySelectorAll('#flashContainer .alert').forEach(function (el) {
|
|
setTimeout(function () {
|
|
const bsAlert = bootstrap.Alert.getOrCreateInstance(el);
|
|
bsAlert.close();
|
|
}, 4000);
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
{% block extra_js %}{% endblock %}
|
|
</body>
|
|
</html>
|