/* Modelos › la cartera en tabla tipo Excel (24-nov-2026, modelos-tabla.js).
   Marca «Juntos» sobre el negro del CRM (variables de crm.css): azul de acento, menta para lo que
   va bien, ámbar y rojo solo para avisos. Mismo lenguaje que .mc-tabla (modelos-control.css).
   Los colores de cada red son los de la tarjeta (.mred de crm.css). */
.mgrid.mgrid-tabla { display:block; }

/* Leyenda de una línea encima de la tabla */
.mt-ayuda { display:flex; flex-wrap:wrap; align-items:center; gap:6px 18px; margin:0 0 10px; color:var(--muted2); font:600 12px/1.4 var(--sans); }
.mt-ayuda > span { display:inline-flex; align-items:center; gap:7px; }
.mt-ayuda .mt-k { display:inline-grid; place-items:center; width:20px; height:20px; border-radius:6px; border:1px solid var(--border2); background:var(--card2); color:var(--text); }
.mt-ayuda .mt-k svg { width:12px; height:12px; }
.mt-ayuda .mt-k-aviso { display:inline-block; width:4px; height:15px; border-radius:2px; background:var(--amber); }
.mt-ayuda .mt-k-online { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--green); box-shadow:0 0 0 3px var(--green-s); }

/* La hoja: se desplaza sola en horizontal (columna «Modelo» fija) y en vertical con la cabecera fija */
.mt-caja {
  --mt-fondo:#15171C; --mt-cebra:#181B21; --mt-hover:#1D2129; --mt-abierta:#18202D; --mt-cab:#1B1E25; --mt-linea:#262A33;
  position:relative; overflow:auto; max-height:max(440px, calc(100vh - 140px));
  border:1px solid var(--border); border-radius:14px; background:var(--mt-fondo);
  overscroll-behavior-x:contain; scrollbar-width:thin; scrollbar-color:#3A404C transparent;
}
.mt-tabla { width:100%; border-collapse:separate; border-spacing:0; color:var(--text); font:500 13px/1.3 var(--sans); font-variant-numeric:tabular-nums; }
.mt-tabla th, .mt-tabla td { padding:9px 9px; text-align:left; vertical-align:middle; font-weight:inherit;
  background-color:var(--mt-fondo); border-right:1px solid var(--mt-linea); border-bottom:1px solid var(--mt-linea); }
.mt-tabla .mt-acc { border-right:0; text-align:right; white-space:nowrap; }

/* Cabecera en dos filas (grupos «Redes» y «Trabajo», como celdas combinadas) */
.mt-tabla thead th { position:sticky; top:0; z-index:3; background-color:var(--mt-cab); color:var(--muted);
  font:800 10px/1.2 var(--sans); letter-spacing:.07em; text-transform:uppercase; white-space:nowrap; }
