/* ==========================================================================
   ASP4 — sistema de diseño.
   Layout portado de ASP5 (resources/views/app/shell.php): sidebar de 240px,
   topbar y tarjetas. La PALETA es la de siempre de ASP3/ASP4 (azul #1e4d6b /
   #4682AA sobre #eef1f5), a pedido del usuario — no la paleta iOS de ASP5.
   Las clases viejas de ASP4 (.section-bar, .box, .btn.sec, .flash…) se
   redefinen acá con el lenguaje nuevo, así las páginas no necesitan <style>.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
	color-scheme: light;   /* ASP4 va siempre en claro, no sigue el modo oscuro del sistema */
	--bg:         #eef1f5;   /* fondo de siempre de ASP3/ASP4 */
	--surface:    #ffffff;
	--border:     #d5dae0;
	--accent:     #4682AA;   /* azul MailtrackPro: links y botones */
	--accent-h:   #3d7298;
	--accent-sf:  #e6eef5;   /* fondo suave del ítem activo */
	--accent-dk:  #1e4d6b;   /* azul oscuro: barras de sección y títulos */
	--orange:     #e8730c;   /* naranja de los grupos de listas */
	--text:       #333333;
	--sub:        #6b7683;
	--danger:     #b3261e;
	--success:    #2e7d46;
	--warning:    #e8730c;
	--radius:     8px;
	--sidebar-w:  240px;
	--topbar-h:   56px;
}

html, body { height: 100%; }

