Files
pyfleet/templates/base.html
T
2026-08-28 19:30:48 +02:00

873 lines
27 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{% block title %}App{% endblock %} · PyFleet</title>
<script>
(function() {
var theme = localStorage.getItem('nexus-theme') || 'light';
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="static/css/animate.min.css"/>
<!-- <link rel="stylesheet" href="{{ url_for('static', filename='css/animate.css') }}"> -->
<!-- <link rel="stylesheet" type="text/css" href="DataTables/DataTables-1.11.4/css/dataTables.bootstrap5.css"/> -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"> -->
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0d0f14;
--surface: #13161e;
--nav-bg: #0a0c10;
--border: #1e2230;
--accent: #5c6ef8;
--accent2: #8b5cf6;
--text: #e2e6f0;
--muted: #5a607a;
--pill-bg: #1a1f2e;
--success: #34d399;
--nav-w: 220px;
--radius: 12px;
}
[data-theme="light"] {
--bg: #f5f6fa;
--surface: #ffffff;
--nav-bg: #ffffff;
--border: #e3e6ef;
--accent: #5c6ef8;
--accent2: #8b5cf6;
--text: #1a1d29;
--muted: #8a8fa3;
--pill-bg: #eef0f8;
--success: #10b981;
}
body {
background: var(--bg);
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 15px;
display: flex;
min-height: 100vh;
transition: background .2s ease, color .2s ease;
}
.input-disabled-look {
background-color: #f5f5f5;
color: #6c757d;
border: 1px solid #ced4da;
cursor: not-allowed;
opacity: 0.7;
pointer-events: none;
}
nav, .card, .msg-banner, .msg-form input, .nav-links a {
transition: background .2s ease, border-color .2s ease, color .2s ease;
}
/* ── NAVBAR ── */
nav {
width: var(--nav-w);
background: var(--nav-bg);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
padding: 28px 16px 24px;
position: fixed;
top: 0; left: 0; bottom: 0;
z-index: 10;
}
.nav-logo {
font-family: 'Space Grotesk', sans-serif;
font-size: 20px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.5px;
padding: 0 8px 28px;
display: flex;
align-items: center;
gap: 40px;
}
.nav-logo span.dot {
width: 8px; height: 8px;
background: var(--accent);
border-radius: 50%;
display: inline-block;
box-shadow: 0 0 8px var(--accent);
}
.nav-section-label {
font-size: 10px;
font-weight: 600;
letter-spacing: 1.2px;
text-transform: uppercase;
color: var(--muted);
padding: 0 8px 10px;
}
.nav-links {
display: flex;
flex-direction: column;
gap: 4px;
flex: 1;
}
.nav-links a {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border-radius: 8px;
text-decoration: none;
color: var(--muted);
font-size: 14px;
font-weight: 500;
transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--border); color: var(--text); }
.nav-links a.active {
background: linear-gradient(135deg, rgba(92,110,248,.18), rgba(139,92,246,.1));
color: var(--text);
border: 1px solid rgba(92,110,248,.25);
}
.nav-links a .icon {
width: 18px; height: 18px;
opacity: .6;
flex-shrink: 0;
}
.nav-links a.active .icon { opacity: 1; }
/* indicator bar */
.nav-links a.active::before {
content: '';
position: absolute;
left: 16px;
width: 3px; height: 18px;
background: var(--accent);
border-radius: 2px;
margin-left: -12px;
}
.nav-links a { position: relative; }
/* message badge in nav */
.msg-badge {
margin-left: auto;
background: var(--accent);
color: #fff;
font-size: 10px;
font-weight: 600;
padding: 2px 7px;
border-radius: 20px;
}
.nav-footer {
padding-top: 16px;
border-top: 1px solid var(--border);
font-size: 12px;
color: var(--muted);
padding-left: 8px;
}
/* ── THEME SWITCH ── */
.theme-switch-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 8px 16px;
margin-bottom: 4px;
border-bottom: 1px solid var(--border);
}
.theme-switch-label {
font-size: 12px;
font-weight: 500;
color: var(--muted);
display: flex;
align-items: center;
gap: 6px;
}
.theme-toggle {
position: relative;
width: 42px;
height: 23px;
background: var(--pill-bg);
border: 1px solid var(--border);
border-radius: 20px;
cursor: pointer;
flex-shrink: 0;
padding: 0;
}
.theme-toggle::after {
content: '☾';
position: absolute;
top: 1px; left: 1px;
width: 17px; height: 17px;
background: var(--accent);
border-radius: 50%;
transition: transform .25s cubic-bezier(.4,0,.2,1), background .2s;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
line-height: 1;
color: #fff;
}
[data-theme="light"] .theme-toggle::after {
content: '☀';
transform: translateX(19px);
background: #f59e0b;
}
/* ── MAIN CONTENT ── */
main {
margin-left: var(--nav-w);
flex: 1;
padding: 40px 48px;
min-height: 100vh;
}
.page-header {
margin-bottom: 36px;
}
.page-eyebrow {
font-size: 11px;
font-weight: 600;
letter-spacing: 1.4px;
text-transform: uppercase;
color: var(--accent);
margin-bottom: 8px;
}
.page-title {
font-family: 'Space Grotesk', sans-serif;
font-size: 28px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.5px;
}
.page-subtitle {
margin-top: 6px;
color: var(--muted);
font-size: 14px;
}
/* ── MENSAJES MÚLTIPLES ── */
.msg-banner-wrap {
background: linear-gradient(135deg, rgba(92,110,248,.1), rgba(139,92,246,.06));
border: 1px solid rgba(92,110,248,.25);
border-radius: var(--radius);
margin-bottom: 24px;
overflow: hidden;
animation: slideIn .25s ease;
}
.msg-banner-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
border-bottom: 1px solid rgba(92,110,248,.15);
font-size: 11px;
font-weight: 600;
letter-spacing: .7px;
text-transform: uppercase;
color: var(--accent);
}
.msg-clear-all {
background: none;
border: 1px solid rgba(92,110,248,.3);
border-radius: 6px;
color: var(--muted);
font-size: 11px;
padding: 3px 10px;
cursor: pointer;
transition: color .15s, border-color .15s;
}
.msg-clear-all:hover { color: var(--text); border-color: var(--muted); }
.msg-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
border-bottom: 1px solid rgba(92,110,248,.08);
gap: 12px;
}
.msg-item:last-child { border-bottom: none; }
.msg-fecha {
font-size: 10px;
color: var(--muted);
margin-bottom: 2px;
}
.msg-texto { font-size: 13px; color: var(--text); }
.msg-del-btn {
background: none;
border: none;
color: var(--muted);
cursor: pointer;
font-size: 13px;
padding: 4px 8px;
border-radius: 6px;
flex-shrink: 0;
transition: color .15s, background .15s;
}
.msg-del-btn:hover { color: #f87171; background: rgba(248,113,113,.1); }
/* ── MESSAGE BANNER ── */
.msg-banner {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
background: linear-gradient(135deg, rgba(92,110,248,.12), rgba(139,92,246,.08));
border: 1px solid rgba(92,110,248,.3);
border-radius: var(--radius);
padding: 14px 18px;
margin-bottom: 28px;
animation: slideIn .25s ease;
}
@keyframes slideIn {
from { opacity:0; transform: translateY(-6px); }
to { opacity:1; transform: translateY(0); }
}
.msg-banner .label {
font-size: 11px;
font-weight: 600;
letter-spacing: .8px;
text-transform: uppercase;
color: var(--accent);
margin-bottom: 3px;
}
.msg-banner .text { color: var(--text); font-size: 14px; }
.msg-banner a.clear-btn {
color: var(--muted);
font-size: 12px;
text-decoration: none;
white-space: nowrap;
padding: 5px 10px;
border: 1px solid var(--border);
border-radius: 6px;
transition: color .15s, border-color .15s;
flex-shrink: 0;
}
.msg-banner a.clear-btn:hover { color: var(--text); border-color: var(--muted); }
/* ── MESSAGE FORM ── */
.msg-form {
display: flex;
gap: 10px;
margin-top: 28px;
max-width: 560px;
}
.msg-form input {
flex: 1;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 14px;
padding: 10px 14px;
outline: none;
transition: border-color .15s;
}
.msg-form input::placeholder { color: var(--muted); }
.msg-form input:focus { border-color: var(--accent); }
.msg-form button {
background: var(--accent);
color: #fff;
border: none;
border-radius: 8px;
font-family: 'Inter', sans-serif;
font-size: 13px;
font-weight: 600;
padding: 10px 20px;
cursor: pointer;
transition: opacity .15s;
white-space: nowrap;
}
.msg-form button:hover { opacity: .85; }
/* ── CARDS ── */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 16px;
margin-top: 28px;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
transition: border-color .2s;
}
.card:hover { border-color: rgba(92,110,248,.35); }
.card-icon {
font-size: 22px;
margin-bottom: 12px;
}
.card-title {
font-family: 'Space Grotesk', sans-serif;
font-size: 14px;
font-weight: 600;
margin-bottom: 6px;
}
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
/* ── SELECT / DROPDOWN ── */
.select-wrap {
position: relative;
}
.form-select {
appearance: none;
-webkit-appearance: none;
cursor: pointer;
padding-right: 38px;
}
.form-select option {
background: var(--surface);
color: var(--text);
}
.select-arrow {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
width: 16px;
height: 16px;
color: var(--muted);
pointer-events: none;
transition: transform .2s;
}
.select-wrap:focus-within .select-arrow {
transform: translateY(-50%) rotate(180deg);
color: var(--accent);
}
.form-select:focus {
border-color: var(--accent);
}
{% block extra_css %}{% endblock %}
thead th {
position: relative;
transition: background .15s, color .15s;
}
thead th:hover {
background: var(--border);
color: var(--text);
}
thead th:hover .sort-icon {
opacity: .7 !important;
}
/* ── CRUD TABLE ── */
.crud-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.search-wrap {
position: relative;
flex: 1;
max-width: 360px;
}
.search-wrap > svg:first-child {
/* .search-wrap svg { */
position: absolute;
left: 12px; top: 50%;
transform: translateY(-50%);
width: 16px; height: 16px;
color: var(--muted);
pointer-events: none;
}
.search-wrap input {
width: 100%;
padding: 9px 14px 9px 38px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 13px;
outline: none;
transition: border-color .15s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: opacity .15s, background .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .85; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: #f87171; border: 1px solid rgba(248,113,113,.35); }
.btn-danger:hover { background: rgba(248,113,113,.08); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.table-wrap {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--pill-bg); }
th {
padding: 12px 16px;
text-align: left;
font-size: 11px;
font-weight: 600;
letter-spacing: .8px;
text-transform: uppercase;
color: var(--muted);
}
td {
padding: 13px 16px;
font-size: 13px;
border-top: 1px solid var(--border);
color: var(--text);
}
tbody tr { transition: background .12s; padding-bottom: }
tbody tr:hover { background: var(--pill-bg); }
.td-id { font-family: monospace; color: var(--muted); font-size: 12px; }
.td-actions { display: flex; gap: 8px; align-items: center; }
.empty-state {
text-align: center;
padding: 48px 24px;
color: var(--muted);
font-size: 14px;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .3; }
/* ── FORM ── */
.form-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 32px;
max-width: 1560px; /* aqui se establece el ancho de los formularios */
}
.form-group { margin-bottom: 5px; }
.form-label {
display: block;
font-size: 12px;
font-weight: 600;
letter-spacing: .5px;
color: var(--muted);
margin-bottom: 7px;
text-transform: uppercase;
}
.form-input {
width: 100%;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 14px;
padding: 10px 14px;
outline: none;
transition: border-color .15s;
}
.nav-submenu-toggle {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
padding: 10px 12px;
border-radius: 8px;
background: none;
border: none;
color: var(--muted);
font-family: 'Inter', sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background .15s, color .15s;
}
.nav-submenu-toggle:hover,
.nav-submenu-toggle.active { background: var(--border); color: var(--text); }
.nav-submenu-items {
display: none;
flex-direction: column;
gap: 2px;
padding-left: 16px;
margin-top: 2px;
}
.nav-submenu-items.open { display: flex; }
.nav-submenu-items a {
font-size: 13px;
padding: 8px 12px;
}
.form-input::placeholder { color: var(--muted); }
.form-input:focus { border-color: var(--accent); }
.form-input:disabled { opacity: .5; cursor: not-allowed; }
.form-actions { display: flex; gap: 10px; margin-top: 28px; }
/* ── FLASH ── */
.flash { padding: 11px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 20px; animation: slideIn .2s ease; }
.flash.ok { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); color: #34d399; }
.flash.error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: #f87171; }
</style>
</head>
<body>
<!-- class="animate__animated animate__backInLeft" -->
<nav id="navbar"
{% if session.pop("animate_navbar", None) %}
class="animate__animated animate__backInUp"
{% endif %}>
<div style="padding: 0 8px 20px; text-align:center;">
<img src="{{ url_for('static', filename='img/logo.png') }}"
alt="Logo"
style="max-width:160px; width:100%; height:auto;">
</div>
<div class="nav-logo">
<span class="dot"></span>PyFleet
<!-- <span class="theme-switch-label">Fleet Operations Platform</span> -->
</div>
<div class="theme-switch-row">
<span class="theme-switch-label">Tema</span>
<button class="theme-toggle" id="themeToggle" aria-label="Cambiar tema claro/oscuro" type="button"></button>
</div>
<div class="nav-section-label">Navegación</div>
<div class="nav-links">
<a href="{{ url_for('index') }}" class="{% if page == 'inicio' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/>
</svg>
Inicio
<!-- {% if session.get('mensaje') and page == 'inicio' %}<span class="msg-badge">!</span>{% endif %} -->
</a>
<!-- <a href="{{ url_for('explorar') }}" class="{% if page == 'explorar' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
Explorar
{% if session.get('mensaje') and page == 'explorar' %}<span class="msg-badge">!</span>{% endif %}
</a> -->
<a href="{{ url_for('vehiculos_list') }}" class="{% if page == 'vehiculos' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M5 17H3a2 2 0 01-2-2V9a2 2 0 012-2h11l4 4v4a2 2 0 01-2 2h-1"/><circle cx="7" cy="17" r="2"/><circle cx="17" cy="17" r="2"/>
</svg>
Vehículos
</a>
<a href="{{ url_for('itv_list') }}" class="{% if page == 'itv' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/>
<line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>
<path d="M9 16l2 2 4-4"/>
</svg>
ITV
</a>
<a href="{{ url_for('viat_list') }}" class="{% if page == 'viat' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="7" width="10" height="10" rx="2"/>
<circle cx="10" cy="12" r="1"/>
<path d="M17 9c1.7 1.7 1.7 4.3 0 6"/>
<path d="M19.5 6.5c3 3 3 8 0 11"/>
</svg>
Via-T
</a>
<!-- <a href="{{ url_for('campus_list') }}" class="{% if page == 'campus' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="2" y="7" width="20" height="14" rx="2"/><path d="M16 7V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v2"/><line x1="12" y1="12" x2="12" y2="16"/><line x1="10" y1="14" x2="14" y2="14"/>
</svg>
Campus
</a> -->
<a href="{{ url_for('contacto') }}" class="{% if page == 'contacto' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
</svg>
Contacto
{% if session.get('mensaje') and page == 'contacto' %}<span class="msg-badge">!</span>{% endif %}
</a>
<div class="nav-submenu" style="margin-top: 100px;">
<hr style="opacity: 0.5;margin-bottom: 5px;">
<button class="nav-submenu-toggle {% if page in ['poblaciones','unidades','tipo'] %}active{% endif %}"
onclick="toggleSubmenu(this)">
<svg class="icon" viewBox="0 0 24 24" fill="none" style="width: 15px;" stroke="currentColor" stroke-width="2">
<ellipse cx="12" cy="5" rx="9" ry="3"/>
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
</svg>
Configuración
<svg class="chevron" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" style="margin-top:10px;margin-left:auto;transition:transform .2s">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
<div class="nav-submenu-items {% if page in ['poblaciones','unidades','tipo'] %}open{% endif %}">
<!-- <a href="{{ url_for('poblaciones_list') }}" class="{% if page == 'poblaciones' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/>
<path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/>
</svg>
Poblaciones
</a> -->
<a href="{{ url_for('unidades_list') }}" class="{% if page == 'unidades' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/>
<rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>
</svg>
Unidades
</a>
<a href="{{ url_for('tipo_list') }}" class="{% if page == 'tipo' %}active{% endif %}">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/>
<line x1="8" y1="18" x2="21" y2="18"/>
<line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/>
<line x1="3" y1="18" x2="3.01" y2="18"/>
</svg>
Tipo vehiculo
</a>
</div>
</div>
</div>
<div class="nav-footer">
{% if mensajes %}
<a href="{{ url_for('index') }}" style="
display:flex;align-items:center;gap:6px;
color:var(--accent);text-decoration:none;font-size:12px;
padding:6px 8px;border-radius:7px;transition:background .15s;
margin-bottom:4px;"
onmouseover="this.style.background='var(--border)'"
onmouseout="this.style.background=''">
💬 {{ mensajes|length }} mensaje{{ 's' if mensajes|length != 1 }} activo{{ 's' if mensajes|length != 1 }}
</a>
{% else %}
<span style="font-size:12px;padding:6px 8px;display:block;">Sin mensajes</span>
{% endif %}
<a href="{{ url_for('logout') }}" style="
display:flex;align-items:center;gap:8px;margin-top:12px;
color:var(--muted);font-size:13px;text-decoration:none;
padding:7px 8px;border-radius:7px;transition:background .15s,color .15s;
" onmouseover="this.style.background='var(--border)';this.style.color='var(--text)'"
onmouseout="this.style.background='';this.style.color='var(--muted)'">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"/>
<polyline points="16 17 21 12 16 7"/>
<line x1="21" y1="12" x2="9" y2="12"/>
</svg>
Cerrar sesión
</a>
</div>
</nav>
<main>
{# Mensajes solo en página de inicio #}
{% if page == 'inicio' %}
{% if mensajes %}
<div class="msg-banner-wrap">
<div class="msg-banner-header">
<div style="display:flex;align-items:center;gap:8px;">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
</svg>
<span>{{ mensajes|length }} mensaje{{ 's' if mensajes|length != 1 }}</span>
</div>
<form method="POST" action="{{ url_for('mensajes_eliminar_todos') }}"
onsubmit="return confirm('¿Eliminar todos los mensajes?')">
<button type="submit" class="msg-clear-all">✕ Eliminar todos</button>
</form>
</div>
{% for m in mensajes %}
<div class="msg-item">
<div>
<div class="msg-fecha">{{ m['fecha'] | fecha_es_hora }}</div>
<div class="msg-texto">{{ m['texto'] }}</div>
</div>
<form method="POST" action="{{ url_for('mensaje_eliminar', id=m['id']) }}">
<button type="submit" class="msg-del-btn" title="Eliminar este mensaje">✕</button>
</form>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
{% endwith %}
{% block content %}{% endblock %}
</main>
<script>
var toggle = document.getElementById('themeToggle');
var html = document.documentElement;
function applyTheme(theme) {
html.setAttribute('data-theme', theme);
localStorage.setItem('nexus-theme', theme);
}
// Sync button state on load
applyTheme(localStorage.getItem('nexus-theme') || 'light');
toggle.addEventListener('click', function() {
var current = html.getAttribute('data-theme') === 'light' ? 'light' : 'dark';
var next = current === 'light' ? 'dark' : 'light';
applyTheme(next);
});
function toggleSubmenu(btn) {
var items = btn.nextElementSibling;
items.classList.toggle('open');
btn.querySelector('.chevron').style.transform =
items.classList.contains('open') ? 'rotate(180deg)' : '';
}
</script>
∫
</body>
</html>