/* Panel de ClipViral: la misma "sala de control" que la app y la web.
   Negro de fondo, paneles azul noche, rojo solo para la acción principal y lo activo,
   azul señal para lo seleccionado y los gráficos, Bahnschrift para títulos y números. */
:root {
  --bg: #000;
  --navy: #08142f;
  --panel: rgba(8, 20, 47, 0.78);
  --panel-solid: #08142f;
  --panel-2: rgba(19, 41, 92, 0.72);
  --line: rgba(120, 160, 255, 0.13);
  --line-2: rgba(120, 160, 255, 0.26);
  --text: #fff;
  --muted: #8ea3c8;
  --soft: #c6d1ef;
  --red: #e5161d;
  --red-2: #ff3a3f;
  --signal: #3a6cff;
  --ok: #22c55e;
  --bad: #ff3a3f;
  --warn: #f5a524;
  --radius: 16px;
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .9, .3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--signal); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 255, .16); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.error { color: #ff8f8f; min-height: 1.2em; margin: 6px 0 0; }
a { color: #9db4ff; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
h1, h2, h3, h4, .brand { font-family: var(--display); }

/* ---------- Fondo: luces azul noche, rejilla de monitor y barra de barrido ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #000; }
.bg::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(120, 150, 255, .05) 1px, transparent 1px) 0 0 / 44px 44px,
              linear-gradient(90deg, rgba(120, 150, 255, .05) 1px, transparent 1px) 0 0 / 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 60% 0%, #000 25%, transparent 80%);
          mask-image: radial-gradient(ellipse 90% 70% at 60% 0%, #000 25%, transparent 80%);
}
.bg::after {
  content: ""; position: absolute; left: 0; right: 0; top: -20%; height: 18%;
  background: linear-gradient(180deg, transparent, rgba(58, 108, 255, .06), transparent);
  animation: sweep 13s linear infinite;
}
@keyframes sweep { to { transform: translateY(720%); } }
.blob { position: absolute; border-radius: 50%; will-change: transform; }
.b1 { width: 980px; height: 980px; left: -340px; top: -440px; background: radial-gradient(closest-side, rgba(28, 70, 180, .5), rgba(10, 26, 63, .25) 55%, transparent); animation: drift1 38s ease-in-out infinite; }
.b2 { width: 1100px; height: 1100px; right: -440px; bottom: -560px; background: radial-gradient(closest-side, rgba(17, 42, 105, .72), rgba(6, 16, 40, .32) 60%, transparent); animation: drift2 46s ease-in-out infinite; }
.b3 { width: 560px; height: 560px; left: 50%; top: 26%; background: radial-gradient(closest-side, rgba(229, 22, 29, .1), transparent); animation: drift3 31s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(180px, 120px) scale(1.08); } }
@keyframes drift2 { 50% { transform: translate(-200px, -90px) scale(.94); } }
@keyframes drift3 { 33% { transform: translate(-160px, 120px); } 66% { transform: translate(120px, 60px) scale(1.1); } }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: .2px; }
.brand small { font: 600 11px "Segoe UI", system-ui, sans-serif; color: var(--soft); padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 99px; background: rgba(58, 108, 255, .12); }
.brand.big { font-size: 28px; justify-content: center; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--red); font-size: 12px; color: #fff; box-shadow: 0 6px 20px rgba(229, 22, 29, .45), inset 0 1px 0 rgba(255, 255, 255, .25); }
.brand.big .logo { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }

/* ---------- Tarjetas y formularios ---------- */
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--soft); font-weight: 600; letter-spacing: .1px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line-2);
  background: #040a1c; color: var(--text); font: inherit; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, textarea:hover, select:hover { border-color: rgba(157, 180, 255, .4); }
input:focus, textarea:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(58, 108, 255, .25); }
input:disabled { opacity: .5; }
input[type=checkbox], input[type=radio] { accent-color: var(--red); }
label.check { display: flex; align-items: center; gap: 9px; color: var(--soft); cursor: pointer; }
label.check input { width: 17px; height: 17px; flex: none; }
details summary { cursor: pointer; margin-bottom: 10px; }

