:root {
  --bg: #0e0f13; --panel: #171920; --panel2: #1e212a; --line: #2a2e3a; --text: #e9ebf1; --muted: #8d93a5;
  --accent: #ff4d5e; --ok: #2fd17a; --warn: #f5b942; --err: #ff5d5d; --blue: #5aa2ff;
  --yt: #ff3b3b; --tw: #9b6bff; --kk: #53fc18; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
code, .secret { font-family: ui-monospace, Consolas, monospace; }
code { background: #0003; border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 16px 0 8px; }

.topbar { display: flex; align-items: center; gap: 18px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 22px; justify-content: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #ff4d5e33; display: inline-block; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.tabs a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.tabs a:hover { background: var(--panel2); color: var(--text); }
.tabs a.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.pill.on { color: var(--ok); } .pill.off { color: var(--err); }

main { padding: 18px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
textarea { width: 100%; resize: vertical; min-height: 110px; }
label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
label > input, label > select, label > textarea { color: var(--text); font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; white-space: nowrap; text-decoration: none; display: inline-block; }
.btn:hover { border-color: #3d4352; } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ok { background: #1d3b2a; border-color: #2c6b46; color: #bff0d2; }
.btn.danger { color: #ffb3b3; border-color: #5b2b2b; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.error { color: var(--err); min-height: 1em; margin: 0; }

.subtabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subtabs button { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 7px 14px; border-radius: 99px; cursor: pointer; font: inherit; }
.subtabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

.live-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); margin-bottom: 16px; flex-wrap: wrap; }
.live-banner .big-dot { width: 14px; height: 14px; border-radius: 50%; background: #555; }
.live-banner.live { border-color: #6b2a31; background: linear-gradient(90deg, #2a1418, var(--panel)); }
.live-banner.live .big-dot { background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #ff4d5e88; } 70% { box-shadow: 0 0 0 10px #ff4d5e00; } 100% { box-shadow: 0 0 0 0 #ff4d5e00; } }
.live-banner .title { font-weight: 700; font-size: 15px; }
.live-banner .spacer { flex: 1; }

.kv { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.kv > span { color: var(--muted); font-size: 12.5px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dest { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); margin-bottom: 10px; }
.dest .badge { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #000; }
.b-youtube { background: var(--yt); color: #fff !important; } .b-twitch { background: var(--tw); color: #fff !important; } .b-kick { background: var(--kk); } .b-custom { background: #8d93a5; }
.dest .name { font-weight: 600; } .dest .meta { color: var(--muted); font-size: 12px; word-break: break-all; }
.state { font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: 600; display: inline-block; }
.state.live { background: #ff4d5e22; color: #ff8a95; } .state.starting, .state.reconnecting { background: #f5b94222; color: var(--warn); }
.state.idle, .state.off { background: #8d93a522; color: var(--muted); } .state.error { background: #ff5d5d22; color: var(--err); } .state.on { background: #2fd17a22; color: var(--ok); }
.state.connecting { background: #f5b94222; color: var(--warn); }
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #3a3f4d; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(18px); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.stat span { color: var(--muted); font-size: 12px; } .stat b { font-size: 15px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }

.thumb-box { width: 100%; aspect-ratio: 16/9; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.plat-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel2); }
.plat-card h3 { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.results { margin-top: 10px; }
.results div { font-size: 13px; padding: 3px 0; }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; max-height: 260px; overflow-y: auto; }
.suggest-list div { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.suggest-list div:hover { background: var(--panel2); }
.suggest-list img { width: 26px; height: 36px; object-fit: cover; border-radius: 3px; }

.chat-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
@media (max-width: 900px) { .chat-wrap { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }
.chat-log { height: 62vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.msg { padding: 4px 0; word-wrap: break-word; }
.msg .p { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.msg .a { font-weight: 700; margin-right: 4px; }
.msg .t { color: #d7dae3; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 8px; max-width: 420px; transition: .3s; box-shadow: 0 8px 24px #0007; }
.toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: var(--warn); } .toast.out { opacity: 0; transform: translateY(8px); }
.note { background: #5aa2ff14; border: 1px solid #5aa2ff40; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.note.warn { background: #f5b94214; border-color: #f5b94250; }
ol.steps { padding-left: 20px; margin: 6px 0; } ol.steps li { margin-bottom: 6px; }
.app-frame-wrap { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.app-frame-bar { padding: 6px 2px 10px; display: flex; gap: 12px; }
.app-frame { flex: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
details summary { cursor: pointer; color: var(--blue); }
.stack > input, .stack > select { width: 100%; }
.thumb-box { max-width: 520px; }

/* ---------- Perfiles ---------- */
.profile-chip { --pc: #ff4d5e; display: inline-flex; align-items: center; gap: 7px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.profile-chip span { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.profile-card { --pc: #ff4d5e; border-top: 4px solid var(--pc); margin-bottom: 0; }
.profile-card.active { box-shadow: 0 0 0 1px var(--pc), 0 8px 30px #0006; }
.profile-card.new { border-top-color: var(--line); border-style: dashed; }
.pdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--pc); margin-right: 8px; }
.profile-card .row { flex-wrap: wrap; }
.acc-list { margin: 12px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.acc-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.acc-line img, img.avatar { width: 22px; height: 22px; border-radius: 50%; }
.badge-mini { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; color: #000; display: inline-block; }
.b-record { background: #ff4d5e; color: #fff !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line); padding: 3px 8px 3px 4px; border-radius: 99px; font-size: 12.5px; }
.chip.off { opacity: .5; }
.color-dots { display: inline-flex; gap: 4px; margin: 0 6px; }
.cdot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.cdot.sel { border-color: #fff; }

/* ---------- Interruptores rápidos ---------- */
.switchboard { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.sw-item { display: flex; flex-direction: row; align-items: center; gap: 8px; background: #0005; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px 6px 8px; cursor: pointer; }
.sw-item .sw-name { font-weight: 600; font-size: 13px; }
.sw-item .sw-state { font-size: 11.5px; color: var(--muted); min-width: 70px; }
.sw-item.st-live { border-color: #6b2a31; } .sw-item.st-live .sw-state { color: #ff8a95; font-weight: 700; }
.sw-item.st-reconnecting .sw-state, .sw-item.st-starting .sw-state { color: var(--warn); }
.sw-item.st-error .sw-state { color: var(--err); }
.sw-item.st-off { opacity: .65; }

/* ---------- Analíticas / gráficas ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.vcard { --pc: #fff; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--pc); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.vcard span { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .4px; }
.vcard b { font-size: 30px; font-variant-numeric: tabular-nums; }
.vcard small { color: var(--muted); font-size: 12px; }
.chart-wrap { position: relative; margin-left: 46px; margin-top: 8px; }
.chart { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-y span { position: absolute; left: -46px; width: 40px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-x { display: flex; justify-content: space-between; margin-left: 46px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-empty { height: 120px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.verdict { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); background: var(--panel2); }
.verdict.ok { border-color: #2c6b46; background: #2fd17a12; } .verdict.warn { border-color: #6b5a2c; background: #f5b94212; } .verdict.err { border-color: #6b2c2c; background: #ff5d5d12; }
.big-num { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 11.5px; }
.stat.good { border-left: 3px solid var(--ok); } .stat.mid { border-left: 3px solid var(--warn); } .stat.bad { border-left: 3px solid var(--err); }

/* ---------- Overlays ---------- */
.ov-preview { margin-top: 12px; height: 260px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ov-preview.small-h { height: 90px; }
.ov-preview iframe { width: 100%; height: 100%; border: 0; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.icon-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.icon-prev { width: 64px; height: 64px; display: grid; place-items: center; background: repeating-conic-gradient(#2a2e3a 0 25%, #1e212a 0 50%) 50% / 16px 16px; border-radius: 10px; }
.icon-prev img { max-width: 52px; max-height: 52px; }

.logbox { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; height: 260px; overflow: auto; font: 12px/1.55 ui-monospace, Consolas, monospace; color: #c9cdd8; white-space: pre-wrap; word-break: break-word; margin: 0; }
.logbox .lg-error, .logbox .lg-warn { color: var(--warn); } .logbox .lg-ok { color: var(--ok); }

/* Logos oficiales de las plataformas (public/logos) */
img.plogo { display: inline-block; vertical-align: middle; object-fit: contain; flex: none; }
.acc-line img.plogo { width: 16px; height: 16px; border-radius: 0; }
.msg img.plogo { margin-right: 6px; vertical-align: -3px; }
.chip img.plogo { margin-left: 2px; }
.dest .badge.logo { background: #0e0f13; border: 1px solid var(--line); }
.icon-prev img.plogo { width: 32px; height: 32px; }