.mt-tabla thead .mt-cab2 th { top:var(--mt-cab1, 31px); }
.mt-tabla thead .mt-grupo { padding-top:7px; padding-bottom:7px; text-align:center; color:var(--muted2); }
.mt-tabla thead .mt-col-modelo { left:0; z-index:5; }
.mt-tabla thead .mt-num { text-align:center; }
.mt-tabla thead .mt-acc { text-align:right; }
.mt-cab-red, .mt-cab-of { display:inline-flex; align-items:center; gap:6px; }
.mt-cab-red svg { width:14px; height:14px; flex:none; }
.mt-cab-of .of-i { width:14px; height:14px; color:#00aff0; }

/* Columna fija «Modelo» */
.mt-tabla tbody th.mt-modelo, .mt-tabla tfoot th.mt-modelo { position:sticky; left:0; z-index:2; }
.mt-caja.desplazada .mt-modelo, .mt-caja.desplazada .mt-col-modelo { box-shadow:10px 0 12px -10px rgba(0,0,0,.85); }
.mt-modelo, .mt-col-modelo { min-width:200px; }
.mt-quien { display:flex; align-items:center; gap:9px; min-width:0; max-width:200px; }
.mt-toggle { flex:none; width:27px; height:27px; display:grid; place-items:center; border-radius:8px;
  border:1px solid var(--border2); background:var(--card2); color:var(--muted); transition:background .15s, color .15s, border-color .15s; }
.mt-toggle svg { width:14px; height:14px; transition:transform .18s ease; }
.mt-toggle:hover { color:var(--text); border-color:#4A5262; background:#232731; }
.mt-toggle[aria-expanded="true"] { background:rgba(63,127,230,.24); border-color:rgba(127,176,255,.55); color:#fff; }
.mt-toggle[aria-expanded="true"] svg { transform:rotate(180deg); }
.mt-av { position:relative; flex:none; width:34px; height:34px; border-radius:10px; display:grid; place-items:center;
  background:var(--grad-br); color:#fff; font:800 13px var(--sans); }
.mt-av img { display:block; width:100%; height:100%; border-radius:inherit; object-fit:cover; }
.mt-av.online::after { content:''; position:absolute; right:-3px; bottom:-3px; width:11px; height:11px; border-radius:50%;
  background:var(--green); border:2px solid var(--mt-fondo); }
.mt-nom { display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-width:0; }
.mt-nombre { max-width:100%; padding:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left;
  color:var(--text); font:800 14.5px/1.2 var(--sans); }
.mt-nombre:hover { color:#8DB6FF; text-decoration:underline; text-underline-offset:3px; }
.mt-sub { display:flex; align-items:center; gap:7px; max-width:100%; min-width:0; overflow:hidden; }
.mt-tabla .estado, .mt-det .estado { flex:none; padding:3px 7px; font-size:8.5px; }
.mt-tabla .estado.retirada, .mt-det .estado.retirada { background:var(--card2); color:var(--muted); }
.mt-hace { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font:600 11.5px var(--sans); }
.mt-sub .mt-online { min-width:0; white-space:nowrap; font-size:11.5px; gap:6px; }
.mt-sub .mt-online i { flex:none; width:7px; height:7px; }
.mt-sub .mt-online span { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.mt-oculto { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; }

/* Filas: cebra, resaltado al pasar y aviso a la izquierda */
.mt-fila { cursor:pointer; }
.mt-fila.par > * { background-color:var(--mt-cebra); }
.mt-fila:hover > * { background-color:var(--mt-hover); }
.mt-fila.abierta > * { background-color:var(--mt-abierta); border-bottom-color:transparent; }
.mt-fila.atencion > .mt-modelo::before, .mt-fila.abierta > .mt-modelo::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; }
.mt-fila.atencion > .mt-modelo::before { background:var(--amber); }
.mt-fila.abierta > .mt-modelo::before { background:var(--pink); }

/* Cifras */
.mt-cifra { display:block; white-space:nowrap; font:800 14.5px/1.15 var(--sans); letter-spacing:-.015em; }
.mt-cifra.apagada { color:var(--muted2); font-weight:700; }
.mt-cifra.of { color:#00aff0; }
.mt-dd { display:block; min-height:14px; margin-top:3px; white-space:nowrap; color:var(--muted2); font:700 11px/1.25 var(--sans); }
.mt-dd.sube { color:var(--menta); }
.mt-dd.baja { color:var(--red); }
.mt-dd.aviso { color:var(--amber); }
.mt-dd.sin { color:var(--muted); font-weight:600; }

/* Redes: cada columna con el tono de su plataforma */
.mt-red { --t:120,128,145; min-width:80px; }
.mt-tabla .mt-red { padding-left:9px; padding-right:8px; }
.mt-tabla .mt-modelo, .mt-tabla .mt-col-modelo { padding-left:11px; }
.mt-r-instagram { --t:225,48,108; }
.mt-r-threads { --t:155,127,212; }
.mt-r-x { --t:74,168,224; }
.mt-r-tiktok { --t:254,44,85; }
.mt-r-youtube { --t:255,78,69; }
.mt-tabla tbody td.mt-red, .mt-tabla tfoot td.mt-red { background-image:linear-gradient(rgba(var(--t),.055), rgba(var(--t),.055)); }
.mt-tabla thead th.mt-red { box-shadow:inset 0 -2px 0 rgba(var(--t),.95); color:var(--text); letter-spacing:.03em; }
.mt-tabla thead th.mt-red .mt-cab-red { gap:5px; }
.mt-red.vacia .mt-cifra { color:#464C59; font-weight:600; }
.mt-red.vacia .mt-dd { color:#464C59; font-weight:600; }
.mt-ncuentas { margin-left:5px; padding:1px 5px; border-radius:6px; background:rgba(var(--t),.16); color:rgb(var(--t));
  font:800 9.5px var(--sans); letter-spacing:0; vertical-align:2px; }

/* Audiencia total con su reparto por red */
.mt-aud { min-width:100px; }
.mt-tabla thead .mt-aud { white-space:normal; }
.mt-reparto { display:flex; gap:2px; height:5px; max-width:100px; margin-top:6px; overflow:hidden; border-radius:4px; background:var(--card2); }
.mt-reparto i { display:block; min-width:3px; height:100%; background:rgb(var(--t)); }
.mt-reparto.grande { height:9px; max-width:none; margin:0 0 7px; border-radius:5px; }

/* Trabajo: un contador por columna */
.mt-tabla .mt-num { width:72px; min-width:66px; padding-left:6px; padding-right:6px; text-align:center; }
.mt-tabla thead .mt-num { white-space:normal; letter-spacing:.02em; line-height:1.15; }
.mt-n { display:inline-grid; place-items:center; min-width:32px; height:24px; padding:0 9px; border-radius:999px; font:800 12.5px var(--sans); }
button.mt-n { border:1px solid rgba(233,180,74,.45); transition:background .15s, transform .15s; }
button.mt-n:hover { background:rgba(233,180,74,.28); transform:translateY(-1px); }
.mt-n.pend { background:rgba(63,127,230,.17); color:#8DB6FF; }
.mt-n.rev { background:var(--amber-s); color:var(--amber); }
.mt-n.venc { background:var(--red-s); color:var(--red); }
.mt-n.hechas { background:rgba(87,209,176,.12); color:var(--menta); }
.mt-n.cero { background:transparent; color:#4F5564; font-weight:700; }

.mt-of { min-width:110px; }
.mt-online { display:inline-flex; align-items:center; gap:7px; color:var(--green); font-weight:800; }
.mt-online i { width:8px; height:8px; border-radius:50%; background:currentColor; box-shadow:0 0 0 3px var(--green-s); }

/* Acción de la fila: abrir su ficha */
.mt-tabla .mt-acc { width:52px; padding-left:8px; padding-right:10px; }
.mt-ir { display:inline-grid; place-items:center; width:30px; height:30px; border-radius:9px;
  border:1px solid var(--border2); background:var(--card2); color:var(--muted); transition:background .15s, border-color .15s, color .15s; }
.mt-ir svg { width:15px; height:15px; }
.mt-ir:hover, .mt-fila:hover .mt-ir { color:#fff; border-color:rgba(127,176,255,.55); background:rgba(63,127,230,.24); }

/* Fila de totales, fija abajo */
.mt-tabla tfoot th, .mt-tabla tfoot td { position:sticky; bottom:0; z-index:3; background-color:var(--mt-cab); border-top:1px solid var(--border2); border-bottom:0; }
.mt-tabla tfoot th.mt-modelo { z-index:4; color:var(--muted); font:800 10.5px var(--sans); letter-spacing:.07em; text-transform:uppercase; }
.mt-tabla tfoot th.mt-modelo small { margin-left:6px; color:var(--muted2); font:600 11.5px var(--sans); letter-spacing:0; text-transform:none; }

/* ---------- La fila desplegada ---------- */
.mt-tabla tr.mt-det > td { padding:0; background-color:#111318; border-right:0; border-bottom:1px solid var(--border2); }
.mt-det-in { position:sticky; left:0; z-index:1; box-sizing:border-box; width:var(--mt-vis, 100%); max-width:100%;
  padding:14px 16px 16px 19px; container-type:inline-size; animation:mt-abre .2s ease both; }
.mt-det-in::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--pink); }
@keyframes mt-abre { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.mt-det-cab { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 14px; margin-bottom:12px; }
.mt-avisos { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
.mt-chip { display:inline-flex; align-items:center; gap:6px; padding:5px 10px; border-radius:999px; white-space:nowrap;
  background:var(--card2); color:var(--muted); font:700 12px var(--sans); }
.mt-chip::before { content:''; width:7px; height:7px; flex:none; border-radius:50%; background:currentColor; }
.mt-chip.rojo { background:var(--red-s); color:var(--red); }
.mt-chip.ambar { background:var(--amber-s); color:var(--amber); }
.mt-chip.bien { background:rgba(87,209,176,.12); color:var(--menta); }
.mt-acciones { display:flex; flex-wrap:wrap; gap:8px; }
.mt-accion { display:inline-flex; align-items:center; gap:7px; height:35px; padding:0 14px; border-radius:999px; white-space:nowrap;
  border:1px solid var(--border2); background:var(--card2); color:var(--text); font:700 13px var(--sans); transition:background .15s, border-color .15s, filter .15s; }
.mt-accion svg { width:15px; height:15px; flex:none; }
.mt-accion:hover { border-color:#4A5262; background:#232731; }
.mt-accion.principal { border-color:transparent; background:var(--grad); color:#fff; }
.mt-accion.principal:hover { filter:brightness(1.08); }
.mt-badge { display:inline-grid; place-items:center; min-width:19px; height:19px; padding:0 5px; border-radius:999px;
  background:var(--amber); color:#1A1300; font:800 11px var(--sans); }

.mt-bloques { display:grid; gap:12px; grid-template-columns:repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
.mt-bloques.con-of { grid-template-columns:minmax(0,1.55fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
.mt-bloques.sin-of { grid-template-columns:minmax(0,1.55fr) minmax(0,1fr) minmax(0,1fr); }
@container (max-width: 1000px) {
  .mt-bloques.con-of, .mt-bloques.sin-of { grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@container (max-width: 560px) {
  .mt-bloques.con-of, .mt-bloques.sin-of { grid-template-columns:minmax(0,1fr); }
  .mt-det-cab { flex-direction:column; align-items:stretch; }
  .mt-accion { flex:1 1 calc(50% - 8px); justify-content:center; padding:0 10px; }
  .mt-accion.principal { flex-basis:100%; }
}
.mt-bloque { min-width:0; padding:13px 14px; border-radius:12px; background:var(--card); border:1px solid var(--border); }
.mt-bloque > h4 { display:flex; align-items:center; gap:7px; margin:0 0 10px; color:var(--muted); font:800 10.5px var(--sans); letter-spacing:.08em; text-transform:uppercase; }
.mt-bloque > h4 .of-i { width:14px; height:14px; color:#00aff0; }
.mt-bloque > h4 small { margin-left:auto; color:var(--muted2); font:600 11.5px var(--sans); letter-spacing:0; text-transform:none; text-align:right; }
.mt-pie { display:block; margin-top:8px; color:var(--muted2); font:600 11.5px var(--sans); }

.mt-leyenda { display:flex; flex-wrap:wrap; gap:4px 12px; margin:0 0 10px; color:var(--muted); font:600 11.5px var(--sans); }
.mt-leyenda span { display:inline-flex; align-items:center; gap:5px; }
.mt-leyenda i { width:8px; height:8px; border-radius:3px; background:rgb(var(--t)); }
.mt-leyenda b { color:var(--text); }
.mt-cuentas { display:flex; flex-direction:column; gap:6px; margin:0; padding:0; list-style:none; }
.mt-cuenta { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:10px; padding:7px 10px 7px 7px;
  border-radius:10px; background:rgba(var(--t),.07); border:1px solid rgba(var(--t),.24); }
.mt-cuenta-ic { width:28px; height:28px; display:grid; place-items:center; border-radius:8px; background:#0F1115; }
.mt-cuenta-ic svg { width:16px; height:16px; }
.mt-cuenta-h { min-width:0; }
.mt-cuenta-h b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font:700 13px var(--sans); }
.mt-cuenta-h small { color:var(--muted2); font:600 11px var(--sans); }
.mt-cuenta-s { text-align:right; }
.mt-cuenta-s > b { font:800 15px var(--sans); letter-spacing:-.015em; }
.mt-cuenta-s .mt-dd { margin-top:1px; }
.mt-vacio { padding:12px; border:1px dashed var(--border2); border-radius:10px; color:var(--muted2); font:600 12px var(--sans); text-align:center; }

.mt-tiles { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; }
.mt-tile { padding:9px 11px; border-radius:10px; background:var(--card2); }
.mt-tile b { display:block; font:800 22px/1.1 var(--sans); letter-spacing:-.02em; }
.mt-tile span { color:var(--muted); font:600 11.5px var(--sans); }
.mt-tile.pend b { color:#8DB6FF; }
.mt-tile.rev b { color:var(--amber); }
.mt-tile.venc b { color:var(--red); }
.mt-tile.hechas b { color:var(--menta); }
.mt-tile.cero b { color:var(--muted2); }
.mt-progreso { margin-top:11px; }
.mt-progreso-barra { height:6px; overflow:hidden; border-radius:4px; background:var(--card2); }
.mt-progreso-barra i { display:block; height:100%; border-radius:inherit; background:var(--menta); }
.mt-progreso small { display:block; margin-top:5px; color:var(--muted); font:600 11.5px var(--sans); }

.mt-of-grande { color:#00aff0; font:800 24px/1.1 var(--sans); letter-spacing:-.02em; overflow-wrap:anywhere; }
.mt-of-grande.apagada { color:var(--muted2); }
.mt-filas { display:flex; flex-direction:column; margin:8px 0 0; }
.mt-filas > div { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 0; border-top:1px solid var(--border); font-size:12.5px; }
.mt-filas > div:first-child { border-top:0; }
.mt-bloque.of .mt-filas > div:first-child { border-top:1px solid var(--border); }
.mt-filas dt { color:var(--muted); font-weight:600; }
.mt-filas dd { margin:0; min-width:0; text-align:right; font-weight:700; }
.mt-filas .mt-chip { padding:3px 8px; font-size:11px; }
.mt-correo { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Móvil: la columna fija se estrecha y el resto se desliza */
@media (max-width:720px) {
  .mt-caja { max-height:none; border-radius:12px; }
  .mt-tabla .mt-modelo, .mt-tabla .mt-col-modelo { min-width:164px; padding-left:8px; padding-right:8px; }
  .mt-quien { gap:7px; max-width:164px; }
  .mt-av { width:28px; height:28px; border-radius:8px; font-size:11.5px; }
  .mt-toggle { width:26px; height:26px; }
  .mt-sub .estado.activa { display:none; }   /* lo normal; en el móvil deja sitio a «hace…» / «Activa ahora» */
  .mt-nombre { font-size:13.5px; }
  .mt-ayuda { gap:4px 14px; font-size:11.5px; }
  .mt-det-in { padding:12px 12px 14px 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .mt-det-in { animation:none; }
  .mt-toggle svg, .mt-toggle, .mt-ir, .mt-accion, button.mt-n { transition:none; }
  button.mt-n:hover { transform:none; }
}
