:root {
  --bg: #070b18;
  --bg-2: #0b1124;
  --panel: rgba(20, 28, 52, .72);
  --panel-solid: #141c34;
  --panel-2: #1b2544;
  --line: rgba(120, 140, 200, .14);
  --line-2: rgba(120, 140, 200, .24);
  --text: #eef2ff;
  --muted: #8a94b8;
  --brand: #00b4d8;
  --brand-2: #3b82f6;
  --grad: linear-gradient(135deg, #00c6e0 0%, #3b82f6 100%);
  --ok: #22c55e;
  --danger: #f43f5e;
  --gold: #fbbf24;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--text); font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(59, 130, 246, .16), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(0, 180, 216, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; margin: 2px 0 0; }
.min0 { min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #26304f; border-radius: 8px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); padding: 9px 16px; border-radius: 11px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .06s, box-shadow .2s; white-space: nowrap; font-weight: 500;
}
.btn:hover { background: #24305a; border-color: rgba(120, 140, 200, .4); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 6px 20px -8px rgba(0, 180, 216, .7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn.danger { background: rgba(244, 63, 94, .08); border-color: rgba(244, 63, 94, .35); color: #fda4af; }
.btn.danger:hover { background: rgba(244, 63, 94, .18); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; cursor: pointer; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { color: #fda4af; background: rgba(244, 63, 94, .12); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Formularios ---------- */
input[type=text], input[type=password], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; background: rgba(7, 11, 24, .6); border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 180, 216, .18); }
input[type=datetime-local] { color-scheme: dark; }
textarea { resize: vertical; }
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }

.switch { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 14px; cursor: pointer; margin-top: 18px; }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 99px; background: #2a3458; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 16px;
  background: rgba(9, 13, 28, .85); border-right: 1px solid var(--line); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff; box-shadow: 0 8px 24px -8px rgba(0, 180, 216, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 17px; letter-spacing: 2.5px; }
.brand-logo { padding: 6px 4px 0; }
.brand-logo img { width: 100%; height: auto; display: block; }
.login-card .brand-logo { justify-content: center; padding: 0; margin-bottom: 18px; }
.login-card .brand-logo img { max-width: 320px; }
.brand-text span { font-size: 9.5px; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button, .nav-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; text-align: left; transition: background .15s, color .15s;
}
.nav button:hover, .nav-btn:hover { background: rgba(120, 140, 200, .08); color: var(--text); }
.nav button.active { background: linear-gradient(90deg, rgba(0, 180, 216, .18), rgba(59, 130, 246, .06)); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav button.active svg { color: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.conn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 11px; background: rgba(120, 140, 200, .06); font-size: 13px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.conn.on .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }

.content { display: flex; flex-direction: column; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 32px 8px; }
.page-head h1 { margin: 2px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: 1.2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.head-right { display: flex; align-items: center; gap: 20px; }
.head-right .btn { text-decoration: none; color: var(--text); }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; text-align: right; }
.clock b { display: block; color: var(--text); font-size: 20px; font-weight: 700; }

main { padding: 20px 32px 8px; width: 100%; max-width: 1500px; }
.tab { display: none; }
.tab.active { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(120, 140, 200, .1); color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 .card + .card { margin-top: 0; }
.grid-2.tight { gap: 12px; }
.name-num { grid-template-columns: 1fr 120px; }
.num-chip { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 40px; height: 40px; border-radius: 10px; background: #fff; color: #06112a; line-height: 1; }
.num-chip small { font-size: 8.5px; font-weight: 700; letter-spacing: .5px; color: #4b5a7a; }
.num-chip b { font-size: 18px; font-weight: 800; }
.form-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding: 14px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }

/* ---------- Estadísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: var(--accent); opacity: .8; }
.stat::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--accent); opacity: .07; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.stat-icon svg { width: 22px; height: 22px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* ---------- Tarjetas de votos ---------- */
.vote-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.vcard {
  --c: var(--brand);
  position: relative; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background:
    radial-gradient(300px 140px at 0% 0%, color-mix(in srgb, var(--c) 20%, transparent), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow); transition: box-shadow .3s, border-color .3s, transform .2s;
}
.vcard:hover { border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.vcard.leader { border-color: rgba(251, 191, 36, .45); box-shadow: 0 0 0 1px rgba(251, 191, 36, .2), 0 12px 40px -16px rgba(251, 191, 36, .45); }
.vcard.flash { box-shadow: 0 0 0 2px var(--c), 0 0 32px -6px var(--c); transform: translateY(-2px); }
.vcard .head { display: flex; align-items: center; gap: 12px; }
.vcard .who { min-width: 0; flex: 1; }
.vcard .name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcard .party { color: var(--muted); font-size: 12.5px; }
.medal {
  flex: none; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: rgba(120, 140, 200, .12); color: var(--muted);
}
.medal.r1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #4a2c00; }
.medal.r2 { background: linear-gradient(135deg, #e5e7eb, #94a3b8); color: #1f2937; }
.medal.r3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #3b1300; }
.crown { position: absolute; top: -11px; left: 22px; display: none; align-items: center; gap: 4px; padding: 2px 10px 2px 8px; border-radius: 99px; background: linear-gradient(135deg, #fde68a, #f59e0b); color: #4a2c00; font-size: 11px; font-weight: 800; letter-spacing: .5px; }
.crown svg { width: 13px; height: 13px; }
.vcard.leader .crown { display: inline-flex; }

.avatar {
  --c: #334; width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; color: #fff; background-color: var(--c); background-size: cover; background-position: center;
  box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--c);
}
.avatar.sm { width: 38px; height: 38px; font-size: 13px; box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 3px var(--c); }
.avatar.xs { width: 26px; height: 26px; font-size: 10px; box-shadow: none; }
.avatar.xl { width: 80px; height: 80px; font-size: 24px; }

.vcard .numbers { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 14px 0 4px; }
.vcard .votes { font-size: 34px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; line-height: 1; }
.vcard .votes small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.vcard .pct { font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: #fff; background: color-mix(in srgb, var(--c) 35%, transparent); font-variant-numeric: tabular-nums; }
.vcard .trend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.vcard .trend.up { color: #4ade80; }
.bar { height: 8px; background: rgba(7, 11, 24, .7); border-radius: 99px; overflow: hidden; margin: 10px 0 14px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, #fff 0%), var(--c)); box-shadow: 0 0 12px var(--c); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

.vbtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vbtns .btn { padding: 11px 0; font-weight: 800; font-size: 16px; border-radius: 12px; }
.btn.add { background: color-mix(in srgb, var(--c) 20%, rgba(7, 11, 24, .5)); border-color: color-mix(in srgb, var(--c) 40%, transparent); color: #fff; }
.btn.add:hover { background: color-mix(in srgb, var(--c) 38%, rgba(7, 11, 24, .5)); border-color: var(--c); }
.custom { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; margin-top: 8px; }
.custom input { text-align: center; font-weight: 600; }
.custom .btn { padding: 0 14px; }
.custom input::-webkit-inner-spin-button { display: none; }

.floater {
  position: absolute; pointer-events: none; font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 0 12px var(--c);
  animation: floatUp .9s ease-out forwards; z-index: 3;
}
.floater.neg { color: #fda4af; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.9); } to { opacity: 0; transform: translate(-50%, -48px) scale(1.2); } }

.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: var(--brand); }
.empty h3 { color: var(--text); margin: 12px 0 4px; }
.empty p { margin: 0 0 16px; }

/* ---------- Columna lateral: dona + historial ---------- */
.side-col { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }
.side-col .card + .card { margin-top: 0; }
.donut-wrap { position: relative; width: 210px; height: 210px; margin: 0 auto 10px; }
.donut { width: 100%; height: 100%; }
.donut-bg { fill: none; stroke: rgba(120, 140, 200, .1); stroke-width: 22; }
.donut-seg { fill: none; stroke-width: 22; transition: stroke-dasharray .7s cubic-bezier(.2, .8, .2, 1), stroke-dashoffset .7s cubic-bezier(.2, .8, .2, 1); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dc-pct { font-size: 30px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.dc-name { font-size: 12px; color: var(--muted); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend b { font-variant-numeric: tabular-nums; }

.events { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.events li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; animation: fadeUp .3s ease; }
.events li:last-child { border-bottom: 0; }
.events .ev-text { flex: 1; min-width: 0; }
.events .ev-text div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.events .ev-text time { font-size: 11.5px; color: var(--muted); }
.events .amt { font-weight: 800; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 8px; font-size: 12.5px; }
.events .amt.pos { color: #4ade80; background: rgba(34, 197, 94, .12); }
.events .amt.neg { color: #fda4af; background: rgba(244, 63, 94, .12); }
.events .amt.sys { color: var(--muted); background: rgba(120, 140, 200, .1); }
.events .empty-ev { color: var(--muted); justify-content: center; padding: 20px; }

/* ---------- Candidatos ---------- */
.cand-list { display: flex; flex-direction: column; }
.cand-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 120px 110px auto; align-items: center; gap: 16px; padding: 12px 6px; border-top: 1px solid var(--line); }
.cand-row .nm { font-weight: 600; }
.cand-row .pt { font-size: 12.5px; color: var(--muted); }
.cand-row .vt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.cand-row .vt small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cand-row .actions { display: flex; gap: 6px; }
.color-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.color-tag i { width: 16px; height: 16px; border-radius: 5px; }
.danger-zone { border-color: rgba(244, 63, 94, .25); }
.danger-zone .card-head { margin: 0; }

/* ---------- Modal ---------- */
dialog {
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-2); border-radius: 20px; padding: 24px;
  width: min(460px, 94vw); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
}
dialog[open] { animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(3, 6, 15, .7); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialog-head h3 { margin: 0; font-size: 18px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.photo-row { display: flex; gap: 18px; align-items: center; }
.photo-row p { margin-top: 6px; }
.file-btn { margin: 0; color: var(--text); font-size: 13px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; transition: transform .1s; }
.colors button:hover { transform: scale(1.1); }
.colors button.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--panel-solid) inset; }
.colors input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px dashed var(--line-2); border-radius: 9px; background: none; cursor: pointer; }
.colors input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.colors input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }

/* ---------- Exportar ---------- */
.export-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.export {
  position: relative; display: block; padding: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.export:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.export h3 { margin: 16px 0 4px; font-size: 16px; }
.export p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.export .fmt { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: var(--accent); padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ---------- Publicidad ---------- */
.row-gap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.switch.inline { margin: 0; font-size: 13px; }
select.compact { width: auto; padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.live-chip { display: inline-flex; align-items: center; gap: 6px; color: #fca5a5; background: rgba(239, 68, 68, .12); }
.live-chip.off { color: var(--muted); background: rgba(120, 140, 200, .1); }
.live-chip.off .live-dot { background: var(--muted); animation: none; }
.onair { margin-bottom: 20px; }
.onair-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: center; }
.onair .ad-slot { box-shadow: 0 0 0 1px var(--line-2), 0 20px 50px -20px rgba(0, 0, 0, .8); }
.oa-sponsor { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-progress { height: 6px; border-radius: 99px; background: rgba(7, 11, 24, .7); overflow: hidden; margin: 12px 0 8px; }
.oa-progress i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; }
.oa-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }

.ad-list { display: flex; flex-direction: column; }
.ad-row {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 150px 150px auto; gap: 18px; align-items: center;
  padding: 14px 6px; border-top: 1px solid var(--line);
}
.ad-row.onair-row { background: linear-gradient(90deg, rgba(239, 68, 68, .08), transparent 60%); border-radius: 12px; }
.ad-row .ad-slot { border-radius: 8px; }
.ad-row .ad { animation: none; }
.ad-row .nm { font-weight: 700; }
.ad-row .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-row .meta { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.ad-row .meta b { color: var(--text); font-weight: 600; }
.ad-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; margin-top: 6px; }
.status.active { color: #4ade80; background: rgba(34, 197, 94, .12); }
.status.scheduled { color: #93c5fd; background: rgba(59, 130, 246, .14); }
.status.expired { color: #fda4af; background: rgba(244, 63, 94, .12); }
.status.paused { color: var(--muted); background: rgba(120, 140, 200, .1); }
.status.live { color: #fff; background: #dc2626; }
.ad-empty-list { text-align: center; padding: 36px 10px; color: var(--muted); border-top: 1px solid var(--line); }

.tips-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tips-grid b { font-size: 13.5px; }
.tips-grid p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

dialog.wide { width: min(640px, 94vw); max-height: 92vh; }
.center { text-align: center; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(7, 11, 24, .6); border: 1px solid var(--line-2); }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.segmented button.sel { background: var(--panel-2); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.dropzone {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 16px 18px;
  border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: rgba(0, 180, 216, .06); }
.dropzone b { display: block; font-size: 14px; }
.dropzone span { font-size: 12.5px; color: var(--muted); }
.color-full { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(7, 11, 24, .6); cursor: pointer; }

/* ---------- Transmisión ---------- */
.notice { border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); margin-bottom: 20px; color: #fde68a; }
.notice b { display: block; color: #fef3c7; margin-bottom: 2px; }
.stream-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.stream-top .card + .card { margin-top: 0; }
.st-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 99px; background: rgba(120, 140, 200, .12); font-size: 16px; }
.st-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.st-pill.live { background: #dc2626; color: #fff; }
.st-pill.live .dot { background: #fff; animation: blinkDot 1.2s infinite; }
.st-pill.starting, .st-pill.reconnecting { background: rgba(251, 191, 36, .16); color: #fde68a; }
.st-pill.starting .dot, .st-pill.reconnecting .dot { background: var(--gold); animation: blinkDot .8s infinite; }
.st-pill.error { background: rgba(244, 63, 94, .16); color: #fda4af; }
@keyframes blinkDot { 50% { opacity: .25; } }
.st-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.st-grid div { padding: 14px; border-radius: 12px; background: rgba(7, 11, 24, .5); border: 1px solid var(--line); }
.st-grid span { display: block; font-size: 12px; color: var(--muted); }
.st-grid b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.st-grid b.warn { color: var(--gold); }
.st-error { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .3); color: #fda4af; font-size: 13px; font-family: ui-monospace, monospace; word-break: break-word; }
.meter { margin-bottom: 16px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.meter-top b { color: var(--text); font-variant-numeric: tabular-nums; }
.meter-bar { height: 10px; border-radius: 99px; background: rgba(7, 11, 24, .7); overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--ok); transition: width .6s, background .3s; }
.meter-bar i.mid { background: var(--gold); }
.meter-bar i.high { background: var(--danger); }
.key-row { display: flex; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.guide ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.guide p { margin-top: 14px; }
.logs { margin: 0; max-height: 300px; overflow: auto; padding: 14px; border-radius: 12px; background: rgba(3, 6, 15, .7); border: 1px solid var(--line); font: 12.5px/1.6 ui-monospace, Consolas, monospace; color: #b8c2e0; white-space: pre-wrap; word-break: break-word; }
.logs .t { color: #5b678c; }

.music { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.music .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.music .row-gap { margin-top: 8px; }
.st-pill.listening { background: rgba(34, 197, 94, .15); color: #86efac; }
.st-pill.listening .dot { background: var(--ok); animation: blinkDot 1.2s infinite; }
.st-pill.waiting { background: rgba(59, 130, 246, .15); color: #93c5fd; }
.st-pill.waiting .dot { background: #60a5fa; }
.st-pill.closed { background: rgba(120, 140, 200, .12); }
.fb-detail { min-height: 18px; margin: -4px 0 4px; }
.fb-detail.err { color: #fda4af; }
.fb-feed { max-height: 520px; }
.fb-feed .msg { color: var(--muted); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; padding: 1px 6px; border-radius: 6px; background: rgba(120, 140, 200, .14); }

/* ---------- Avisos ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 12px 16px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-left: 4px solid var(--ok); box-shadow: var(--shadow);
  animation: slideIn .25s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.out { animation: slideOut .25s ease forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }

footer.credit { margin-top: auto; text-align: center; color: var(--muted); font-size: 12px; padding: 28px; }
footer.credit b { color: var(--text); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 32px; }
.login-card .brand { flex-direction: column; text-align: center; margin-bottom: 8px; }
.login-card .brand-mark { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
.login-card .brand-text b { font-size: 22px; }
.login-card h2 { text-align: center; font-size: 15px; font-weight: 500; color: var(--muted); margin: 6px 0 14px; }
.login-card .btn { width: 100%; margin-top: 22px; padding: 12px; }
.err-msg { color: #fda4af; font-size: 13px; min-height: 18px; margin-top: 12px; text-align: center; }

/* ---------- Responsivo ---------- */
@media (max-width: 1250px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vote-layout { grid-template-columns: 1fr; }
  .side-col { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .ad-row { grid-template-columns: 200px minmax(0, 1fr) auto; }
  .stream-top { grid-template-columns: 1fr; }
  .ad-row .meta { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; padding: 6px; gap: 0;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .sidebar .brand, .sidebar-foot .conn { display: none; }
  .nav { flex-direction: row; flex: 1; }
  .nav button, .nav-btn { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 8px 4px; text-align: center; }
  .nav button.active { box-shadow: inset 0 2px 0 var(--brand); }
  .sidebar-foot { margin: 0; }
  .content { padding-bottom: 70px; }
  .page-head, main { padding-left: 16px; padding-right: 16px; }
  .grid-2, .side-col { grid-template-columns: 1fr; }
  .cand-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .cand-row .color-tag, .cand-row .vt { display: none; }
  .onair-grid, .tips-grid { grid-template-columns: 1fr; }
  .head-right .btn { display: none; }
  .st-grid, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stream-top .card-head { flex-direction: column; align-items: flex-start; }
  .ad-row { grid-template-columns: 1fr; gap: 10px; }
  .ad-row .actions { justify-content: flex-start; }
  .nav button, .nav-btn { font-size: 9.5px; }
  .toasts { bottom: 80px; right: 12px; left: 12px; }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-icon { width: 32px; height: 32px; border-radius: 9px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat .v { font-size: 18px; }
  .stat .sub { display: none; }
  .form-bar { flex-direction: column; align-items: stretch; }
}