/* ---------- Botones ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); cursor: pointer; border-radius: 11px; padding: 10px 16px;
  font: 600 14px/1 "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--panel-2);
  transition: transform .18s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(157, 180, 255, .5); background: rgba(28, 56, 120, .8); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: var(--red); border-color: var(--red-2); box-shadow: 0 8px 24px rgba(229, 22, 29, .32), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { background: var(--red-2); box-shadow: 0 12px 30px rgba(229, 22, 29, .45), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: rgba(58, 108, 255, .1); }
.btn.danger { background: rgba(229, 22, 29, .12); border-color: rgba(229, 22, 29, .4); color: #ffb0b2; }
.btn.danger:hover { background: rgba(229, 22, 29, .22); border-color: rgba(255, 58, 63, .7); }
.btn.small { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.wide { width: 100%; padding: 13px; font-size: 15px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .35); animation: ripple .6s linear; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.pop-in { animation: popIn .5s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Entrar ---------- */
.login { display: grid; place-items: center; height: 100%; padding: 16px; }
.login-card { width: min(390px, 100%); padding: 34px 30px 28px; background: rgba(8, 20, 47, .88); border-color: var(--line-2); overflow: hidden; }
.login-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--signal), transparent); animation: barrido 3s ease-in-out infinite; }
@keyframes barrido { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.login-card p { text-align: center; }
.login-card .brand { margin-bottom: 4px; }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; height: 100%; }
.sidebar {
  border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 26px;
  background: rgba(3, 8, 22, .72); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.sidebar > .brand { padding: 0 6px; }
.sidebar nav { display: grid; gap: 3px; }
.sidebar nav button {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 10px 12px; border-radius: 11px; font: 600 14px "Segoe UI", system-ui, sans-serif; cursor: pointer; transition: color .2s, background .25s, transform .2s var(--ease), border-color .25s;
}
.sidebar nav button i { font-style: normal; display: grid; place-items: center; width: 20px; height: 20px; flex: none; }
.sidebar nav button i svg { width: 19px; height: 19px; }
.sidebar nav button:hover { color: var(--text); background: rgba(58, 108, 255, .08); transform: translateX(2px); }
.sidebar nav button.active { color: #fff; background: linear-gradient(90deg, rgba(58, 108, 255, .3), rgba(58, 108, 255, .08)); border-color: rgba(58, 108, 255, .35); }
.sidebar nav button.active::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); box-shadow: 0 0 10px rgba(229, 22, 29, .7); }
.sidebar nav button.active i { color: #9db8ff; }
.me { margin-top: auto; display: grid; gap: 8px; padding: 12px; border-radius: 13px; border: 1px solid var(--line); background: rgba(8, 20, 47, .6); }
.me-name { font-weight: 600; font-size: 12.5px; color: var(--soft); word-break: break-word; }

.content { overflow-y: auto; padding: 28px 34px 70px; scroll-behavior: smooth; }
.tab { display: grid; gap: 16px; animation: fade .3s ease both; max-width: 1400px; }
.tab > * { animation: rise .5s var(--ease) both; }
.tab > *:nth-child(2) { animation-delay: .05s; }
.tab > *:nth-child(3) { animation-delay: .1s; }
.tab > *:nth-child(4) { animation-delay: .15s; }
.tab > *:nth-child(5) { animation-delay: .2s; }
.tab > *:nth-child(n+6) { animation-delay: .25s; }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tab-head h1 { margin: 0; font-size: 32px; font-stretch: 85%; font-variation-settings: "wdth" 85; line-height: 1.1; }
.search { max-width: 340px; padding-left: 38px; background: #040a1c url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea3c8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 12px 50% / 17px no-repeat; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.badge.on { background: rgba(34, 197, 94, .13); border-color: rgba(34, 197, 94, .35); color: #86efac; }
.badge.off { background: rgba(229, 22, 29, .13); border-color: rgba(229, 22, 29, .4); color: #ffb0b2; }

/* ---------- Resumen: números grandes con su mini gráfico ---------- */
.stats { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.stat {
  grid-column: span 2; position: relative; overflow: hidden; padding: 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); animation: popIn .55s var(--ease) both; transition: border-color .25s, transform .25s var(--ease);
}
.stat:hover { border-color: var(--line-2); transform: translateY(-2px); }
.stat.big { grid-column: span 3; padding: 18px 18px 0; min-height: 138px; background: linear-gradient(180deg, rgba(19, 41, 92, .7), rgba(8, 20, 47, .8)); border-color: var(--line-2); }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .label svg { width: 16px; height: 16px; color: #8fb0ff; flex: none; }
.stat .value { font: 700 26px/1.1 var(--display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.big .value { font-size: 36px; font-stretch: 85%; font-variation-settings: "wdth" 85; }
.stat .nota { color: var(--muted); font-size: 12px; margin-top: 8px; }
.stat .value.good { color: #86efac; }
.stat .value.warn { color: #fdba74; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; width: 100%; }
.spark path.l { fill: none; stroke: var(--signal); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.4s .3s var(--ease) forwards; }
.spark path.a { fill: rgba(58, 108, 255, .16); stroke: none; animation: fade .8s .9s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.bars { display: grid; grid-template-rows: auto 1fr; gap: 10px; height: 200px; }
.bars .sum { color: var(--muted); font-size: 12.5px; }
.bars .sum b { font: 700 22px var(--display); color: #fff; margin-right: 6px; }
.bars .cols {
  display: flex; align-items: flex-end; gap: 6px; min-height: 0; padding-top: 18px;
  background: repeating-linear-gradient(0deg, transparent 0 calc(25% - 1px), rgba(120, 160, 255, .08) calc(25% - 1px) 25%);
  background-size: 100% calc(100% - 20px); background-repeat: no-repeat; background-position: 0 0;
}
.bars .bar { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; cursor: default; }
.bars .bar span {
  width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; min-height: 3px;
  background: linear-gradient(180deg, #6f93ff, var(--signal) 60%, #1c3f99); transform-origin: bottom; animation: grow .8s var(--ease) both;
  transition: filter .2s, box-shadow .2s;
}
.bars.alt .bar span { background: linear-gradient(180deg, #a9bdff, #5b80ff 60%, #23439c); }
.bars .bar.today span { background: linear-gradient(180deg, var(--red-2), var(--red)); box-shadow: 0 0 14px rgba(229, 22, 29, .45); }
.bars .bar:hover span { filter: brightness(1.35); box-shadow: 0 0 16px rgba(58, 108, 255, .6); }
.bars .bar small { font-size: 10px; color: var(--muted); }
.bars .bar.today small { color: #ff9a9d; font-weight: 700; }
.bars .bar b { font-size: 10px; color: var(--soft); font-weight: 600; min-height: 13px; }
.bars .bar[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  padding: 5px 9px; border-radius: 8px; background: #0d1d42; border: 1px solid var(--line-2); font-size: 11.5px; color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); z-index: 2; pointer-events: none;
}
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Reparto (usuarios por plan, clips por modo) */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; background: rgba(4, 10, 28, .7); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.pill b { color: #fff; font-family: var(--display); font-size: 15px; }
.pill small { color: var(--muted); font-weight: 600; }
.pill i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dist { display: flex; gap: 3px; height: 14px; width: 100%; border-radius: 99px; overflow: hidden; margin-bottom: 14px; background: rgba(255, 255, 255, .04); }
.dist span { min-width: 6px; transform-origin: left; animation: crece .9s var(--ease) both; }
@keyframes crece { from { transform: scaleX(0); } }

.list { display: grid; gap: 8px; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  background: rgba(4, 10, 28, .55); border-radius: 12px; border: 1px solid var(--line); animation: popIn .4s var(--ease) both; transition: border-color .2s, background .2s;
}
.item:hover { border-color: var(--line-2); background: rgba(13, 29, 66, .6); }
.item .sub { color: var(--muted); font-size: 12px; }
.item .grow { flex: 1; min-width: 0; }
.who-row { display: flex; align-items: center; gap: 11px; min-width: 0; }
.av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--display); color: #fff; background: linear-gradient(135deg, #2a55c7, #13295c); border: 1px solid var(--line-2); }
.pos { flex: none; width: 26px; font: 700 18px var(--display); color: var(--muted); text-align: center; }
.item:first-child .pos { color: var(--red-2); }
.meter { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .06); margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--signal); transform-origin: left; animation: crece 1s .2s var(--ease) both; }

/* ---------- Tablas ---------- */
.table-card { padding: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: rgba(6, 14, 34, .97); z-index: 1; }
tbody tr { transition: background .2s; animation: rise .35s var(--ease) both; }
tbody tr:hover { background: rgba(58, 108, 255, .07); }
tbody tr:last-child td { border-bottom: 0; }
.u-name { font-weight: 600; }
.u-mail { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: rgba(120, 160, 255, .12); color: var(--soft); border: 1px solid transparent; }
/* Diagnóstico del servidor */
.diag-card { margin-bottom: 16px; }
.diag-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.diag-head h3 { margin: 0 0 2px; }
.diag-ok { margin: 6px 0 0; color: #86efac; font-weight: 600; }
.diag-lista { display: grid; gap: 8px; }
.diag { border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 10, 28, .55); }
.diag.bad { border-color: rgba(229, 22, 29, .4); }
.diag.warn { border-color: rgba(245, 165, 36, .35); }
.diag summary { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; list-style: none; }
.diag summary::-webkit-details-marker { display: none; }
.diag summary::after { content: "›"; margin-left: auto; color: var(--soft); transition: transform .2s; }
.diag[open] summary::after { transform: rotate(90deg); }
.diag summary .tag { flex: none; }
.diag-cuerpo { padding: 0 13px 13px; display: grid; gap: 6px; font-size: 13.5px; }
.diag-cuerpo p { margin: 0; }
.diag-cuerpo ol { margin: 0; padding-left: 20px; display: grid; gap: 3px; }
.diag-msg { display: grid; gap: 6px; padding: 9px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.diag-texto { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; color: #ffd7d8; }
.diag-msg .btn { justify-self: start; }
.tag.ok { background: rgba(34, 197, 94, .13); color: #86efac; border-color: rgba(34, 197, 94, .25); }
.tag.bad { background: rgba(229, 22, 29, .13); color: #ffb0b2; border-color: rgba(229, 22, 29, .3); }
.tag.warn { background: rgba(245, 158, 11, .13); color: #fcd34d; border-color: rgba(245, 158, 11, .3); }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.tag.admin { background: rgba(58, 108, 255, .2); color: #b9cbff; border-color: rgba(58, 108, 255, .4); }

/* ---------- Planes ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.plan-card { display: grid; gap: 4px; transition: border-color .25s, transform .25s var(--ease); }
.plan-card:hover { border-color: var(--line-2); }
.plan-card .margin { font-size: 12.5px; padding: 11px 12px; border-radius: 11px; background: rgba(4, 10, 28, .7); border: 1px solid var(--line); margin-bottom: 12px; color: var(--soft); }
.plan-card .margin b { color: #86efac; }

/* ---------- Actualizaciones ---------- */
.upload { display: grid; gap: 6px; }
.upload > .btn, .plan-card > .btn, .form > .btn { justify-self: start; min-width: 180px; }
.form > .btn { margin-top: 4px; }
.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.drop {
  display: grid; place-items: center; gap: 6px; padding: 28px 20px; border: 2px dashed rgba(58, 108, 255, .4); border-radius: 14px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease); text-align: center; color: var(--text); background: rgba(4, 10, 28, .45);
}
.drop:hover, .drop.over { border-color: var(--signal); background: rgba(58, 108, 255, .1); transform: scale(1.01); }
.drop.over { box-shadow: 0 0 0 4px rgba(58, 108, 255, .18); }
.drop-icon { font-size: 28px; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.row { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.row > label:first-child { flex: 1; min-width: 160px; }
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-bottom: 12px; }
.progress span {
  display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s;
  background: linear-gradient(90deg, var(--signal), #8fb0ff, var(--signal)); background-size: 200% 100%; animation: brillo 1.2s linear infinite;
}
@keyframes brillo { to { background-position: -200% 0; } }

.form { max-width: 640px; }

/* ---------- Ventana de usuario ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 3, 12, .62); display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s ease; z-index: 10; padding: 16px; overflow-y: auto; }
.modal-card { width: min(480px, 100%); background: rgba(8, 20, 47, .96); border-color: var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .7); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-card h2 { margin: 0 0 4px; font-size: 24px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 20; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  position: relative; padding: 12px 16px 12px 18px; border-radius: 12px; background: rgba(13, 29, 66, .96); border: 1px solid var(--line-2); overflow: hidden;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 34px rgba(0, 0, 0, .55); animation: toastIn .4s var(--ease) both;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--signal); }
.toast.ok::before { background: var(--ok); }
.toast.bad { border-color: rgba(229, 22, 29, .5); }
.toast.bad::before { background: var(--red); }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------- Ajustes y permisos ---------- */
.social-box { padding: 14px; border-radius: 14px; background: rgba(4, 10, 28, .55); border: 1px solid var(--line); margin-bottom: 14px; }
.social-box h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.redirect { display: block; padding: 9px 11px; margin: 6px 0 12px; border-radius: 10px; background: rgba(58, 108, 255, .1); border: 1px dashed rgba(58, 108, 255, .45); font-size: 12px; word-break: break-all; cursor: pointer; transition: background .2s, border-color .2s; }
.redirect:hover { background: rgba(58, 108, 255, .2); border-color: var(--signal); }
#socialForm { margin-top: 16px; }
.ck-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.ck-row:last-child { border-bottom: 0; }
.ck-row .grow { flex: 1; min-width: 0; }
.ck-row .redirect { margin: 6px 0 4px; }
.ck { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 13px; }
.ck.ok { background: rgba(34, 197, 94, .16); color: #86efac; }
.ck.bad { background: rgba(229, 22, 29, .16); color: #ffb0b2; }
.ck.copy { background: rgba(58, 108, 255, .16); }
#checklist .card { margin-bottom: 16px; }
#checklist h3 { display: flex; align-items: center; gap: 10px; }
.with-badge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#claudeNow code { padding: 2px 6px; border-radius: 6px; background: rgba(58, 108, 255, .16); }

/* ---------- Pantallas medianas y celular ---------- */
@media (max-width: 1180px) {
  .stat.big { grid-column: span 6; }
  .stat { grid-column: span 4; }
}
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .content { padding: 20px 16px 60px; }
  .tab-head h1 { font-size: 27px; }
  .search { max-width: none; }
  .drops { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat.big { grid-column: span 12; }
  .stat { grid-column: span 6; }
  .stat.big .value { font-size: 32px; }
  .bars .cols { gap: 3px; }
  .bars .bar b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spark path.l { stroke-dashoffset: 0; }
}

/* Publicaciones del servidor */
.posts-intro { margin: -6px 0 14px; max-width: 760px; }
.posts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 16px 0; }
.posts-head h3 { margin: 0; }
.ref-box { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.incl-box { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.incl-box .incl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.incl-box .meter { margin: 8px 0 6px; }
.incl-box p { margin: 0 0 8px; }
.bono-card { display: grid; gap: 10px; margin: 14px 0; border-color: rgba(52, 211, 153, .35); }
.bono-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bono-head h3 { margin: 0 0 4px; font-size: 17px; }
.bono-head p { margin: 0; }
.bono-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.bono-campos small { display: block; margin-top: 4px; }
.bono-card .btn { justify-self: start; }
.fondos-total { display: grid; gap: 2px; padding: 14px 16px; border-radius: 12px; background: rgba(4, 10, 28, .7); border: 1px solid var(--line-2); }
.fondos-total small { color: var(--muted); font-size: 12.5px; }
.fondos-total strong { font: 700 34px/1.15 var(--display); color: #86efac; font-variant-numeric: tabular-nums; }
.fondos-lista { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.fondos-lista li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fondos-lista em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.fondos-lista b { min-width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.fondos-veredicto { margin: 0; font-weight: 600; color: #86efac; }
.fondos-veredicto.falta { color: #fbbf24; }
.warn-txt { margin: 0; color: #fbbf24; font-size: 13px; }
.ref-box h3 { margin: 0 0 8px; font-size: 16px; }
.ref-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ref-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; word-break: break-all; }
.ref-mov { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; margin: 6px 0 4px; }
.ref-mov > div { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.ref-mov .mas { color: #86efac; font-weight: 700; white-space: nowrap; }
.ref-mov .menos { color: #fcd34d; font-weight: 700; white-space: nowrap; }
.ref-saldo { font-weight: 800; color: #fcd34d; }
.opcion { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; cursor: pointer; color: var(--soft); }
.opcion:has(input:checked) { border-color: rgba(96, 165, 250, .6); background: rgba(59, 130, 246, .1); }
.opcion input[type=radio] { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.opcion b { color: var(--text, #fff); }
.opcion input[type=number] { width: 80px; display: inline-block; margin: 0 4px; padding: 4px 8px; }
.post-clip, .post-state { white-space: normal; }
.post-clip { min-width: 220px; max-width: 360px; }
.post-state { min-width: 140px; max-width: 260px; }
.post-caption { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-error { color: #ffb0b2; }
.post-actions { flex-direction: column; align-items: stretch; gap: 6px; min-width: 132px; }
.post-actions .btn { justify-content: center; white-space: nowrap; }

/* Pestaña Telegram: cómo avanza un mensaje a todos */
.tg-barra { height: 6px; margin-top: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.tg-barra i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3a6cff, #86efac); transition: width .4s; }
#tgMsgForm details { margin: 2px 0; }
#tgMsgForm details label { margin-top: 8px; }

/* Usuarios en tarjetas: nombre, clips, plan y si está clipeando ahora (con el video). Al tocarla salen sus opciones. */
.ufiltros { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 14px; }
.chip-f { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(8, 20, 47, .6); color: var(--soft); font: 600 13px var(--display); cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.chip-f b { min-width: 20px; padding: 0 6px; border-radius: 99px; background: rgba(120, 160, 255, .14); font-weight: 700; font-size: 12px; text-align: center; }
.chip-f:hover { border-color: rgba(120, 160, 255, .45); color: #fff; }
.chip-f.active { background: rgba(58, 108, 255, .22); border-color: var(--signal); color: #fff; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.ucard { position: relative; display: flex; flex-direction: column; gap: 12px; text-align: left; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; animation: rise .45s var(--ease) both; transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; }
.ucard:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.ucard.live { border-color: rgba(229, 22, 29, .55); box-shadow: 0 0 0 1px rgba(229, 22, 29, .18), 0 10px 34px rgba(229, 22, 29, .12); }
.ucard.live::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--red), var(--red-2), transparent); }
.ucard.baneado { opacity: .62; }
.uc-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.uc-head .grow { flex: 1; min-width: 0; }
.uc-head .u-name, .uc-head .u-mail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-head .av { width: 40px; height: 40px; font-size: 16px; }
.uc-head .tag { flex: none; }
.uc-nums { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.uc-nums > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.uc-nums > div:nth-child(2) { align-items: center; text-align: center; }
.uc-nums > div:last-child { align-items: flex-end; text-align: right; }
.uc-nums b { font: 700 22px/1 var(--display); }
.uc-nums small { color: var(--muted); font-size: 11.5px; }
.uc-nums small.warn-txt { font-size: 11.5px; font-weight: 600; color: #fbbf24; }
.uc-act { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.uc-act .grow { flex: 1; min-width: 0; }
.uc-act-t { font-weight: 600; color: var(--soft); font-size: 13px; }
.uc-act-t small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.uc-act.on .uc-act-t { color: #ffb0b2; }
.uc-video { margin-top: 2px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-video a { color: #fff; }
.uc-act-sub { margin-top: 2px; color: var(--muted); font-size: 12px; }
.pulso, .apagado { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
.pulso { background: var(--red-2); box-shadow: 0 0 0 0 rgba(255, 58, 63, .6); animation: pulso 1.6s infinite; }
.apagado { background: #39445f; }
.chip-f .pulso { margin-top: 0; width: 8px; height: 8px; }
@keyframes pulso { 70% { box-shadow: 0 0 0 9px rgba(255, 58, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 58, 63, 0); } }
.uc-vacio { grid-column: 1 / -1; text-align: center; padding: 26px; }
.m-act { margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 10, 28, .55); }
@media (prefers-reduced-motion: reduce) { .pulso { animation: none; } .ucard { animation: none; } }

/* =====================================================================
   Rediseño 2026: panel más sobrio y profesional.
   Menos brillo y animación, más orden: menú por grupos, barra de arriba con el estado del servidor,
   tarjetas planas con números claros, tablas densas y una ficha lateral para cada cuenta.
   ===================================================================== */
:root {
  --panel: rgba(9, 17, 38, .92);
  --panel-2: rgba(22, 36, 74, .9);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --radius: 12px;
  --muted: #8b98b8;
  --soft: #cdd5ea;
}
body { font-size: 13.5px; }
.bg::after { display: none; }
.blob { opacity: .55; animation-duration: 90s !important; }
.card { -webkit-backdrop-filter: none; backdrop-filter: none; padding: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.card h3 { font-size: 13.5px; color: #e6ebf7; margin-bottom: 12px; letter-spacing: .2px; }
.tab > * { animation: rise .35s var(--ease) both; }
.btn { font-size: 13px; padding: 9px 14px; border-radius: 9px; }
.btn.small { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 6px 9px; min-width: 32px; line-height: 1; }
.btn:hover { transform: none; }
.btn.primary { box-shadow: 0 4px 14px rgba(229, 22, 29, .28); }
input, textarea, select { border-radius: 9px; padding: 9px 12px; border-color: var(--line-2); background: #050b1d; }

/* ----- Menú lateral por grupos ----- */
.layout { grid-template-columns: 236px 1fr; }
.sidebar { padding: 18px 12px 14px; gap: 18px; background: rgba(4, 8, 20, .94); overflow-y: auto; }
.sidebar > .brand { font-size: 18px; }
.sidebar nav { gap: 1px; }
.nav-grupo { margin: 14px 12px 6px; font: 700 10.5px "Segoe UI", system-ui, sans-serif; letter-spacing: 1.1px; text-transform: uppercase; color: #5f6c8c; }
.nav-grupo:first-child { margin-top: 0; }
.sidebar nav button { padding: 8px 11px; font-size: 13.5px; border-radius: 8px; color: #9aa6c4; }
.sidebar nav button:hover { transform: none; background: rgba(255, 255, 255, .04); }
.sidebar nav button.active { background: rgba(58, 108, 255, .16); border-color: transparent; }
.sidebar nav button.active::before { top: 8px; bottom: 8px; }
.sidebar nav button i svg { width: 17px; height: 17px; }
.me { grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; }
.me .av { width: 30px; height: 30px; font-size: 13px; }
.me-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.me-rol { color: var(--muted); font-size: 11.5px; }
.me .grow { min-width: 0; }

/* ----- Barra de arriba ----- */
.content { padding: 0 0 70px; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 32px; background: rgba(2, 5, 14, .82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.tb-ruta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.tb-ruta b { color: #fff; font-weight: 600; }
.tb-ruta .sep { opacity: .5; }
.tb-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-buscar { width: 260px; max-width: 100%; padding-top: 7px; padding-bottom: 7px; }
.estado-srv { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: #dfe6f7; font: 600 12.5px "Segoe UI", system-ui, sans-serif; cursor: pointer; }
.estado-srv small { color: var(--muted); font-weight: 500; }
.estado-srv .dot, .svc .dot { width: 8px; height: 8px; border-radius: 50%; background: #5f6c8c; flex: none; }
.estado-srv.ok .dot, .svc .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.estado-srv.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); }
.estado-srv.bad .dot, .svc .dot.off { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 58, 63, .18); }
.tab { padding: 26px 32px 0; gap: 18px; }
.tab-head { align-items: flex-end; }
.tab-head h1 { font-size: 25px; font-stretch: normal; font-variation-settings: normal; letter-spacing: -.2px; }
.sub-h { margin: 4px 0 0; max-width: 720px; }

/* ----- Números (KPI) ----- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; }
.kpi { padding: 15px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); animation: popIn .45s var(--ease) both; }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .label svg { width: 15px; height: 15px; color: #8fb0ff; }
.kpi .value { font: 700 26px/1.15 var(--display); margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .nota { margin-top: 6px; font-size: 12px; }
.delta { display: inline-block; padding: 1px 7px; border-radius: 99px; font-weight: 700; font-size: 11.5px; background: rgba(255, 255, 255, .06); color: var(--soft); }
.delta.up { background: rgba(34, 197, 94, .14); color: #86efac; }
.delta.down { background: rgba(255, 58, 63, .14); color: #ffb0b2; }
.stat { background: var(--panel); border-color: var(--line); }
.stat.big { background: linear-gradient(180deg, rgba(22, 40, 88, .75), rgba(9, 17, 38, .92)); border-color: var(--line-2); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 12.5px "Segoe UI", system-ui, sans-serif; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button.active { background: rgba(58, 108, 255, .25); color: #fff; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.leyenda { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.leyenda span, .tip span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i, .tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
i.cv { background: #3a6cff; } i.cu { background: #22c55e; } i.cr { background: #e5161d; }

/* ----- Analítica ----- */
.vivo { display: flex; flex-wrap: wrap; gap: 10px; }
.vivo-i { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.vivo-i b { color: #fff; font: 700 15px var(--display); }
.vivo-i .pulso { margin-top: 0; width: 8px; height: 8px; background: var(--ok); animation: pulsoV 1.6s infinite; }
@keyframes pulsoV { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } }
.chart-area { position: relative; height: 270px; }
.flujo { width: 100%; height: 100%; display: block; overflow: visible; }
.flujo .g { stroke: rgba(255, 255, 255, .06); }
.flujo .ax { fill: #67739a; font-size: 11px; }
.flujo .lv { fill: none; stroke: #3a6cff; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.flujo .lu { fill: none; stroke: #22c55e; stroke-width: 2; vector-effect: non-scaling-stroke; }
.flujo .reg { fill: rgba(229, 22, 29, .75); }
.flujo .hit { fill: transparent; }
.flujo .cursor { stroke: rgba(255, 255, 255, .25); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tip { position: absolute; top: 6px; display: grid; gap: 3px; padding: 9px 11px; border-radius: 9px; background: #0d1a3d; border: 1px solid var(--line-2); font-size: 12px; color: var(--soft); pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); min-width: 170px; }
.tip span b { margin-left: auto; padding-left: 10px; color: #fff; }
.embudo { display: grid; gap: 12px; }
.paso { animation: rise .4s var(--ease) both; }
.paso-t { display: flex; justify-content: space-between; font-size: 13px; color: var(--soft); margin-bottom: 5px; }
.paso-t b { font: 700 15px var(--display); color: #fff; }
.paso-b { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.paso-b i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3a6cff, #7d9bff); transform-origin: left; animation: crece .9s var(--ease) both; }
.paso:last-child .paso-b i { background: linear-gradient(90deg, #16a34a, #22c55e); }
.paso small { font-size: 11.5px; }
.hbar { margin-bottom: 11px; animation: rise .35s var(--ease) both; }
.hb-t { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--soft); }
.hb-t span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.idiomas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; width: 100%; }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; margin-bottom: 22px; }
.hc { height: 46px; border-radius: 4px; background: rgba(58, 108, 255, calc(.07 + var(--a) * .85)); position: relative; }
.hc span { position: absolute; bottom: -17px; left: 0; font-size: 10px; color: var(--muted); }
.tl-lista { display: grid; gap: 2px; }
.feed { max-height: 340px; overflow-y: auto; }
.tl { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tl:last-child { border-bottom: 0; }
.tl > span { flex: none; width: 18px; text-align: center; color: var(--muted); }
.tl b { display: block; font-weight: 600; color: #e6ebf7; }
.tl small { color: var(--muted); font-size: 12px; }
.tl > .ev { width: 9px; height: 9px; border-radius: 50%; margin: 5px 4px 0; background: #5f6c8c; }
.ev-pago_ok { background: var(--ok) !important; }
.ev-registro, .ev-registro_web { background: #3a6cff !important; }
.ev-muestra, .ev-ver { background: #9db4ff !important; }
.ev-muro, .ev-pagar, .ev-checkout { background: var(--warn) !important; }
.ev-descarga, .ev-telegram { background: #c084fc !important; }

/* ----- Servidor ----- */
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.gauge { display: grid; justify-items: center; gap: 4px; position: relative; text-align: center; }
.gauge svg { width: 118px; height: 118px; transform: rotate(-90deg); }
.gauge .g-bg { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 9; }
.gauge .g-v { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .8s var(--ease); }
.gauge.ok .g-v { stroke: #3a6cff; }
.gauge.warn .g-v { stroke: var(--warn); }
.gauge.bad .g-v { stroke: var(--bad); }
.g-t { position: absolute; top: 38px; left: 0; right: 0; display: grid; }
.g-t b { font: 700 22px/1 var(--display); }
.g-t span { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.gauge small { font-size: 11.5px; }
.trafico .sum { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.trafico .sum b, #srvEspacio .sum b { font: 700 20px var(--display); color: #fff; margin-right: 6px; }
#srvEspacio .sum { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.mini-cols { display: flex; align-items: flex-end; gap: 2px; height: 150px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.mini-cols span { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, #6f93ff, #2449b8); }
.mini-cols span:last-child { background: var(--red); }
.ejes { display: flex; justify-content: space-between; margin-top: 5px; }
.svc { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); }
.svc .grow { flex: 1; min-width: 0; display: grid; }
.svc small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: #e6ebf7; word-break: break-word; font-variant-numeric: tabular-nums; }

/* ----- Usuarios: tabla, selección y acciones ----- */
.ufiltros { margin: 0; }
.chip-f { font-size: 12.5px; padding: 6px 11px; }
.utable th[data-sort] { cursor: pointer; user-select: none; }
.utable th[data-sort]:hover { color: #fff; }
.utable th[data-dir=asc]::after { content: " ▲"; font-size: 9px; }
.utable th[data-dir=desc]::after { content: " ▼"; font-size: 9px; }
.utable td { padding: 9px 14px; vertical-align: middle; }
.utable .num { text-align: right; font-variant-numeric: tabular-nums; }
.utable tr.sel { background: rgba(58, 108, 255, .1); }
.utable tr.baneado td { opacity: .6; }
.ck-col { width: 40px; padding-right: 0 !important; }
.ck-col input { width: 16px; height: 16px; }
.acc-col { width: 52px; text-align: right; }
.u-cell { display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; min-width: 0; }
.u-cell:hover .u-name { color: #9db4ff; }
.u-txt { display: grid; min-width: 0; }
.u-txt .u-name { display: flex; gap: 6px; align-items: center; }
.u-txt .tag { font-size: 10.5px; padding: 1px 7px; }
.av.live { box-shadow: 0 0 0 2px var(--red); }
.av.big { width: 52px; height: 52px; font-size: 20px; }
.cell2 { display: grid; gap: 3px; justify-items: start; }
.cell2 small { font-size: 11.5px; }
.vivo-tag { display: inline-flex; align-items: center; gap: 7px; color: #ffb0b2; font-weight: 600; font-size: 12.5px; }
.vivo-tag .pulso { margin: 0; width: 8px; height: 8px; }
.uc-vacio { padding: 30px !important; text-align: center; }
.bulk {
  position: sticky; top: 62px; z-index: 4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px;
  border-radius: 12px; background: #13265a; border: 1px solid rgba(58, 108, 255, .5); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: popIn .3s var(--ease) both;
}
.bulk b { margin-right: 6px; }
.menu { position: fixed; z-index: 30; min-width: 250px; padding: 6px; border-radius: 12px; background: #0d1838; border: 1px solid var(--line-2); box-shadow: 0 18px 50px rgba(0, 0, 0, .65); }
.menu-head { display: grid; padding: 8px 10px 9px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head small { color: var(--muted); font-size: 12px; }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #e6ebf7; font: 500 13px "Segoe UI", system-ui, sans-serif; cursor: pointer; }
.menu button:hover { background: rgba(58, 108, 255, .16); }
.menu button.peligro { color: #ffb0b2; }
.menu button.peligro:hover { background: rgba(229, 22, 29, .16); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ----- Ficha lateral de la cuenta ----- */
.drawer-fondo { position: fixed; inset: 0; z-index: 14; background: rgba(0, 3, 12, .55); animation: fade .2s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 15; width: min(580px, 100vw); overflow-y: auto; background: #071029;
  border-left: 1px solid var(--line-2); box-shadow: -30px 0 80px rgba(0, 0, 0, .6); transform: translateX(105%); transition: transform .3s var(--ease), visibility .3s; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-card { padding: 22px 24px 0; }
.dr-head { display: flex; gap: 14px; align-items: flex-start; }
.dr-head .grow { flex: 1; min-width: 0; }
.dr-head h2 { margin: 0; font-size: 21px; }
.dr-head p { margin: 2px 0 8px; word-break: break-all; }
.dr-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 18px 0 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--line); }
.dr-kpis > div { display: grid; gap: 2px; padding: 11px 12px; background: #0a1534; }
.dr-kpis b { font: 700 17px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-kpis small { color: var(--muted); font-size: 11.5px; }
.dr-rapidas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.dr-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.dr-tabs button { border: 0; background: transparent; color: var(--muted); font: 600 13px "Segoe UI", system-ui, sans-serif; padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dr-tabs button.active { color: #fff; border-bottom-color: var(--red); }
.dr-sec { min-height: 200px; }
.dr-sec h3 { margin: 16px 0 8px; font-size: 13.5px; color: #e6ebf7; }
.dr-pie { position: sticky; bottom: 0; margin: 24px -24px 0; padding: 14px 24px; display: flex; gap: 8px; background: rgba(7, 16, 41, .97); border-top: 1px solid var(--line); }
.zona-peligro { margin-top: 18px; padding: 14px; border-radius: 12px; border: 1px solid rgba(229, 22, 29, .35); background: rgba(229, 22, 29, .05); }
.zona-peligro h3 { margin: 0 0 4px; color: #ffb0b2; }
.mini-t { width: 100%; font-size: 12.5px; }
.mini-t th, .mini-t td { padding: 7px 8px; }
.mini-t th { position: static; background: transparent; }

.menu-btn { display: none; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: #fff; cursor: pointer; }
.menu-fondo { display: none; position: fixed; inset: 0; z-index: 20; background: rgba(0, 3, 12, .62); }

/* ----- Pantallas medianas y celular ----- */
@media (max-width: 1180px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1000px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  /* En el celular el menú se esconde y se abre con el botón ☰. Va aquí (al final) para ganarle al diseño de escritorio. */
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 21; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); border-right: 1px solid var(--line-2);
    padding: calc(18px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
    background: #050a19; transform: translateX(-105%); visibility: hidden; transition: transform .25s var(--ease), visibility .25s;
  }
  .sidebar.abierta { transform: none; visibility: visible; box-shadow: 16px 0 50px rgba(0, 0, 0, .6); }
  .sidebar nav button { flex: none; padding: 11px 12px; font-size: 14.5px; }
  .menu-fondo:not(.hidden) { display: block; }
  .content { min-width: 0; }
  /* Nada puede ensanchar la pantalla: las columnas se encogen y las tablas se deslizan de lado. */
  .tab, .tab .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tab > *, .tab .card, .tab .grid2 > * { min-width: 0; }
  .tab .table-card { overflow-x: auto; }
  .tab code { overflow-wrap: anywhere; word-break: break-word; }
  .tab .list { grid-template-columns: minmax(0, 1fr); }
  .tab .item { flex-wrap: wrap; min-width: 0; }
  .tab .item > .grow { flex: 1 1 62%; overflow-wrap: anywhere; }
  .menu-btn { display: grid; }
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 14px; }
  .tb-acciones { display: contents; }
  .tb-acciones .btn { display: none; }
  .estado-srv { grid-column: 3; grid-row: 1; white-space: nowrap; }
  .estado-srv small { display: none; }
  .tb-buscar { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  input, textarea, select { font-size: 16px; } /* con menos de 16px el iPhone agranda la pantalla al tocar */
  .tab { padding: 18px 16px 0; }
  .bulk { top: 8px; }
  .utable th:nth-child(4), .utable td:nth-child(4), .utable th:nth-child(7), .utable td:nth-child(7) { display: none; }
}
@media (max-width: 560px) {
  /* Las cifras de dos en dos, para ver más sin bajar tanto. */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat.big { grid-column: span 6; }
  .stat.big .value { font-size: 28px; }
  .kpis .card, .stats .stat { min-width: 0; padding-left: 13px; padding-right: 13px; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr-kpis { grid-template-columns: repeat(2, 1fr); }
  .utable th:nth-child(6), .utable td:nth-child(6) { display: none; }
  .dr-tabs { scrollbar-width: none; }
  .dr-tabs::-webkit-scrollbar { display: none; }
  .dr-tabs button { flex: 1 0 auto; padding: 10px 6px; font-size: 12.5px; }
}
.tab-head > .btn-row { justify-content: flex-end; }
.tab-head .btn-row .search { width: 250px; }
@media (max-width: 860px) { .tab-head .btn-row .search { width: 100%; } }

/* Aviso con el robot: formulario y vista previa */
.aviso-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.aviso-campos { display: grid; gap: 12px; min-width: 0; }
.aviso-campos .row > label { flex: 1; min-width: 160px; }
.aviso-vista { position: sticky; top: 16px; display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: end; gap: 4px; padding: 16px; border-radius: 14px;
  background: radial-gradient(circle at 30% 80%, rgba(74, 210, 255, .12), transparent 60%), #050b1d; border: 1px solid var(--line-2); }
.av-globo { position: relative; margin-bottom: 44px; padding: 12px 14px; border-radius: 14px 14px 14px 4px; background: #0d1631; border: 1px solid rgba(58, 108, 255, .45); min-width: 0; }
.av-saludo { display: block; font-size: 15px; }
.av-titulo { display: block; margin-top: 3px; color: #8fb0ff; }
.av-texto { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; color: #d7def0; max-height: 180px; overflow: auto; }
.av-botones { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.av-btn { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-2); }
.av-btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.av-pie { grid-column: 1 / -1; text-align: center; }
@media (max-width: 1000px) { .aviso-grid { grid-template-columns: minmax(0, 1fr); } .aviso-vista { position: static; } }