body {
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
	font-size: 15px;
	line-height: 1.5;
	display: flex;
	flex-direction: column;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
#app { display: flex; flex: 1; min-height: 0; overflow: hidden; }

.sidebar {
	width: var(--sidebar-w);
	background: var(--surface);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	overflow-y: auto;
}
.sidebar-logo {
	height: var(--topbar-h);       /* misma altura que la topbar: las dos líneas alinean */
	flex-shrink: 0;
	padding: 0 18px;
	display: flex; align-items: center;
	border-bottom: 1px solid var(--border);
	text-decoration: none; color: inherit;
}
.sidebar-logo img { width: 100%; max-width: 176px; height: auto; display: block; }
.sidebar-logo .icon {
	width: 36px; height: 36px; flex-shrink: 0;
	background: linear-gradient(145deg, #007aff, #5856d6);
	border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
}
.sidebar-logo .icon svg { width: 20px; height: 20px; fill: #fff; }
.sidebar-logo .brand { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.sidebar-logo .ver { font-size: 11px; color: var(--sub); }

.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 10px; margin-bottom: 2px;
	border-radius: 9px;
	color: var(--text); text-decoration: none;
	font-size: 14px; font-weight: 500;
	transition: background .12s;
}
.sidebar nav a:hover { background: rgba(0,0,0,.05); }
.sidebar nav a.active { background: var(--accent-sf); color: var(--accent-dk); font-weight: 600; }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; fill: currentColor; }
.sidebar nav a.active svg { opacity: 1; }
.nav-section {
	font-size: 11px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .6px;
	padding: 14px 10px 6px;
}
.sidebar-footer {
	padding: 12px 14px;
	border-top: 1px solid var(--border);
	font-size: 13px; color: var(--sub);
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-footer .who { overflow: hidden; }
.sidebar-footer .who b { color: var(--text); display: block; font-size: 13px; }
.sidebar-footer .who span { font-size: 11px; }
.btn-logout {
	background: none; border: 1px solid var(--border); border-radius: 7px;
	padding: 4px 8px; font-size: 12px; color: var(--sub);
	cursor: pointer; white-space: nowrap; font-family: inherit; text-decoration: none;
	transition: background .12s;
}
.btn-logout:hover { background: rgba(0,0,0,.05); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
	height: var(--topbar-h); flex-shrink: 0;
	background: #f6f7f9;
	border-bottom: 1px solid var(--border);
	display: flex; align-items: center; gap: 12px;
	padding: 0 24px;
}
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; color: var(--accent-dk); }
.topbar-right { font-size: 13px; color: var(--sub); display: flex; align-items: center; gap: 12px; }
.topbar-right b { color: var(--text); }
.page-content { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }
.page-content > * { max-width: 1280px; }

.imp-banner {
	background: #fff4e5; color: #8a5a00;
	border-bottom: 1px solid rgba(255,149,0,.35);
	padding: 8px 24px; font-size: 13px;
	display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.imp-banner a { color: #8a5a00; font-weight: 700; }

/* ── Tipografía ──────────────────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 2px; color: var(--accent-dk); }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
	background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 5px; }

.hint, .note, .psub, .tip, .file-meta { font-size: 13px; color: var(--sub); }
.hint, .note { margin-top: 4px; }
.note { margin-bottom: 14px; }
.empty { color: var(--sub); }
.crumb { font-size: 13px; color: var(--sub); margin-bottom: 14px; }
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ── Tarjetas y cabeceras de sección ─────────────────────────────────── */
.card, .box, .defbox, .testbox {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 18px;
}
.section-bar {
	background: var(--accent-dk);
	color: #fff;
	border: 1px solid var(--accent-dk);
	border-bottom: none;
	border-radius: var(--radius) var(--radius) 0 0;
	padding: 14px 20px;
	display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.section-bar h2 { color: #fff; font-size: 16px; margin: 0; }
.section-bar h2 small { font-weight: 400; color: rgba(255,255,255,.8); font-size: 13px; }
.section-bar + .box { border-radius: 0 0 var(--radius) var(--radius); }
.section-actions { display: flex; gap: 14px; align-items: center; }
.section-actions details { position: relative; }
.section-actions summary { cursor: pointer; list-style: none; font-size: 13.5px; color: #fff; font-weight: 500; }
.section-actions summary::-webkit-details-marker { display: none; }
.section-bar .barlink { color: #fff; }
.barlink { color: var(--accent); text-decoration: none; font-size: 13.5px; font-weight: 500; }
/* Un <button> en la barra (Archivar va por POST) se ve igual que los links de al lado. */
button.barlink { background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.section-bar form { display: inline; margin: 0; }
.barlink:hover, .section-actions summary:hover { text-decoration: underline; }

/* Popovers de "crear grupo/lista" y de cambio de password */
.pop, details.pd .pp {
	position: absolute; right: 0; top: 30px; z-index: 20;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border); border-radius: var(--radius);
	padding: 16px; width: 290px;
	box-shadow: 0 8px 28px rgba(0,0,0,.18);
	text-align: left;
}
.pop label, details.pd .pp label { display: block; font-size: 12px; color: var(--sub); margin: 10px 0 4px; font-weight: 500; }
.pop label:first-child, details.pd .pp label:first-child { margin-top: 0; }
details.pd .pp button { width: 100%; margin-top: 10px; justify-content: center; }
/* El boton de accion del popover iba pegado al ultimo campo. `form > button`
   alcanza sólo al submit de cada formulario: los botones que van dentro de una
   fila o de un div quedan como estaban. */
/* El boton de accion del popover iba pegado al ultimo campo. `form > button`
   alcanza solo al submit de cada formulario: los botones que van dentro de una
   fila o de un div quedan como estaban.
   `display: flex` (de nivel bloque, no inline-flex) es lo que le garantiza
   renglon propio: adentro de .acts-cell la linea no corta sola. */
.pop form > button, details.pd .pp form > button {
	display: flex; width: 100%; margin-top: 14px; justify-content: center;
}

/* Las reglas de .acts-cell son para los botoncitos de la fila, NO para lo que hay
   adentro del popover, que se las come por herencia y por descendencia:
     - `white-space: nowrap` impedia que el boton bajara de renglon, asi que
       quedaba al lado del ultimo input y se salia del panel;
     - `.acts-cell form { display: inline-block; margin-left: 4px }` desalineaba
       el formulario 4px respecto del resto del contenido.
   Se cortan las dos acá, dentro del popover. */
.acts-cell .pop, .acts-cell .pp { white-space: normal; text-align: left; }
.acts-cell .pop form, .acts-cell .pp form { display: block; margin-left: 0; }

/* Popover fuera del recorte del contenedor.
   Las tablas llevan `overflow: hidden` para que el borde redondeado corte las
   filas de las puntas (ver `.grupo table, table.arch, .utable, .subs`), y eso
   TAMBIEN recorta cualquier hijo posicionado: el popover del lapiz de un
   suscriptor o de una campaña quedaba cortado o directamente invisible.
   `position: fixed` lo saca de todos los overflow de los ancestros; la posicion
   la calcula el JS del pie (templates/cliente_footer.php), que ademas lo vuelve
   a ubicar al hacer scroll. */
.pop.pop-fixed, details.pd .pp.pop-fixed {
	position: fixed; right: auto; top: 0; z-index: 200;
}
details.pd { position: relative; display: inline-block; }
details.pd summary { list-style: none; cursor: pointer; }
details.pd summary::-webkit-details-marker { display: none; }
details.pd .pp { width: 220px; }

/* ── Formularios ─────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
	font-family: inherit; font-size: 14px;
	padding: 8px 10px;
	border: 1px solid var(--border); border-radius: 9px;
	background: var(--surface); color: var(--text);
	max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-sf); border-color: var(--accent); }
.pop input, .pop select, details.pd .pp input { width: 100%; }

/* Radios y checkboxes dentro de un popover (Exportar, por ejemplo). La regla de
   arriba les daba tambien el 100% de ancho, asi que el control se comia el
   renglon entero y su texto caia al renglon de abajo. Van en linea con el texto
   y alineados al medio. */
.pop label.rad, .pop label.chk,
details.pd .pp label.rad, details.pd .pp label.chk {
	display: flex; align-items: center; gap: 8px;
	margin: 5px 0; font-size: 13px; color: var(--text); font-weight: 400;
}
.pop label.rad input, .pop label.chk input,
details.pd .pp label.rad input, details.pd .pp label.chk input {
	width: auto; flex: none; margin: 0;
}
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .4px; margin: 18px 0 6px; }

.uform { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; max-width: 680px; }
.uform label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--sub); font-weight: 500; }
.uform label.chk { flex-direction: row; align-items: center; gap: 8px; }
.uform label.chk input { width: auto; }
.uform .full { grid-column: 1 / -1; }
.uform button { grid-column: 1 / -1; justify-self: start; }

/* ── Botones ─────────────────────────────────────────────────────────── */
.btn, .pop button, details.pd .pp button, .uform button, .unarch, .act, .addcrit, .barbtn, .del-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 9px 18px;
	border: none; border-radius: 10px;
	font-family: inherit; font-size: 14px; font-weight: 600;
	background: var(--accent); color: #fff;
	cursor: pointer; text-decoration: none;
	transition: background .12s, transform .1s;
}
.btn:active, .pop button:active, details.pd .pp button:active, .uform button:active { transform: scale(.97); }
.btn:hover, .pop button:hover, details.pd .pp button:hover, .uform button:hover { background: var(--accent-h); }
.btn.sec, .btn-secondary, .unarch, .act, .addcrit {
	background: rgba(0,0,0,.06); color: var(--text);
}
.btn.sec:hover, .unarch:hover, .act:hover, .addcrit:hover { background: rgba(0,0,0,.10); }
.btn.danger, .btn-danger, .act.danger, .del-btn { background: #fdecea; color: #8a1f1a; }

/* Disparo del envío: es la acción fuerte de la fila, va con el color de acento.
   `.pend` no es un botón — es el cartel de «tu firma ya está, falta la otra». */
.send-btn { background: var(--accent); color: #fff; }
.send-btn:hover { background: var(--accent-dk, #3d7298); }
.acts-cell .pend {
	display: inline-block; padding: 5px 10px;
	font-size: 12.5px; font-weight: 500; border-radius: 8px;
	background: var(--accent-sf, #e6eef5); color: var(--accent);
	cursor: default;
}
.btn.danger:hover, .act.danger:hover, .del-btn:hover { background: #f8d7d4; }
.btn[disabled], button[disabled] { opacity: .5; cursor: default; }
.act, .unarch, .del-btn { padding: 5px 10px; font-size: 12.5px; font-weight: 500; border-radius: 8px; }

/* Iconos de src/Icons.php dentro de un boton. El viewBox es de 24x24: sin un tamano
   explicito el SVG se dibuja enorme. `fill: currentColor` es lo que los hace tomar el
   color del boton —gris en uno normal, rojo oscuro en uno de borrar—, que es
   justamente lo que un emoji no podia hacer: venia siempre a color y con la forma que
   le da cada sistema operativo. Los botones ya son inline-flex con gap, asi que el
   icono se alinea con el texto sin nada mas. */
.btn svg, .act svg, .barlink svg, .unarch svg, .del-btn svg, .addcrit svg {
	width: 15px; height: 15px; flex-shrink: 0; fill: currentColor;
}
.addcrit { font-size: 13px; padding: 7px 14px; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rolf, .langf { display: flex; gap: 6px; align-items: center; }
.rolf select, .langf select { padding: 4px 6px; font-size: 12.5px; }
.star, .act.star { color: var(--warning); font-weight: 700; }

/* ── Tablas ──────────────────────────────────────────────────────────── */
table, .utable, .subs, table.arch, .grupo table, table.prev-t {
	width: 100%; border-collapse: collapse; font-size: 14px;
	background: var(--surface);
}
th, .utable th, .subs th, .grupo th {
	text-align: left; font-size: 12px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .4px;
	padding: 10px 14px; border-bottom: 1px solid var(--border);
	background: transparent;
}
td, .utable td, .subs td, .grupo td {
	padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text);
	vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(0,0,0,.02); }
.grupo table, table.arch, .utable, .subs {
	border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.grupo { margin-bottom: 22px; }
.grupo h3 { color: var(--orange); font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tbl-wrap, .prev { overflow-x: auto; }

/* Preview del importador: encabezados con selects */
table.prev-t { white-space: nowrap; font-size: 13px; }
table.prev-t th { vertical-align: top; padding: 10px 12px; text-transform: none; letter-spacing: 0; }
table.prev-t td { padding: 7px 12px; }
table.prev-t select, table.prev-t .newf { display: block; margin-top: 6px; width: 100%; font-size: 12.5px; padding: 5px 6px; }
table.prev-t .newf { display: none; border-color: var(--accent); }
.hdr { font-weight: 700; color: #35628c; font-size: 13px; }

/* ── Badges y chips ──────────────────────────────────────────────────── */
.badge, .tipo-badge, .chip {
	display: inline-block; padding: 3px 9px; border-radius: 20px;
	font-size: 12px; font-weight: 600;
	background: #eef1f5; color: #4b5563;
}
.badge.admin, .badge-blue { background: #e6f0f7; color: var(--accent-dk); }
.badge.on, .badge-green { background: #e4f4e8; color: var(--success); }
.badge.off, .badge-red { background: #f6e4e4; color: #a33; }
.tipo-badge.target, .badge-orange { background: #fdf0e3; color: #b45309; }

/* ── Avisos ──────────────────────────────────────────────────────────── */
.flash, .error, .ok-box, .impbanner {
	padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px;
}
.flash.ok, .ok-box { background: #dcfce7; color: #166534; }
.flash.error, .error { background: #fdecea; color: #8a1f1a; }
.impbanner { background: #e6eef5; color: var(--accent-dk); }
.impbanner a { color: var(--accent-dk); font-weight: 700; }

/* ── Barra de progreso (importación) ─────────────────────────────────── */
.bar-wrap {
	background: rgba(0,0,0,.06); border-radius: 99px; height: 22px;
	overflow: hidden; margin: 14px 0 8px;
}
.bar { background: var(--accent); height: 100%; width: 0; border-radius: 99px; transition: width .35s ease; }
.bar.done { background: #16a34a; }
.bar.err { background: var(--danger); }
.bar.indet { width: 35%; animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0 } to { margin-left: 65% } }
.pstat { font-size: 14px; color: var(--text); }
.pstat b { color: var(--accent-dk); }
.up input[type=file] { display: block; margin: 14px 0; font-size: 13.5px; }

/* ── Target: listas origen y criterios ───────────────────────────────── */
.srcs {
	display: flex; flex-wrap: wrap; gap: 8px 18px;
	max-height: 190px; overflow: auto;
	border: 1px solid var(--border); border-radius: 10px;
	padding: 12px; background: rgba(0,0,0,.02);
}
.srcs label { font-size: 13.5px; display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.crit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.crit .bool { width: 78px; } .crit .fld { min-width: 190px; } .crit .op { min-width: 165px; }
.crit input[type=text] { width: 220px; }
.crit .del {
	background: #fdecea; color: #8a1f1a; border: none;
	border-radius: 8px; padding: 7px 11px; cursor: pointer; font-family: inherit;
}
.testbox { background: rgba(0,0,0,.03); padding: 14px 16px; margin: 16px 0 0; }
.defbox { background: rgba(0,0,0,.02); font-size: 13.5px; }
.defbox b { color: var(--accent-dk); }
.pager { margin-top: 16px; font-size: 13.5px; color: var(--sub); }
.pager a { color: var(--accent); text-decoration: none; margin-right: 14px; }

/* ── Estado vacío ────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--sub); }
.empty-state h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 860px) {
	:root { --sidebar-w: 68px; }
	.sidebar-logo .brand, .sidebar-logo .ver, .sidebar nav a span, .nav-section,
	.sidebar-footer .who { display: none; }
	.sidebar nav a { justify-content: center; }
	.sidebar-footer { justify-content: center; }
	.page-content { padding: 18px 16px 50px; }
	.uform { grid-template-columns: 1fr; }
}

/* ── Utilidades usadas por las páginas (reemplazan estilos inline) ───── */
.txt-danger { color: #8a1f1a; }
.chk-inline { display: block; margin-top: 14px; font-size: 13.5px; color: var(--sub); }
.chk-inline input { margin-right: 6px; }
.lbl-sub { font-weight: 400; color: var(--sub); text-transform: none; letter-spacing: 0; }
.sub-h3 { margin: 24px 0 10px; font-size: 15px; font-weight: 600; }
.rowlink { color: var(--accent); text-decoration: none; font-weight: 600; }
.rowlink:hover { text-decoration: underline; }

/* ── Acciones por fila (editar / borrar en las tablas) ───────────────── */
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }

.acts-cell { text-align: right; white-space: nowrap; }
.acts-cell form { display: inline-block; margin-left: 4px; }
details.rowpop { position: relative; display: inline-block; }
details.rowpop .pop { width: 260px; }

/* Menu «⋯» de la fila de Envios: el mismo popover de siempre, pero como lista de
   acciones en vez de formulario.
   Hay tres reglas de arriba que hay que apagar aca, y por eso los selectores son
   tan especificos:
     - `.pop button` (bloque «Botones») pinta de azul acento CUALQUIER boton que
       caiga dentro de un popover, con padding 9/18 y font 14/600;
     - `.pop form > button` lo manda a `display: flex`, ancho completo, centrado y
       con 14px de aire arriba, que es lo que quiere un formulario y no una lista;
     - `.acts-cell { white-space: nowrap }` se hereda y no dejaria cortar el texto.
   Cada item puede ser un <a>, un <button> suelto o el submit de un form chiquito
   con su token CSRF: los tres tienen que verse igual, asi que se resetean juntos.
   OJO con el orden: `.pop.menu form > button` empata en especificidad con
   `.pop form > button`, asi que ESTE bloque tiene que quedar despues. */
.pop.menu { width: 200px; padding: 6px; }
.acts-cell .pop.menu form { display: block; margin: 0; }
.pop.menu > a,
.pop.menu > button,
.pop.menu form > button {
	display: block; width: 100%; margin: 0; padding: 7px 10px;
	border: none; border-radius: 7px; background: none;
	font-family: inherit; font-size: 13.5px; font-weight: 500;
	text-align: left; color: var(--text); text-decoration: none; cursor: pointer;
}
.pop.menu > a:hover,
.pop.menu > button:hover,
.pop.menu form > button:hover { background: var(--accent-sf, #e6eef5); text-decoration: none; }
.pop.menu .sep { margin: 5px 4px; border-top: 1px solid var(--border); }
.pop.menu form > button.danger { color: #8a1f1a; }
.pop.menu form > button.danger:hover { background: #fdecea; }
.acts-cell summary, .del-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; padding: 0;
	border-radius: 8px; font-size: 14px; line-height: 1;
	background: rgba(0,0,0,.06); color: var(--text);
	border: none; cursor: pointer;
}
.acts-cell summary:hover { background: rgba(0,0,0,.12); }
.del-btn { background: #fdecea; color: #8a1f1a; }

/* Disparo del envío: es la acción fuerte de la fila, va con el color de acento.
   `.pend` no es un botón — es el cartel de «tu firma ya está, falta la otra». */
.send-btn { background: var(--accent); color: #fff; }
.send-btn:hover { background: var(--accent-dk, #3d7298); }
.acts-cell .pend {
	display: inline-block; padding: 5px 10px;
	font-size: 12.5px; font-weight: 500; border-radius: 8px;
	background: var(--accent-sf, #e6eef5); color: var(--accent);
	cursor: default;
}

/* Estado del suscriptor como badge */
.st {
	display: inline-block; padding: 3px 9px; border-radius: 20px;
	font-size: 12px; font-weight: 600;
	background: #e4f4e8; color: var(--success);
}
.st.st8 { background: #fdf0e3; color: #b45309; }
.st.st2, .st.st3, .st.st4 { background: #f6e4e4; color: #a33; }


/* ── Barra de búsqueda / orden / filtros por tipo (vista de Listas) ──── */
.listbar {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.listbar-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search {
	display: flex; align-items: center; gap: 8px; flex: 1; max-width: 420px;
	border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: #fbfcfd;
}
.search svg { width: 16px; height: 16px; fill: var(--sub); flex-shrink: 0; }
.search input {
	border: none; background: none; padding: 9px 0; flex: 1; font-size: 14px; color: var(--text);
}
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }
.results { font-size: 13px; color: var(--sub); white-space: nowrap; }
.results b { color: var(--text); }

.sortrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sortlbl { font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: .5px; }
.chip-sort {
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border); border-radius: 99px;
	padding: 5px 14px; font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer;
	transition: background .12s, border-color .12s;
}
.chip-sort:hover { border-color: var(--accent); }
.chip-sort.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.typefilters { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 0 16px 4px; }
.tf {
	display: inline-flex; align-items: center; gap: 7px;
	background: none; border: none; padding: 4px 2px; cursor: pointer; font-family: inherit;
	font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--sub);
	border-bottom: 2px solid transparent;
}
.tf:hover { color: var(--text); }
.tf.on { color: var(--text); border-bottom-color: var(--accent); }
.tf .cnt {
	background: rgba(0,0,0,.06); color: var(--sub);
	border-radius: 99px; padding: 1px 7px; font-size: 11px; font-weight: 600; letter-spacing: 0;
}
.tf.on .cnt { background: var(--accent-sf); color: var(--accent-dk); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tipo-badge .dot { margin-right: 5px; vertical-align: baseline; }


/* ── Listas: columnas alineadas entre todos los grupos ───────────────── */
/* Cada grupo es una tabla independiente, así que sin anchos fijos cada una
   calcula los suyos y las columnas no coinciden entre grupos. */
.grupo table { table-layout: fixed; }
.grupo th:nth-child(2), .grupo td:nth-child(2) { width: 150px; }   /* Tipo */
.grupo th:nth-child(3), .grupo td:nth-child(3) { width: 210px; }   /* Fecha de creación */
.grupo th:nth-child(4), .grupo td:nth-child(4) { width: 140px; }   /* Suscriptores */
.grupo th:nth-child(5), .grupo td:nth-child(5) { width: 140px; }   /* Último envío */
.grupo td:nth-child(1) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Pestañas de la vista de lista (Suscriptores / Vista Excel / …) ──── */
.ltabs {
	display: flex; gap: 22px; align-items: center;
	background: var(--surface); border: 1px solid var(--border); border-top: none;
	padding: 0 20px; margin-bottom: 16px;
	border-radius: 0 0 var(--radius) var(--radius);
	overflow-x: auto;
}
.ltabs a {
	padding: 12px 2px; font-size: 14px; font-weight: 600; color: var(--sub);
	text-decoration: none; white-space: nowrap;
	border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ltabs a:hover { color: var(--text); }
.ltabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.section-bar + .ltabs { border-radius: 0; }

/* ── Vista Excel: grilla editable ────────────────────────────────────── */
.excelbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.excelbar .search { max-width: 340px; margin: 0; }
.excelbar .hint { margin: 0; }
table.xls { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--surface); }
table.xls th {
	position: sticky; top: 0; z-index: 2;
	background: #f4f6f8; border: 1px solid var(--border);
	padding: 8px 10px; font-size: 11px;
}
table.xls td { border: 1px solid var(--border); padding: 0; }
table.xls td.ro { padding: 6px 10px; color: var(--sub); background: #fbfcfd; white-space: nowrap; }
table.xls input {
	border: none; background: none; width: 100%; padding: 7px 10px;
	font: inherit; color: var(--text); border-radius: 0;
}
table.xls input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }
table.xls tr.dirty td { background: #fff8e1; }
table.xls tr.saved td { background: #ecf9ef; }
table.xls tr.rowerr td { background: #fdecea; }
table.xls tbody tr:hover td { background: rgba(0,0,0,.02); }
table.xls tr.dirty:hover td { background: #fff3cd; }

/* ── Estadísticas ────────────────────────────────────────────────────── */
.statshead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fbfcfd; }
.kpi-val { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text); }
.kpi-val.ok { color: #16a34a; } .kpi-val.warn { color: var(--orange); } .kpi-val.bad { color: #dc2626; }
.kpi-lbl { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--sub); opacity: .8; }
.doms { display: flex; flex-direction: column; gap: 7px; }
.dom { display: grid; grid-template-columns: 160px 1fr 150px; gap: 12px; align-items: center; font-size: 13px; }
.dom-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dom-bar { background: rgba(0,0,0,.06); border-radius: 99px; height: 8px; overflow: hidden; }
.dom-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.dom-val { color: var(--sub); text-align: right; white-space: nowrap; }
@media (max-width: 700px) { .dom { grid-template-columns: 110px 1fr; } .dom-val { grid-column: 2; text-align: left; } }

/* ── Toggle Listas / Grupos + acciones de grupo ──────────────────────── */
.ltabs.vistas { border-radius: var(--radius); border-top: 1px solid var(--border); margin-bottom: 14px; }
.ltabs .cnt {
	background: rgba(0,0,0,.06); color: var(--sub);
	border-radius: 99px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; margin-left: 4px;
}
.ltabs a.on .cnt { background: var(--accent-sf); color: var(--accent-dk); }
.grupo h3 .gacts { margin-left: 8px; display: inline-flex; gap: 4px; align-items: center; opacity: 0; transition: opacity .12s; }
.grupo:hover h3 .gacts, .grupo h3 .gacts:focus-within { opacity: 1; }
.grupo h3 .gacts summary, .grupo h3 .gacts .del-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; padding: 0; border-radius: 6px;
	font-size: 12px; background: rgba(0,0,0,.06); color: var(--sub); border: none; cursor: pointer;
}
.grupo h3 .gacts .del-btn { background: #fdecea; color: #8a1f1a; }

/* Disparo del envío: es la acción fuerte de la fila, va con el color de acento.
   `.pend` no es un botón — es el cartel de «tu firma ya está, falta la otra». */
.send-btn { background: var(--accent); color: #fff; }
.send-btn:hover { background: var(--accent-dk, #3d7298); }
.acts-cell .pend {
	display: inline-block; padding: 5px 10px;
	font-size: 12.5px; font-weight: 500; border-radius: 8px;
	background: var(--accent-sf, #e6eef5); color: var(--accent);
	cursor: default;
}
.grupo h3 .gacts summary:hover { background: rgba(0,0,0,.12); color: var(--text); }
/* La vista plana es una sola tabla: no necesita los anchos fijos que alinean grupos. */
.grupo.flat table { table-layout: auto; }
.grupo.flat td, .grupo.flat th { white-space: nowrap; }
.grupo.flat td:first-child { white-space: normal; }

/* Los popups de las acciones de grupo salen desde un botón pegado a la izquierda:
   si se despliegan hacia la izquierda (right:0) se meten debajo del sidebar. */
.grupo h3 .gacts details.pd .pp { left: 0; right: auto; }

/* ── Barra de acciones en lote (selección múltiple) ──────────────────── */
.bulkbar {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	background: rgba(0,0,0,.03); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px;
}
.bulkbar .chk { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text); }
.bulkbar .btn { padding: 6px 14px; font-size: 13px; }

/* ── Encabezados de tabla ordenables ─────────────────────────────────── */
a.thsort {
	color: inherit; text-decoration: none; display: inline-block;
	white-space: nowrap;
}
a.thsort:hover { color: var(--accent); }
a.thsort.on { color: var(--accent-dk); }
table.xls th a.thsort { display: block; }

/* ── Envíos: KPIs clicables que filtran la tabla (idea de ASP5) ──────── */
.kpis-filtro { margin-bottom: 16px; }

/* Los nueve estados de un envío tienen que entrar en UNA sola fila. Con el
   `minmax(140px, 1fr)` de `.kpis` no daban: 9x140 + 8 gaps = 1356px contra los
   1280px de `.page-content > *`, así que «Automáticos» se caía solo a un segundo
   renglón. Acá las nueve columnas se reparten el ancho que haya, sin mínimo fijo.
   Va como clase aparte y no sobre `.kpis-filtro` porque esa la comparten Leads IA
   y el detalle de Métricas, que tienen otra cantidad de recuadros. */
.kpis-estados { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.kpis-estados .kpi { padding: 12px 10px; }
.kpis-estados .kpi-btn .kpi-val { font-size: 21px; }
.kpis-estados .kpi-lbl { font-size: 12px; white-space: nowrap; }

/* Por debajo de esto «Programados» ya no entraría sin cortarse: mejor que se
   reacomode solo en dos filas a que quede el texto tajeado. */
@media (max-width: 1120px) {
	.kpis-estados { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}
.kpi-btn {
	font-family: inherit; text-align: left; cursor: pointer;
	display: flex; flex-direction: column; gap: 2px;
	transition: border-color .15s, background .15s;
}
.kpi-btn:hover { border-color: var(--accent); }
.kpi-btn.on { border-color: var(--accent); background: var(--accent-sf); }
.kpi-btn .kpi-val { font-size: 24px; }

/* Nombre del envío cuando ya salió: se ve igual pero no es link */
.rowlink.as-text { color: var(--text); cursor: default; }
.rowlink.as-text:hover { text-decoration: none; }

table.envios td .hint { margin-top: 2px; }
table.envios td:first-child { max-width: 420px; }

/* ══ Wizard de envíos (6 pasos, layout tomado de ASP5) ═══════════════════ */
[hidden] { display: none !important; }

/* .barlink se definió para <a>; en un <button> hay que sacarle el chrome nativo */
button.barlink {
	background: none; border: 0; padding: 0; cursor: pointer;
	font-family: inherit; font-size: 13.5px; font-weight: 500;
}

.wz-steps {
	display: flex; gap: 4px; list-style: none; margin: 0 0 14px;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 10px; overflow-x: auto;
}
.wz-step {
	display: flex; align-items: center; gap: 8px; flex: 1; min-width: 130px;
	padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
	color: var(--sub); font-size: 13.5px; transition: background .15s, color .15s;
}
.wz-step:hover { background: rgba(0,0,0,.04); color: var(--text); }
.wz-step.on   { background: var(--accent-sf); color: var(--accent-dk); font-weight: 600; }
.wz-num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
	background: rgba(0,0,0,.08); color: var(--sub); font-size: 12.5px; font-weight: 700;
}
.wz-step.on .wz-num   { background: var(--accent); color: #fff; }
.wz-step.done .wz-num { background: var(--success); color: #fff; }
.wz-step.done .wz-num::after { content: '✓'; }
.wz-step.done .wz-num { font-size: 0; }
.wz-step.done .wz-num::after { font-size: 13px; }

.wz-card { padding: 22px 24px; }
.wz-title { font-size: 16px; font-weight: 600; color: var(--accent-dk); margin-bottom: 4px; }
.wz-card .hint { margin-bottom: 18px; }

.wz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.wz-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wz-field.full { grid-column: 1 / -1; }
.wz-field > span { font-size: 12px; color: var(--sub); font-weight: 600; }
.wz-field > span i, .wz-hint { font-style: normal; font-weight: 400; color: var(--sub); font-size: 11.5px; }
.wz-hint { margin-top: 2px; }
.wz-hint.warn, .wz-hint.warn b { color: var(--orange); }
.wz-inline { display: flex; gap: 8px; align-items: center; }
.wz-inline select { flex: 1; min-width: 0; }
.wz-inline details.pd { position: relative; flex-shrink: 0; }
.wz-inline details.pd summary { list-style: none; cursor: pointer; }
.wz-inline details.pd summary::-webkit-details-marker { display: none; }

.wz-resumen {
	margin-top: 18px; padding: 12px 14px; border-radius: var(--radius);
	background: var(--accent-sf); color: var(--accent-dk); font-size: 13.5px;
	/* el texto a la izquierda y el botón «Importar» a la derecha */
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.wz-resumen-txt { flex: 1; min-width: 200px; }
.wz-resumen b { font-size: 16px; }
.wz-resumen i { display: block; font-style: normal; color: var(--sub); font-size: 12px; margin-top: 3px; }
.wz-pendiente { margin-top: 6px; line-height: 1.6; }

.wz-vars { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.wz-var { font-size: 12px; padding: 4px 10px; }

.wz-nav { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.wz-nav .btn { min-width: 130px; justify-content: center; }
.wz-nav #wz-next { margin-left: auto; }
.wz-falta { font-size: 13px; color: var(--orange); }

.wz-autosave { font-size: 12px; color: rgba(255,255,255,.85); }
.wz-autosave.err { color: #ffd9d5; font-weight: 600; }

/* Picker de variables del asunto (se posiciona por JS) */
.wz-varpop {
	position: absolute; z-index: 50; max-height: 260px; overflow-y: auto;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.16);
}
.wz-varpop-head {
	padding: 7px 12px; font-size: 11px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
.wz-varopt {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 7px 12px; cursor: pointer; font-size: 13px;
}
.wz-varopt:hover, .wz-varopt.sel { background: var(--accent-sf); }
.wz-varopt code { color: var(--accent); font-size: 12px; }

@media (max-width: 820px) {
	.wz-grid { grid-template-columns: 1fr; }
	.wz-lbl { display: none; }
	.wz-step { min-width: 0; flex: 0 0 auto; }
}

/* ── Wizard: pasos 3 a 6 ─────────────────────────────────────────────── */
.wz-acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wz-prevbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 10px; }
.wz-dev { display: flex; gap: 6px; }
.wz-dev .chip-sort { font-size: 12px; padding: 4px 12px; }

.wz-frame-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.wz-frame-wrap.mobile { max-width: 375px; margin: 0 auto; }
.wz-frame { width: 100%; height: 460px; border: 0; display: block; background: #fff; }
/* Pestaña «HTML» del paso 3: el código a mano, en lugar del iframe */
.wz-html textarea {
	width: 100%; height: 460px; box-sizing: border-box; resize: vertical;
	font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
	background: #fbfcfd; color: var(--text); white-space: pre; tab-size: 2;
}
.wz-html-acts { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.wz-html-acts .hint { flex: 1; margin: 0; }

.wz-bandeja {
	border: 1px solid var(--border); border-radius: var(--radius);
	background: #fbfcfd; padding: 12px 14px; font-size: 13.5px; margin-bottom: 10px;
}
.wz-bandeja span { color: var(--sub); }
.wz-bandeja > div + div { margin-top: 3px; }
.wz-pv-quien { color: var(--sub); font-size: 12px; margin-top: 6px !important; }

.wz-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.wz-toggle {
	display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
	border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: #fbfcfd;
}
.wz-toggle input { width: auto; margin-top: 3px; }
.wz-toggle b { display: block; font-size: 13.5px; }
.wz-toggle i { display: block; font-style: normal; font-size: 12px; color: var(--sub); margin-top: 2px; }

.wz-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; max-width: 620px; }

.wz-dnsrow {
	display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
	padding: 9px 12px; border-radius: var(--radius); margin-bottom: 6px; font-size: 13.5px;
	border-left: 3px solid var(--border); background: rgba(0,0,0,.02);
}
.wz-dnsrow b { min-width: 52px; }
.wz-dnsrow code { font-size: 11.5px; color: var(--sub); word-break: break-all; }
.wz-dnsrow.ok    { border-left-color: var(--success); }
.wz-dnsrow.aviso { border-left-color: var(--orange); }
.wz-dnsrow.error { border-left-color: var(--danger); }

/* Aviso de peso del email (paso 3). El nivel lo decide MailWeight, no el CSS. */
.wz-peso {
	padding: 10px 12px; border-radius: var(--radius); margin-bottom: 10px; font-size: 13.5px;
	border-left: 3px solid var(--border); background: rgba(0,0,0,.02);
}
.wz-peso b { display: block; }
.wz-peso i { display: block; font-style: normal; font-size: 12.5px; color: var(--sub); margin-top: 3px; line-height: 1.5; }
.wz-peso.aviso   { border-left-color: var(--orange); background: #fff6ed; }
.wz-peso.peligro { border-left-color: var(--danger); background: #fdecea; }
.wz-peso.peligro b { color: #8a1f1a; }

.wz-sumario td:first-child { width: 150px; color: var(--sub); font-size: 13px; }
.wz-sumario .wz-s-aviso   { color: var(--orange); font-weight: 600; }
.wz-sumario .wz-s-peligro { color: #8a1f1a; font-weight: 600; }
.wz-probar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.wz-probar b, .wz-probar i { display: block; }
.wz-probar .btn { margin-left: auto; }

.wz-modos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.wz-modo {
	border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
	cursor: pointer; background: #fbfcfd;
}
.wz-modo:has(input:checked) { border-color: var(--accent); background: var(--accent-sf); }
.wz-modo input { width: auto; margin-right: 6px; }
.wz-modo b { font-size: 13.5px; }
.wz-modo i { display: block; font-style: normal; font-size: 12px; color: var(--sub); margin-top: 3px; }

/* El overlay sigue cubriendo la pantalla (así el click afuera cierra), pero
   transparente: el fondo gris oscuro no gustó. La caja se recorta con borde y
   sombra en vez de con el oscurecido. */
.wz-modal {
	position: fixed; inset: 0; background: transparent; z-index: 100;
	display: flex; align-items: center; justify-content: center; padding: 20px;
	/* Es hijo de .page-content, que le pone max-width: 1280px a todo: sin esto el
	   overlay medía 1280px pegado a la izquierda y el diálogo se centraba ahí, no
	   en la ventana (y el click afuera no cerraba del lado derecho). */
	max-width: none;
}
.wz-modal-box {
	background: var(--surface); border-radius: var(--radius); padding: 22px 24px;
	width: 100%; max-width: 520px; border: 1px solid var(--border);
	box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.wz-modal-box textarea {
	width: 100%; font-family: inherit; font-size: 14px; padding: 9px 11px;
	border: 1px solid var(--border); border-radius: var(--radius); resize: vertical;
}
.wz-modal-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.wz-modal-acts .hint { flex: 1; margin: 0; text-align: left; }
/* Importador embebido (la pantalla de /importar/ dentro del paso 1) */
.wz-modal-box.wz-modal-ancho { max-width: 860px; }
.wz-imp-frame { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; display: block; margin-top: 10px; }
.wz-modal .flash { margin-top: 10px; }

/* ── Biblioteca de plantillas ─────────────────────────────────────────── */
.tplgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tplcard {
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	overflow: hidden; display: flex; flex-direction: column;
}
.tplthumb { height: 190px; overflow: hidden; background: #fff; border-bottom: 1px solid var(--border); position: relative; }
.tplthumb iframe {
	width: 600px; height: 760px; border: 0; transform: scale(.3667);
	transform-origin: top left; pointer-events: none;
}
.tplinfo { padding: 10px 12px 4px; }
.tplinfo b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tplinfo span { font-size: 11.5px; color: var(--sub); }
.tplacts { display: flex; align-items: center; gap: 8px; padding: 8px 12px 12px; }
.tplacts .act { flex: 1; text-align: center; text-decoration: none; }

/* ==========================================================================
   Métricas — listado, detalle y panel de suscriptores
   ========================================================================== */
.utable th.num, .utable td.num { text-align: right; white-space: nowrap; }
table.metricas td.num b { font-size: 14px; }
.val-ok   { color: #16a34a; }
.val-link { color: var(--accent); }
.val-warn { color: var(--orange); }
.val-bad  { color: #dc2626; }

/* Detalle de un envío: dos columnas que se apilan en pantallas angostas */
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .mgrid { grid-template-columns: 1fr; } }
/* min-width:0 es lo que deja que una tarjeta con tabla ancha se encoja: sin esto el
   contenido impone su min-content y las columnas del grid se reparten solas. */
.mgrid .box { margin: 0; min-width: 0; }
/* Cuando la tarjeta de la derecha lleva una tabla ancha (el corte por variable) */
/* Tarjeta suelta a ancho completo, para las tablas que no entran en media pantalla */
.box.wide { margin-top: 14px; }

.ficha { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
         font-size: 13.5px; color: var(--sub); margin-bottom: 14px; }
.ficha b { color: var(--text); font-weight: 600; }

.chart-wrap { overflow-x: auto; margin: 10px 0 6px; }
.leg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

.devblock + .devblock { margin-top: 14px; }
.devtitle { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
            color: var(--sub); margin-bottom: 7px; }
.devblock .dom { grid-template-columns: 130px 1fr 110px; }

.url-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panel lateral con los suscriptores detrás de un número */
.drawer-ov { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; display: flex; justify-content: flex-end; }
.drawer-ov[hidden] { display: none; }
.drawer { width: 520px; max-width: 100%; background: var(--surface); height: 100%;
          display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.18); }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
                 padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer header h3 { margin: 0; }
.dclose { background: none; border: none; font-size: 26px; line-height: 1; color: var(--sub); cursor: pointer; }
.dtools { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.dtools .search { flex: 1; }
.dbody { flex: 1; overflow-y: auto; }
.dbody .utable td { font-size: 13px; }

/* Cabecera de tarjeta con control a la derecha (escala del gráfico, selector) */
.boxhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.boxhead h3 { margin: 0; }
.escala { display: flex; gap: 2px; align-items: center; }
.escala a {
	font-size: 12px; color: var(--sub); text-decoration: none;
	padding: 3px 9px; border-radius: 7px; white-space: nowrap;
}
.escala a:hover { background: rgba(0,0,0,.04); color: var(--text); }
.escala a.on { background: var(--accent-sf); color: var(--accent-dk); font-weight: 600; }
.escala select { font-size: 12.5px; padding: 4px 8px; }

/* Tablas de dos columnas (ratios, lapsos): sin encabezado y compactas */
.utable.mini td { padding: 6px 4px; font-size: 13px; }
.utable.mini td:first-child { color: var(--sub); }
.utable.mini td.num { font-variant-numeric: tabular-nums; }

/* Barra de filtros de Métricas (fecha, campaña) */
.filtros {
	display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.filtros label { display: flex; flex-direction: column; gap: 4px; }
.filtros label span {
	font-size: 11px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .05em;
}
.filtros input, .filtros select { font-size: 13.5px; padding: 7px 10px; }
.filtros .hint { padding-bottom: 6px; }

/* Selección de envíos para el comparativo */
.pickbox { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.pick {
	display: flex; align-items: center; gap: 12px;
	padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.pick-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: rgba(0,0,0,.02); }
.pick-nom { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { font-size: 12px; color: var(--sub); }
.pick-id { font-size: 11.5px; color: var(--sub); font-family: ui-monospace, Menlo, monospace; flex-shrink: 0; }

/* Fila de totales del comparativo */
table.comp .fila-total td { background: #fff7ed; color: #b45309; font-weight: 700; border-bottom: 2px solid #fed7aa; }
table.comp .fila-total .hint { color: #b45309; opacity: .8; }
table.comp td { white-space: nowrap; }

/* La barra de proporción dentro de una tabla: como <span> inline no toma alto */
td > .dom-bar { display: block; }

/* ── Resumen (pantalla de inicio) ────────────────────────────────────── */
.home-hi { margin-bottom: 18px; }
.home-hi h1 { font-size: 21px; font-weight: 700; color: var(--text); margin: 0; }
.home-hi-sub { font-size: 15px; color: var(--sub); margin-top: 5px; }
.home-hi-sub b { color: var(--text); font-weight: 600; }

.home-kpis { margin-bottom: 18px; }
.home-kpis .kpi { display: flex; flex-direction: column; gap: 3px; }

/* Dos columnas: el contenido manda y la barra lateral queda fija, como ASP5 */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.home-col { min-width: 0; }
.home-card { padding: 0; }
.home-card > .boxhead { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.home-card > .boxhead h3 { font-size: 15px; }
.home-card > .hint { padding: 14px 18px 0; }
.home-card > .tbl-wrap { padding: 0; }
.home-more { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 600; }
.home-more:hover { text-decoration: underline; }

/* Segmentos de Leads IA. Van en gris hasta que el módulo exista. */
.home-segs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px 18px 18px; }
.home-seg {
	border: 1px solid var(--border); border-radius: 10px;
	padding: 14px 10px; text-align: center;
	display: flex; flex-direction: column; gap: 3px;
}
.home-seg.off { background: #fbfcfd; opacity: .55; }
.home-seg-val { font-size: 20px; font-weight: 800; line-height: 1; }
.home-seg-lbl { font-size: 11.5px; font-weight: 700; }
.home-seg-pct { font-size: 11px; color: var(--sub); }

/* La tabla de últimos envíos vive pegada a los bordes de la tarjeta */
.home-card table.utable th:first-child, .home-card table.utable td:first-child { padding-left: 18px; }
.home-card table.utable th:last-child,  .home-card table.utable td:last-child  { padding-right: 18px; }

/* Acciones rápidas */
.home-acts { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.home-act {
	display: flex; align-items: center; gap: 11px;
	padding: 10px 13px; border-radius: 9px;
	border: 1px solid var(--border); background: #fbfcfd;
	color: var(--text); text-decoration: none;
}
.home-act:hover { border-color: var(--accent); background: var(--accent-sf); }
.home-act svg { width: 18px; height: 18px; flex-shrink: 0; fill: var(--accent); }
.home-act span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.home-act b { font-size: 13px; font-weight: 600; }
.home-act small { font-size: 11.5px; color: var(--sub); }
.home-act.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.home-act.primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.home-act.primary svg { fill: #fff; }
.home-act.primary small { color: rgba(255,255,255,.8); }

/* Alertas */
.home-alerts { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.home-alert {
	display: flex; flex-direction: column; gap: 2px;
	padding: 10px 12px; border-radius: 9px; border: 1px solid;
	text-decoration: none; font-size: 12.5px;
}
.home-alert b { font-weight: 700; }
.home-alert small { font-size: 11.5px; opacity: .85; }
.home-alert.warn { background: #fdf6e3; border-color: #f3d68a; color: #7a5410; }
.home-alert.info { background: var(--accent-sf); border-color: #b9d3e5; color: var(--accent-dk); }
.home-alert:hover { filter: brightness(.97); }

@media (max-width: 980px) {
	.home-grid { grid-template-columns: 1fr; }
	.home-segs { grid-template-columns: repeat(2, 1fr); }
}

/* ── Paso 3: imágenes que el HTML pide y todavía no están hosteadas ───── */
.wz-imgfalta {
	border: 1px solid rgba(232,115,12,.35); background: #fff7ed;
	border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px;
}
.wz-imgfalta b { color: #92400e; display: block; }
.wz-imgfalta i { display: block; font-style: normal; color: var(--sub); font-size: 12px; margin-top: 3px; }
.wz-imgfalta ul { margin: 8px 0 0; padding-left: 20px; }
.wz-imgfalta li {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px; color: var(--text); word-break: break-all;
}

/* ── DNS / Autenticación (/dns/) ─────────────────────────────────────────── */
.dns-form { margin-bottom: 18px; }
.dns-form label { display: block; font-size: 12px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.dns-form-row { display: flex; gap: 10px; max-width: 560px; }
.dns-form-row input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: inherit; }
.dns-form-row input:focus { outline: none; border-color: var(--accent); }
.dns-chip {
	display: inline-block; margin: 4px 4px 0 0; padding: 2px 9px; border-radius: 12px;
	background: rgba(0,0,0,.05); color: var(--text); font-size: 12.5px; text-decoration: none;
}
.dns-chip:hover { background: rgba(0,0,0,.10); }
.dns-chip.on { background: var(--accent); color: #fff; }
.dns-h3 { font-size: 15px; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.dns-badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 12px; }
.dns-badge.ok    { background: #dcfce7; color: #166534; }
.dns-badge.aviso { background: #fef3c7; color: #92400e; }
.dns-badge.error { background: #fdecea; color: #8a1f1a; }
.dns-regs td { vertical-align: top; }
.dns-regs td small { color: var(--sub); }
.dns-regs .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--border); }
.dns-regs .dot.ok    { background: var(--success); }
.dns-regs .dot.aviso { background: var(--orange); }
.dns-regs .dot.error { background: var(--danger); }
.dns-val { display: block; font-size: 12px; word-break: break-all; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.dns-val:hover { background: rgba(0,0,0,.04); }
.dns-val.copiado { background: #dcfce7; }
.dns-val.dns-host { white-space: nowrap; word-break: normal; }
.dns-regs .hint { margin-top: 6px; }
.dns-reg-st { white-space: nowrap; font-size: 12.5px; }
.dns-regs .dot { margin-top: 0; vertical-align: middle; margin-right: 3px; }

/* ── Cambio masivo (/lista/cambio/) ───────────────────────────────────── */
h3.paso { font-size: 14px; color: var(--accent-dk); margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--border); }
h3.paso:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.conj { padding: 4px 0 6px; }
.par { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.par > label.lbl { margin: 8px 0 4px; }
.acciones { display: flex; flex-direction: column; gap: 8px; }
.accion {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
	font-size: 14px;
}
.accion:has(input:checked) { border-color: var(--accent); background: var(--accent-sf); }
.accion.danger:has(input:checked) { border-color: #e8b4b0; background: #fdecea; }
.accion .par { gap: 8px; align-items: center; }
.accion input[type=text] { width: 220px; }
table.prevt { margin-top: 12px; font-size: 13px; }
table.prevt td, table.prevt th { padding: 6px 10px; }
.confirmar {
	margin-top: 14px; padding: 14px 16px; border-radius: 10px;
	background: #fdecea; border: 1px solid #e8b4b0; color: #8a1f1a;
}
.confirmar p { margin: 0 0 10px; font-weight: 600; }

/* ── Wizard de envíos: test A/B ── */
.wz-ab-toggle { max-width: 720px; }
.wz-ab-cfg { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(0,0,0,.015); }
.wz-ab-cfg input[type=range] { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; }
.wz-ab-hint { margin: 12px 0 0; }
.wz-vtabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.wz-vtabs .chip-sort { font-size: 12.5px; padding: 5px 14px; }
.wz-vtabs .hint { margin: 0 0 0 8px; }

/* ── Select con búsqueda (js/combosel.js) ── */
.cs { position: relative; min-width: 0; }
.cs .cs-native { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.cs-input { width: 100%; padding-right: 30px; cursor: text; }
.cs-input.cs-vacio { color: var(--sub); }
.cs-arrow { position: absolute; right: 11px; top: 50%; width: 0; height: 0; margin-top: -2px; border: 5px solid transparent; border-top-color: var(--sub); cursor: pointer; }
.cs-list { position: absolute; z-index: 60; left: 0; right: 0; top: 100%; margin-top: 4px; max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.cs-group { padding: 8px 12px 3px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--sub); }
.cs-opt { padding: 7px 12px; font-size: 13.5px; cursor: pointer; }
.cs-opt.sel { background: var(--accent-sf); color: var(--accent-dk); }
.cs-none { padding: 10px 12px; font-size: 13px; color: var(--sub); }

/* Autocompletado de remitente (js/autofill.js). Va en el <body> y posicionado
   a mano, no dentro del campo: el paso 2 está en un contenedor con overflow. */
.af-list { position: absolute; z-index: 90; max-height: 260px; overflow-y: auto; background: #fff;
	border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.af-opt { padding: 7px 12px; font-size: 13.5px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.af-opt b { font-weight: 600; color: var(--text); }
.af-opt span { font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-opt.sel, .af-opt:hover { background: var(--accent-sf); }
.af-opt.sel b { color: var(--accent-dk); }
.af-opt .af-x { margin-left: auto; padding: 0 2px; font-style: normal; font-size: 12px; color: var(--sub); opacity: 0; }
.af-opt:hover .af-x, .af-opt.sel .af-x { opacity: 1; }
.af-opt .af-x:hover { color: #b3261e; }
.wz-inline .cs { flex: 1; }

/* ── Ajustes de testing 2026-09-21 ─────────────────────────────────────── */
/* Vista Excel: el email es lo que identifica a la persona; no se corta. */
table.xls td:has(> input[data-campo="email"]) { min-width: 240px; }
/* Suscriptores: teléfono y fecha de alta en una sola línea. */
table.subs td.nowrap, table.subs th.nowrap { white-space: nowrap; }

/* Panel de Métricas: formulario para armar una lista con lo que se está viendo */
.dnueva {
	display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
	padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.dnueva[hidden] { display: none; }
.dnueva label { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 150px; }
.dnueva label span {
	font-size: 11px; font-weight: 600; color: var(--sub);
	text-transform: uppercase; letter-spacing: .05em;
}
.dnueva input, .dnueva select { font-size: 13.5px; padding: 7px 10px; width: 100%; }
.dnueva-btns { display: flex; gap: 8px; align-items: center; }
.dnueva .hint { flex-basis: 100%; margin: 0; }

/* Actividad por destinatario: paginador con los botones a los costados */
.box .pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.act.off { opacity: .4; pointer-events: none; }
table.actividad td, table.actividad th { vertical-align: top; white-space: nowrap; padding: 8px 10px; }
table.actividad td { font-size: 12.5px; }
table.actividad .url-cell { max-width: 230px; white-space: normal; }
table.actividad .hint { font-size: 11px; }

/* ── Desplegable de selección múltiple con casillas (js/multisel.js) ── */
.msel { position: relative; }
.msel-btn {
	width: 100%; text-align: left; background: #fff; color: var(--txt);
	border: 1px solid var(--border); border-radius: var(--radius);
	padding: 8px 30px 8px 11px; font-size: 13.5px; cursor: pointer;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msel-btn.vacio { color: var(--sub); }
.msel-btn:after {
	content: ''; position: absolute; right: 11px; top: 50%; width: 0; height: 0;
	margin-top: -2px; border: 5px solid transparent; border-top-color: var(--sub);
}
.msel.abierto .msel-btn { border-color: var(--accent); }
.msel-pop {
	position: absolute; z-index: 60; left: 0; right: 0; top: 100%; margin-top: 4px;
	background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px;
}
.msel-q { width: 100%; font-size: 13px; padding: 6px 9px; margin-bottom: 6px; }
.msel-ops { max-height: 230px; overflow-y: auto; }
.msel-ops label {
	display: flex; align-items: center; gap: 8px; padding: 6px 8px;
	font-size: 13.5px; cursor: pointer; border-radius: 4px;
}
.msel-ops label:hover { background: var(--accent-sf); }
.msel-ops label[hidden] { display: none; }
.msel-ops input { margin: 0; }
.msel-vacia { padding: 8px; font-size: 13px; color: var(--sub); }

/* Paso 6 del wizard y popup «Quién lo ve»: anunciantes y agencia, mitad y mitad */
.wz-quien { display: flex; gap: 16px; align-items: flex-start; }
.wz-quien > * { flex: 1 1 0; min-width: 0; }
@media (max-width: 700px) { .wz-quien { flex-wrap: wrap; } }
