Files
Jorem Juárez 2b2982eff4 Auth, rate limit y helmet (Fase 0 hardening)
- Login con contraseña validada en backend (ADMIN_PASSWORD env var, nunca
  en el bundle del frontend). Token de sesión HMAC sin estado firmado con
  SESSION_SECRET (generado efímeramente si no se define), TTL 7 días.
- Middleware requireAuth en /api/session, /api/extract, /api/reels (GET/
  POST/DELETE), /api/expedientes (GET/POST/DELETE) y /api/generar. Solo
  /api/health y /api/login quedan públicos.
- Rate limiting: login (10/15min), generar (10/5min), extract (20/5min).
- helmet() para cabeceras de seguridad. Eliminado cors() porque todo es
  same-origin vía el nginx del frontend.
- /api/health hace ping a Postgres (SELECT 1) y devuelve 503 si falla.
- docker-compose: healthcheck del backend + frontend espera service_healthy.
  Nuevas env vars ADMIN_PASSWORD y SESSION_SECRET (placeholders en
  .env.example, sin valores reales).
- Frontend: pantalla de login glassmorphism, gate de auth en App, botón
  "Salir", listener de 401 que vuelve al login.
- vite.config.js: proxy de dev (5173 → backend:3001) para probar en local.
2026-05-26 13:32:52 -06:00

