// Dashboard + Detail screens const { useState, useEffect } = React; // Sun / moon glyph for the dark-mode toggle const ICON_SUN = 'M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M18.4 5.6L17 7M7 17l-1.4 1.4M12 8a4 4 0 100 8 4 4 0 000-8z'; const ICON_MOON = 'M21 12.8A8.5 8.5 0 1111.2 3 6.6 6.6 0 0021 12.8z'; // Auto-generated tasks from rentals + equipment maintenance function buildAutoTasks(rentals = [], equipment = []) { const today = todayISO(); const out = []; rentals.forEach((r) => { const eq = equipment.find((e) => e.id === r.equipmentId); const eqName = eq ? eq.name : r.equipmentName; const dStart = daysBetween(today, r.start) - 1; if (r.status !== 'abgeschlossen' && dStart >= 0 && dStart <= 3) { const when = dStart === 0 ? 'heute' : dStart === 1 ? 'morgen' : `in ${dStart} Tagen`; out.push({ key: 'prep:' + r.id, icon: 'π¦', text: `Equipment fΓΌr ${r.tenantName} vorbereiten`, sub: `${eqName} Β· ${outLabel(r)} ${when}` }); } const dEnd = daysBetween(today, r.end) - 1; if (r.status === 'aktiv' && dEnd >= -3 && dEnd <= 1) { out.push({ key: 'check:' + r.id, icon: 'π', text: 'Equipment nach RΓΌckgabe prΓΌfen', sub: `${r.tenantName} Β· ${eqName}` }); } }); equipment.forEach((e) => (e.maint || []).forEach((m) => { if (!m.done && (m.type === 'defect' || m.type === 'repair')) out.push({ key: 'fix:' + m.id, icon: 'π§', text: m.title, sub: e.name }); })); return out; } // Round checkbox function Check({ done, color }) { const t = useTheme(); const c = color || t.accent; return (