421 lines
23 KiB
React
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React, { useState, useEffect, useCallback, useRef } from "react";
import { Film, FileText, Sparkles, Trash2, Plus, Copy, Check, Loader2, Database, ChevronRight, UploadCloud, FileWarning, Lock, LogOut } from "lucide-react";
const API = import.meta.env.VITE_API_BASE || "/api";
const TOKEN_KEY = "adapter_token";
function getToken() { return localStorage.getItem(TOKEN_KEY); }
function setStoredToken(t) { if (t) localStorage.setItem(TOKEN_KEY, t); else localStorage.removeItem(TOKEN_KEY); }
async function api(path, opts = {}) {
const headers = { ...(opts.headers || {}) };
if (opts.body && !(opts.body instanceof FormData) && !headers["Content-Type"]) {
headers["Content-Type"] = "application/json";
}
const t = getToken();
if (t) headers["Authorization"] = "Bearer " + t;
const res = await fetch(API + path, { ...opts, headers });
if (res.status === 401) {
setStoredToken(null);
window.dispatchEvent(new Event("adapter-unauth"));
}
if (!res.ok) {
let msg = "Error " + res.status;
try { msg = (await res.json()).error || msg; } catch {}
throw new Error(msg);
}
return res.json();
}
function Field({ label, value, onChange, textarea, rows = 3, placeholder }) {
const Comp = textarea ? "textarea" : "input";
return (
<label style={{ display: "block", marginBottom: 14 }}>
<span style={lblStyle}>{label}</span>
<Comp value={value} rows={textarea ? rows : undefined} placeholder={placeholder}
onChange={(e) => onChange(e.target.value)} style={inputStyle} />
</label>
);
}
function DropBox({ onText, hint }) {
const [drag, setDrag] = useState(false);
const [status, setStatus] = useState(null);
const inputRef = useRef();
const handle = async (file) => {
if (!file) return;
setStatus({ type: "load", msg: `Subiendo ${file.name}…` });
try {
const fd = new FormData();
fd.append("file", file);
const { text, filename } = await api("/extract", { method: "POST", body: fd });
onText(text, filename);
setStatus({ type: "ok", msg: `${filename} cargado (${text.length} caracteres).` });
} catch (e) {
setStatus({ type: "err", msg: e.message });
}
};
return (
<div style={{ marginBottom: 14 }}>
<span style={lblStyle}>Soltar archivo (MD, TXT, DOCX, PDF)</span>
<div
onDragOver={(e) => { e.preventDefault(); setDrag(true); }}
onDragLeave={() => setDrag(false)}
onDrop={(e) => { e.preventDefault(); setDrag(false); handle(e.dataTransfer.files[0]); }}
onClick={() => inputRef.current?.click()}
style={{
border: `1.5px dashed ${drag ? "var(--accent)" : "rgba(255,255,255,.25)"}`,
background: drag ? "rgba(255,255,255,.10)" : "rgba(255,255,255,.04)",
borderRadius: 14, padding: "20px 16px", textAlign: "center", cursor: "pointer",
transition: "all .15s", color: "var(--muted)",
}}>
<UploadCloud size={22} style={{ opacity: .8 }} />
<div style={{ fontSize: 13, marginTop: 6, color: "var(--ink)" }}>Arrastra aquí o haz clic para subir</div>
<div style={{ fontSize: 11.5, marginTop: 3 }}>{hint}</div>
<input ref={inputRef} type="file" accept=".md,.txt,.docx,.pdf" style={{ display: "none" }}
onChange={(e) => handle(e.target.files[0])} />
</div>
{status && (
<div style={{ marginTop: 8, fontSize: 12.5, display: "flex", alignItems: "center", gap: 6,
color: status.type === "err" ? "var(--accent2)" : status.type === "ok" ? "var(--accent)" : "var(--muted)" }}>
{status.type === "err" ? <FileWarning size={14} /> : status.type === "load" ? <Loader2 size={14} style={{ animation: "spin 1s linear infinite" }} /> : <Check size={14} />}
{status.msg}
</div>
)}
</div>
);
}
function Login({ onLogged }) {
const [pwd, setPwd] = useState("");
const [busy, setBusy] = useState(false);
const [err, setErr] = useState("");
const inputRef = useRef(null);
useEffect(() => { inputRef.current?.focus(); }, []);
const submit = async (e) => {
e?.preventDefault();
if (!pwd) return;
setBusy(true); setErr("");
try {
const { token } = await api("/login", { method: "POST", body: JSON.stringify({ password: pwd }) });
if (!token) throw new Error("Respuesta del servidor sin token.");
setStoredToken(token);
onLogged();
} catch (e2) {
setErr(e2.message);
setPwd("");
inputRef.current?.focus();
} finally { setBusy(false); }
};
return (
<div style={rootStyle}>
<style>{GLOBAL_CSS}</style>
<div style={{ position: "fixed", inset: 0, zIndex: 0, ...bgBlobs }} />
<div style={{ position: "relative", zIndex: 1, minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center", padding: 24 }}>
<form onSubmit={submit} style={{ ...glassCard, width: "100%", maxWidth: 380, padding: 28 }}>
<div style={{ display: "flex", alignItems: "center", gap: 10, marginBottom: 6 }}>
<Lock size={18} color="var(--accent)" />
<h1 style={{ ...h1Style, fontSize: 22 }}>Acceso</h1>
</div>
<p style={{ margin: "0 0 18px", color: "var(--muted)", fontSize: 13 }}>
Adaptador <span style={{ color: "var(--accent)" }}>Reels × Expedientes</span> · Collina Systems
</p>
<label style={{ display: "block", marginBottom: 14 }}>
<span style={lblStyle}>Contraseña</span>
<input
ref={inputRef}
type="password"
value={pwd}
onChange={(e) => setPwd(e.target.value)}
autoComplete="current-password"
disabled={busy}
style={inputStyle}
/>
</label>
<button type="submit" disabled={busy || !pwd} style={genBtn(busy || !pwd)}>
{busy ? <><Loader2 size={17} style={{ animation: "spin 1s linear infinite" }} /> Verificando…</>
: <><Lock size={16} /> Entrar</>}
</button>
{err && <p style={{ color: "var(--accent2)", fontSize: 13, marginTop: 12, marginBottom: 0 }}>{err}</p>}
</form>
</div>
</div>
);
}
export default function App() {
const [authed, setAuthed] = useState(() => !!getToken());
const [authChecking, setAuthChecking] = useState(() => !!getToken());
useEffect(() => {
const onUnauth = () => { setAuthed(false); setAuthChecking(false); };
window.addEventListener("adapter-unauth", onUnauth);
return () => window.removeEventListener("adapter-unauth", onUnauth);
}, []);
useEffect(() => {
if (!getToken()) { setAuthChecking(false); return; }
api("/session")
.then(() => { setAuthed(true); setAuthChecking(false); })
.catch(() => { setAuthed(false); setAuthChecking(false); });
}, []);
const logout = () => { setStoredToken(null); setAuthed(false); };
if (authChecking) {
return (
<div style={rootStyle}>
<style>{GLOBAL_CSS}</style>
<div style={{ position: "fixed", inset: 0, zIndex: 0, ...bgBlobs }} />
<div style={{ position: "relative", zIndex: 1, minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--muted)", fontSize: 13 }}>
<Loader2 size={18} style={{ animation: "spin 1s linear infinite", marginRight: 8 }} /> Verificando sesión…
</div>
</div>
);
}
if (!authed) return <Login onLogged={() => setAuthed(true)} />;
return <MainApp onLogout={logout} />;
}
function MainApp({ onLogout }) {
const [tab, setTab] = useState("generar");
const [reels, setReels] = useState([]);
const [exps, setExps] = useState([]);
const [loaded, setLoaded] = useState(false);
const [loadErr, setLoadErr] = useState("");
const [reelForm, setReelForm] = useState(blankReel());
const [expForm, setExpForm] = useState(blankExp());
const [selReel, setSelReel] = useState(null);
const [selExp, setSelExp] = useState(null);
const [output, setOutput] = useState("");
const [busy, setBusy] = useState(false);
const [err, setErr] = useState("");
const [copied, setCopied] = useState(false);
function blankReel() { return { titulo: "", hook: "", estructura: "", tono: "", formato: "", notas: "" }; }
function blankExp() { return { titulo: "", contenido: "" }; }
const refresh = useCallback(async () => {
try {
const [r, e] = await Promise.all([api("/reels"), api("/expedientes")]);
setReels(r); setExps(e); setLoaded(true); setLoadErr("");
} catch (e) { setLoadErr("No se pudo conectar con el backend: " + e.message); setLoaded(true); }
}, []);
useEffect(() => { refresh(); }, [refresh]);
const addReel = async () => {
if (!reelForm.titulo.trim()) return;
try { await api("/reels", { method: "POST", body: JSON.stringify(reelForm) }); setReelForm(blankReel()); refresh(); }
catch (e) { alert(e.message); }
};
const addExp = async () => {
if (!expForm.titulo.trim() || !expForm.contenido.trim()) return;
try { await api("/expedientes", { method: "POST", body: JSON.stringify(expForm) }); setExpForm(blankExp()); refresh(); }
catch (e) { alert(e.message); }
};
const delReel = async (id) => { await api("/reels/" + id, { method: "DELETE" }); if (selReel === id) setSelReel(null); refresh(); };
const delExp = async (id) => { await api("/expedientes/" + id, { method: "DELETE" }); if (selExp === id) setSelExp(null); refresh(); };
const generar = async () => {
setErr(""); setOutput(""); setCopied(false);
if (!selReel || !selExp) { setErr("Selecciona un análisis técnico y un expediente."); return; }
setBusy(true);
try {
const { brief } = await api("/generar", { method: "POST", body: JSON.stringify({ reelId: selReel, expedienteId: selExp }) });
setOutput(brief || "(Sin respuesta del modelo)");
} catch (e) { setErr(e.message); }
finally { setBusy(false); }
};
const copy = async () => {
try { await navigator.clipboard.writeText(output); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch {}
};
const TABS = [
{ id: "generar", label: "Generar brief", icon: Sparkles },
{ id: "reels", label: "Análisis técnicos", icon: Film, count: reels.length },
{ id: "exp", label: "Expedientes", icon: FileText, count: exps.length },
];
return (
<div style={rootStyle}>
<style>{GLOBAL_CSS}</style>
<div style={{ position: "fixed", inset: 0, zIndex: 0, ...bgBlobs }} />
<div style={{ position: "relative", zIndex: 1 }}>
<header style={headerStyle}>
<div>
<h1 style={h1Style}>Adaptador <span style={{ color: "var(--accent)" }}>Reels × Expedientes</span></h1>
<p style={{ margin: "6px 0 0", color: "var(--muted)", fontSize: 13 }}>
Genera un brief de producción con el guion adaptado al estilo del creador.
</p>
</div>
<div style={{ display: "flex", alignItems: "center", gap: 10 }}>
<div style={pill}><Database size={13} /> {loaded ? `${reels.length} reels · ${exps.length} exp.` : "cargando…"}</div>
<button onClick={onLogout} title="Cerrar sesión" style={logoutBtn}><LogOut size={14} /> Salir</button>
</div>
</header>
{loadErr && <div style={{ ...glassCard, margin: "16px 24px 0", borderColor: "var(--accent2)", color: "var(--accent2)", fontSize: 13 }}>{loadErr}</div>}
<nav style={{ display: "flex", gap: 8, padding: "16px 24px 0", flexWrap: "wrap" }}>
{TABS.map((t) => {
const active = tab === t.id; const Icon = t.icon;
return (
<button key={t.id} onClick={() => setTab(t.id)} style={tabStyle(active)}>
<Icon size={15} /> {t.label}
{typeof t.count === "number" && <span style={countBadge(active)}>{t.count}</span>}
</button>
);
})}
</nav>
<main style={{ maxWidth: 1080, margin: "0 auto", padding: "22px 24px 60px" }}>
{tab === "generar" && (
<div style={{ display: "grid", gap: 18 }}>
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(260px,1fr))", gap: 14 }}>
<Selector title="1 · Análisis técnico" icon={Film} items={reels} selId={selReel} onSel={setSelReel}
empty="Aún no hay análisis. Ve a «Análisis técnicos»." />
<Selector title="2 · Expediente comercial" icon={FileText} items={exps} selId={selExp} onSel={setSelExp}
empty="Aún no hay expedientes. Ve a «Expedientes»." />
</div>
<div style={glassCard}>
<button onClick={generar} disabled={busy} style={genBtn(busy)}>
{busy ? <><Loader2 size={17} style={{ animation: "spin 1s linear infinite" }} /> Generando brief…</>
: <><Sparkles size={17} /> Generar brief de producción</>}
</button>
{err && <p style={{ color: "var(--accent2)", fontSize: 13, marginTop: 12, marginBottom: 0 }}>{err}</p>}
</div>
{output && (
<div style={glassCard}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 12 }}>
<span style={{ fontWeight: 700, fontFamily: "'Syne',sans-serif", fontSize: 18 }}>Brief de producción</span>
<button onClick={copy} style={copyBtn}>{copied ? <><Check size={14} /> Copiado</> : <><Copy size={14} /> Copiar</>}</button>
</div>
<pre style={{ whiteSpace: "pre-wrap", fontFamily: "inherit", fontSize: 14, lineHeight: 1.65, margin: 0 }}>{output}</pre>
</div>
)}
</div>
)}
{tab === "reels" && (
<div style={twoCol}>
<div style={glassCard}>
<h3 style={cardTitle}>Nuevo análisis técnico</h3>
<DropBox hint="Se vuelca en «Notas adicionales»"
onText={(text, fname) => setReelForm((f) => ({ ...f, titulo: f.titulo || fname.replace(/\.[^.]+$/, ""), notas: (f.notas ? f.notas + "\n\n" : "") + text }))} />
<Field label="Etiqueta / nombre del creador" value={reelForm.titulo} onChange={(v) => setReelForm({ ...reelForm, titulo: v })} placeholder="Ej. Reel viral @creador" />
<Field label="Hook / primeros 3 s" value={reelForm.hook} onChange={(v) => setReelForm({ ...reelForm, hook: v })} textarea rows={2} />
<Field label="Estructura y ritmo" value={reelForm.estructura} onChange={(v) => setReelForm({ ...reelForm, estructura: v })} textarea rows={2} />
<Field label="Tono y lenguaje" value={reelForm.tono} onChange={(v) => setReelForm({ ...reelForm, tono: v })} textarea rows={2} />
<Field label="Duración / formato / CTA" value={reelForm.formato} onChange={(v) => setReelForm({ ...reelForm, formato: v })} textarea rows={2} />
<Field label="Notas adicionales" value={reelForm.notas} onChange={(v) => setReelForm({ ...reelForm, notas: v })} textarea rows={3} />
<button onClick={addReel} style={addBtn}><Plus size={16} /> Guardar análisis</button>
</div>
<RecordList items={reels} onDel={delReel} empty="No hay análisis técnicos guardados todavía."
render={(r) => (<>
<strong style={{ fontSize: 15 }}>{r.titulo}</strong>
{r.hook && <p style={metaP}><b style={metaB}>Hook:</b> {r.hook}</p>}
{r.tono && <p style={metaP}><b style={metaB}>Tono:</b> {r.tono}</p>}
{r.formato && <p style={metaP}><b style={metaB}>Formato:</b> {r.formato}</p>}
</>)} />
</div>
)}
{tab === "exp" && (
<div style={twoCol}>
<div style={glassCard}>
<h3 style={cardTitle}>Nuevo expediente comercial</h3>
<DropBox hint="Se vuelca en «Contenido del expediente»"
onText={(text, fname) => setExpForm((f) => ({ ...f, titulo: f.titulo || fname.replace(/\.[^.]+$/, ""), contenido: (f.contenido ? f.contenido + "\n\n" : "") + text }))} />
<Field label="Nombre de la solución" value={expForm.titulo} onChange={(v) => setExpForm({ ...expForm, titulo: v })} placeholder="Ej. Solución CRM para pymes" />
<Field label="Contenido del expediente" value={expForm.contenido} onChange={(v) => setExpForm({ ...expForm, contenido: v })} textarea rows={9} placeholder="Pega o sube propuesta de valor, beneficios, prueba, precio, CTA…" />
<button onClick={addExp} style={addBtn}><Plus size={16} /> Guardar expediente</button>
</div>
<RecordList items={exps} onDel={delExp} empty="No hay expedientes guardados todavía."
render={(e) => (<>
<strong style={{ fontSize: 15 }}>{e.titulo}</strong>
<p style={{ ...metaP, display: "-webkit-box", WebkitLineClamp: 4, WebkitBoxOrient: "vertical", overflow: "hidden" }}>{e.contenido}</p>
</>)} />
</div>
)}
</main>
</div>
</div>
);
}
function Selector({ title, icon: Icon, items, selId, onSel, empty }) {
return (
<div style={glassCard}>
<div style={{ display: "flex", alignItems: "center", gap: 7, ...lblStyle, marginBottom: 12 }}><Icon size={14} /> {title}</div>
{items.length === 0 ? <p style={{ color: "var(--muted)", fontSize: 13, margin: 0 }}>{empty}</p> : (
<div style={{ display: "flex", flexDirection: "column", gap: 7, maxHeight: 240, overflowY: "auto" }}>
{items.map((it) => {
const active = selId === it.id;
return (
<button key={it.id} onClick={() => onSel(it.id)} style={selItem(active)}>
<span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{it.titulo}</span>
{active ? <Check size={15} color="var(--accent)" /> : <ChevronRight size={15} color="var(--muted)" />}
</button>
);
})}
</div>
)}
</div>
);
}
function RecordList({ items, onDel, render, empty }) {
if (items.length === 0)
return <div style={{ ...glassCard, border: "1px dashed rgba(255,255,255,.18)", padding: 40, textAlign: "center", color: "var(--muted)", fontSize: 14 }}>{empty}</div>;
return (
<div style={{ display: "grid", gap: 12, alignContent: "start" }}>
{items.map((it) => (
<div key={it.id} style={{ ...glassCard, padding: 15, display: "flex", justifyContent: "space-between", gap: 12 }}>
<div style={{ minWidth: 0 }}>{render(it)}</div>
<button onClick={() => onDel(it.id)} title="Borrar" style={delBtn}><Trash2 size={15} /></button>
</div>
))}
</div>
);
}
const rootStyle = {
"--ink": "#f3f0ff", "--muted": "#b9b4d6", "--accent": "#9cff8f", "--accent2": "#ff7eb6",
minHeight: "100vh", color: "var(--ink)", position: "relative", overflow: "hidden",
fontFamily: "'DM Sans', ui-sans-serif, system-ui, sans-serif",
background: "linear-gradient(135deg, #1a1040 0%, #2d1b69 45%, #0f2057 100%)",
};
const bgBlobs = { background: "radial-gradient(40% 40% at 15% 20%, rgba(156,255,143,.22), transparent 70%), radial-gradient(45% 45% at 85% 15%, rgba(255,126,182,.20), transparent 70%), radial-gradient(50% 50% at 70% 85%, rgba(120,140,255,.22), transparent 70%)", filter: "blur(8px)" };
const glassCard = { background: "rgba(255,255,255,.07)", backdropFilter: "blur(18px)", WebkitBackdropFilter: "blur(18px)", border: "1px solid rgba(255,255,255,.14)", borderRadius: 18, padding: 18, boxShadow: "0 8px 32px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.12)" };
const headerStyle = { padding: "28px 24px 18px", display: "flex", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 12, borderBottom: "1px solid rgba(255,255,255,.10)" };
const h1Style = { margin: 0, fontFamily: "'Syne', sans-serif", fontSize: 27, fontWeight: 800, letterSpacing: "-0.02em", lineHeight: 1 };
const pill = { display: "flex", alignItems: "center", gap: 6, fontSize: 12, color: "var(--muted)", border: "1px solid rgba(255,255,255,.16)", background: "rgba(255,255,255,.06)", backdropFilter: "blur(10px)", padding: "6px 12px", borderRadius: 20 };
const lblStyle = { display: "block", fontSize: 11, letterSpacing: "0.08em", textTransform: "uppercase", color: "var(--muted)", marginBottom: 6, fontWeight: 600 };
const inputStyle = { width: "100%", background: "rgba(255,255,255,.06)", border: "1px solid rgba(255,255,255,.16)", borderRadius: 10, padding: "10px 12px", color: "var(--ink)", fontSize: 14, fontFamily: "inherit", resize: "vertical", outline: "none", boxSizing: "border-box" };
const twoCol = { display: "grid", gridTemplateColumns: "minmax(300px,400px) 1fr", gap: 18 };
const cardTitle = { margin: "0 0 14px", fontFamily: "'Syne',sans-serif", fontSize: 18 };
const metaP = { margin: "6px 0 0", fontSize: 13, color: "var(--muted)", lineHeight: 1.5 };
const metaB = { color: "var(--ink)" };
const tabStyle = (a) => ({ display: "flex", alignItems: "center", gap: 7, padding: "10px 16px", background: a ? "var(--accent)" : "rgba(255,255,255,.06)", color: a ? "#13123a" : "var(--ink)", backdropFilter: "blur(10px)", border: `1px solid ${a ? "var(--accent)" : "rgba(255,255,255,.14)"}`, borderRadius: 11, fontWeight: 600, fontSize: 13.5, transition: "all .15s" });
const countBadge = (a) => ({ background: a ? "rgba(0,0,0,.16)" : "rgba(255,255,255,.10)", borderRadius: 6, padding: "1px 7px", fontSize: 11.5 });
const genBtn = (b) => ({ width: "100%", padding: "14px", borderRadius: 12, border: "none", background: b ? "rgba(255,255,255,.15)" : "var(--accent)", color: b ? "var(--muted)" : "#13123a", fontWeight: 700, fontSize: 15, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 });
const copyBtn = { display: "flex", alignItems: "center", gap: 6, padding: "7px 12px", background: "rgba(255,255,255,.08)", border: "1px solid rgba(255,255,255,.16)", borderRadius: 9, color: "var(--ink)", fontSize: 13 };
const addBtn = { width: "100%", marginTop: 6, padding: "12px", borderRadius: 11, border: "none", background: "var(--accent)", color: "#13123a", fontWeight: 700, fontSize: 14, display: "flex", alignItems: "center", justifyContent: "center", gap: 7 };
const delBtn = { flexShrink: 0, width: 34, height: 34, borderRadius: 9, border: "1px solid rgba(255,255,255,.16)", background: "rgba(255,255,255,.06)", color: "var(--accent2)", display: "flex", alignItems: "center", justifyContent: "center" };
const logoutBtn = { display: "flex", alignItems: "center", gap: 6, padding: "6px 12px", fontSize: 12, color: "var(--muted)", border: "1px solid rgba(255,255,255,.16)", background: "rgba(255,255,255,.06)", backdropFilter: "blur(10px)", borderRadius: 20 };
const selItem = (a) => ({ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, textAlign: "left", padding: "10px 12px", borderRadius: 10, background: a ? "rgba(156,255,143,.12)" : "rgba(255,255,255,.05)", border: `1px solid ${a ? "var(--accent)" : "rgba(255,255,255,.14)"}`, color: "var(--ink)", fontSize: 13.5, fontWeight: 500 });
const GLOBAL_CSS = `@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Syne:wght@700;800&display=swap');
*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-thumb{background:rgba(255,255,255,.18);border-radius:8px}
button{cursor:pointer;font-family:inherit}@keyframes spin{to{transform:rotate(360deg)}}
::placeholder{color:rgba(185,180,214,.55)}body{margin:0}`;