/* gestor.css — diseño del «Gestor streaming». Oscuro por defecto; claro con data-tema="claro" (o el del sistema). */
:root {
    --fondo: #0b1020; --fondo-2: #0f1529; --superficie: #131a31; --superficie-2: #1a2240; --borde: #253055; --borde-suave: #1d2647;
    --texto: #e8ecf8; --texto-2: #b6c0dc; --suave: #8792b4;
    --pri: #3b82f6; --pri-2: #2563eb; --pri-suave: rgba(59, 130, 246, .14); --pri-texto: #93c5fd;
    --ok: #22c55e; --ok-suave: rgba(34, 197, 94, .14); --ok-texto: #86efac;
    --alerta: #f59e0b; --alerta-suave: rgba(245, 158, 11, .15); --alerta-texto: #fcd34d;
    --peligro: #ef4444; --peligro-suave: rgba(239, 68, 68, .14); --peligro-texto: #fca5a5;
    --radio: 12px; --radio-g: 16px; --sombra: 0 10px 30px -12px rgba(0, 0, 0, .55);
    --lateral: 248px; --trans: .18s ease;
    color-scheme: dark;
}
:root[data-tema="claro"] {
    --fondo: #f4f6fb; --fondo-2: #eef1f8; --superficie: #ffffff; --superficie-2: #f6f8fc; --borde: #dfe4ef; --borde-suave: #e9edf5;
    --texto: #0f172a; --texto-2: #334155; --suave: #64748b;
    --pri-suave: rgba(37, 99, 235, .1); --pri-texto: #1d4ed8;
    --ok-suave: rgba(22, 163, 74, .1); --ok-texto: #15803d;
    --alerta-suave: rgba(217, 119, 6, .12); --alerta-texto: #b45309;
    --peligro-suave: rgba(220, 38, 38, .1); --peligro-texto: #b91c1c;
    --sombra: 0 10px 30px -14px rgba(15, 23, 42, .25);
    color-scheme: light;
}
@media (prefers-color-scheme: light) {
    :root:not([data-tema="oscuro"]) {
        --fondo: #f4f6fb; --fondo-2: #eef1f8; --superficie: #ffffff; --superficie-2: #f6f8fc; --borde: #dfe4ef; --borde-suave: #e9edf5;
        --texto: #0f172a; --texto-2: #334155; --suave: #64748b;
        --pri-suave: rgba(37, 99, 235, .1); --pri-texto: #1d4ed8;
        --ok-suave: rgba(22, 163, 74, .1); --ok-texto: #15803d;
        --alerta-suave: rgba(217, 119, 6, .12); --alerta-texto: #b45309;
        --peligro-suave: rgba(220, 38, 38, .1); --peligro-texto: #b91c1c;
        --sombra: 0 10px 30px -14px rgba(15, 23, 42, .25);
        color-scheme: light;
    }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--pri-texto); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--pri); color: #fff; padding: .5rem 1rem; z-index: 99; }
.saltar:focus { left: 1rem; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Menú lateral ── */
.lateral { position: fixed; inset: 0 auto 0 0; width: var(--lateral); background: var(--fondo-2); border-right: 1px solid var(--borde-suave); display: flex; flex-direction: column; z-index: 40; transition: transform var(--trans), width var(--trans); }
.marca { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.1rem 1rem; color: var(--texto); font-weight: 800; }
.marca:hover { text-decoration: none; }
.marca-inicial, .marca-logo { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.marca-inicial { background: linear-gradient(135deg, var(--pri), #8b5cf6); color: #fff; }
.marca-logo { background: #fff; overflow: hidden; }
.marca-logo img { max-width: 30px; max-height: 30px; object-fit: contain; }
.marca-texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lateral-nav { flex: 1; overflow-y: auto; padding: 0 .7rem 1rem; }
.lateral-grupo { margin: 1rem .55rem .35rem; font-size: .68rem; font-weight: 800; letter-spacing: .09em; color: var(--suave); }
.lateral ul { list-style: none; margin: 0; padding: 0; }
.lateral li a { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border-radius: 10px; color: var(--texto-2); font-weight: 600; font-size: .92rem; }
.lateral li a i { width: 18px; text-align: center; color: var(--suave); }
.lateral li a:hover { background: var(--superficie); text-decoration: none; color: var(--texto); }
.lateral li a.activo { background: var(--pri-suave); color: var(--pri-texto); }
.lateral li a.activo i { color: var(--pri-texto); }
.lateral li a span { white-space: nowrap; overflow: hidden; }
.insignia { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--peligro); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.plegar { margin: .5rem .7rem 1rem; display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--borde-suave); border-radius: 10px; background: transparent; color: var(--suave); font: inherit; font-size: .85rem; cursor: pointer; }
.plegar:hover { color: var(--texto); }
:root[data-lateral="plegada"] { --lateral: 74px; }
:root[data-lateral="plegada"] .lateral .marca-texto, :root[data-lateral="plegada"] .lateral li a span, :root[data-lateral="plegada"] .lateral-grupo, :root[data-lateral="plegada"] .plegar span { display: none; }
:root[data-lateral="plegada"] .lateral li a { justify-content: center; position: relative; }
:root[data-lateral="plegada"] .insignia { position: absolute; top: 2px; right: 4px; }
:root[data-lateral="plegada"] .plegar i { transform: rotate(180deg); }
:root[data-lateral="plegada"] .plegar { justify-content: center; }
.lateral-fondo { display: none; }

/* ── Cabecera y contenido ── */
.principal { margin-left: var(--lateral); min-height: 100vh; transition: margin var(--trans); }
.barra { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .8rem; padding: .7rem 1.6rem; background: color-mix(in srgb, var(--fondo) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--borde-suave); }
.barra-quien { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.barra-quien strong { font-size: .92rem; }
.barra-quien span { font-size: .75rem; color: var(--suave); }
.barra-acc { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.btn-icono.hamburguesa { display: none; }
.contenido { max-width: 1240px; margin: 0 auto; padding: 1.4rem 1.6rem 3rem; }
.titulo-sec { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.titulo-sec h1 { font-size: 1.55rem; font-weight: 800; }
.titulo-sec .sub { margin: .3rem 0 0; color: var(--suave); font-size: .92rem; }
.titulo-acc { display: flex; gap: .5rem; flex-wrap: wrap; }
.volver { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--suave); margin-bottom: .35rem; }

/* ── Botones ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1rem; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--superficie); color: var(--texto); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background var(--trans), border-color var(--trans), transform .08s; }
.btn:hover { border-color: var(--suave); }
.btn:active { transform: translateY(1px); }
.btn-pri { background: linear-gradient(180deg, var(--pri), var(--pri-2)); border-color: transparent; color: #fff; }
.btn-pri:hover { filter: brightness(1.07); border-color: transparent; }
.btn-ok { background: var(--ok); border-color: transparent; color: #fff; }
.btn-wa { background: #25d366; border-color: transparent; color: #06351b; }
.btn-peligro { background: var(--peligro-suave); border-color: transparent; color: var(--peligro-texto); }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--texto-2); }
.btn-chico { padding: .42rem .75rem; font-size: .82rem; border-radius: 10px; }
.btn-ancho { width: 100%; }
.btn[disabled], .btn.cargando { opacity: .6; pointer-events: none; }
.btn-icono { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--borde-suave); background: var(--superficie); color: var(--texto-2); cursor: pointer; font-size: .95rem; }
.btn-icono:hover { color: var(--texto); border-color: var(--borde); }

/* ── Avisos y estados vacíos ── */
.aviso { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem 1rem; border-radius: var(--radio); margin-bottom: 1rem; font-size: .92rem; border: 1px solid transparent; }
.aviso i { margin-top: .2rem; }
.aviso-ok { background: var(--ok-suave); color: var(--ok-texto); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.aviso-error { background: var(--peligro-suave); color: var(--peligro-texto); border-color: color-mix(in srgb, var(--peligro) 30%, transparent); }
.aviso-info { background: var(--pri-suave); color: var(--pri-texto); border-color: color-mix(in srgb, var(--pri) 30%, transparent); }
.aviso-alerta { background: var(--alerta-suave); color: var(--alerta-texto); border-color: color-mix(in srgb, var(--alerta) 30%, transparent); }
.vacio { text-align: center; padding: 2.6rem 1rem; color: var(--suave); }
.vacio > i { font-size: 1.9rem; color: var(--borde); margin-bottom: .7rem; display: block; }
.vacio h3 { color: var(--texto); font-size: 1.05rem; margin-bottom: .35rem; }
.vacio p { margin: 0 auto 1rem; max-width: 440px; }

/* ── Tarjetas ── */
.caja { background: var(--superficie); border: 1px solid var(--borde-suave); border-radius: var(--radio-g); padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; }
.caja > h2, .caja-tit { font-size: 1.02rem; font-weight: 800; margin-bottom: .2rem; }
.caja .sub, .caja-sub { color: var(--suave); font-size: .86rem; margin: 0 0 .9rem; }
.caja-cab { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.caja-cab h2 { font-size: 1.02rem; font-weight: 800; }
.caja-peligro { border-color: color-mix(in srgb, var(--peligro) 35%, transparent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.kpi { display: block; background: var(--superficie); border: 1px solid var(--borde-suave); border-radius: var(--radio-g); padding: 1rem 1.1rem; color: inherit; transition: border-color var(--trans), transform var(--trans); }
a.kpi:hover { text-decoration: none; border-color: var(--borde); transform: translateY(-1px); }
.kpi-t { font-size: .8rem; color: var(--suave); font-weight: 700; display: flex; align-items: center; gap: .45rem; }
.kpi-v { font-size: 1.55rem; font-weight: 800; margin: .25rem 0 .1rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: .78rem; color: var(--suave); }
.kpi-ok .kpi-v { color: var(--ok-texto); } .kpi-mal .kpi-v { color: var(--peligro-texto); } .kpi-alerta .kpi-v { color: var(--alerta-texto); }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.rejilla-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.rejilla-lateral { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.1rem; align-items: start; }
.rejilla > *, .rejilla-3 > *, .rejilla-lateral > * { min-width: 0; }

/* ── Insignias ── */
.ins { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 800; white-space: nowrap; background: var(--superficie-2); color: var(--texto-2); border: 1px solid var(--borde-suave); }
.ins-vigente, .ins-ok { background: var(--ok-suave); color: var(--ok-texto); border-color: transparent; }
.ins-por-vencer, .ins-alerta { background: var(--alerta-suave); color: var(--alerta-texto); border-color: transparent; }
.ins-vencida, .ins-mal { background: var(--peligro-suave); color: var(--peligro-texto); border-color: transparent; }
.ins-info { background: var(--pri-suave); color: var(--pri-texto); border-color: transparent; }
.punto { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

[data-logos] .btn.activo { border-color: var(--pri); background: var(--pri-suave); }
.segmentos .btn.activo { border-color: var(--pri); background: var(--pri-suave); color: var(--pri-texto); }

/* ── Logos de servicio ── */
.logo { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: #fff; font-weight: 900; flex-shrink: 0; letter-spacing: -.03em; text-transform: none; overflow: hidden; }
.logo-img { background: #fff; }
.logo-img img { width: 100%; height: 100%; object-fit: contain; }
.con-logo { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.con-logo > div { min-width: 0; }
.con-logo strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { font-size: .78rem; color: var(--suave); }

/* ── Filtros ── */
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.buscador { flex: 1 1 260px; display: flex; gap: .4rem; }
.buscador input { flex: 1; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .38rem .8rem; border-radius: 99px; border: 1px solid var(--borde-suave); background: var(--superficie); color: var(--texto-2); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.chip:hover { text-decoration: none; border-color: var(--borde); }
.chip.activo { background: var(--pri-suave); color: var(--pri-texto); border-color: transparent; }
.chip b { font-weight: 800; opacity: .75; }
.filtro-grupo { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--suave); }

/* ── Tablas (se vuelven tarjetas en el celular) ── */
.tabla-env { background: var(--superficie); border: 1px solid var(--borde-suave); border-radius: var(--radio-g); overflow: hidden; margin-bottom: 1.1rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th { text-align: left; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--suave); padding: .75rem 1rem; border-bottom: 1px solid var(--borde-suave); background: var(--superficie-2); white-space: nowrap; }
.tabla td { padding: .75rem 1rem; border-bottom: 1px solid var(--borde-suave); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: color-mix(in srgb, var(--superficie-2) 60%, transparent); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .acc { text-align: right; white-space: nowrap; }
.fila-link { cursor: pointer; }
.paginas { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--borde-suave); font-size: .84rem; color: var(--suave); flex-wrap: wrap; }

/* ── Formularios ── */
label { display: block; font-size: .84rem; font-weight: 700; color: var(--texto-2); margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: .62rem .8rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--fondo-2); color: var(--texto); font: inherit; font-size: .93rem; transition: border-color var(--trans), box-shadow var(--trans);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-suave); }
textarea { resize: vertical; min-height: 84px; }
input[type=color] { width: 46px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--borde); background: var(--fondo-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--pri); width: 17px; height: 17px; }
.campo { margin-bottom: .95rem; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.campos-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.campos > *, .campos-3 > * { min-width: 0; }
.ayuda { font-size: .78rem; color: var(--suave); margin: .3rem 0 0; font-weight: 400; }
.opcional { font-weight: 400; color: var(--suave); }
.casilla { display: flex; align-items: flex-start; gap: .55rem; font-weight: 600; color: var(--texto); cursor: pointer; margin-bottom: .55rem; }
.casilla input { margin-top: .15rem; flex-shrink: 0; }
.botones { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.segmentos { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.segmentos input { position: absolute; opacity: 0; pointer-events: none; }
.segmentos label { margin: 0; padding: .45rem .8rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--fondo-2); font-size: .85rem; cursor: pointer; color: var(--texto-2); }
.segmentos input:checked + label, .segmentos label.activo { background: var(--pri-suave); border-color: var(--pri); color: var(--pri-texto); }
.segmentos input:focus-visible + label { outline: 2px solid var(--pri); }

/* ── Paso a paso de la venta ── */
.paso { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1rem; margin-bottom: .8rem; }
.paso b { width: 26px; height: 26px; border-radius: 50%; background: var(--pri-suave); color: var(--pri-texto); display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; }
.servicios-elegir { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.servicio-op { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--fondo-2); color: var(--texto); font-weight: 700; }
.servicio-op:hover { text-decoration: none; border-color: var(--pri); }
.servicio-op.activo { border-color: var(--pri); background: var(--pri-suave); }
.cuenta-pick { border: 1px solid var(--borde-suave); border-radius: var(--radio); padding: .8rem .9rem; margin-bottom: .65rem; background: var(--fondo-2); }
.cuenta-pick-cab { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .55rem; font-size: .88rem; }
.perfiles-pick { display: flex; flex-wrap: wrap; gap: .4rem; }
.perfiles-pick input { position: absolute; opacity: 0; pointer-events: none; }
.perfiles-pick label { margin: 0; display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .75rem; border-radius: 99px; border: 1px solid var(--borde); background: var(--superficie); font-size: .83rem; font-weight: 700; color: var(--texto-2); cursor: pointer; }
.perfiles-pick input:checked + label { background: var(--pri); border-color: var(--pri); color: #fff; }
.perfiles-pick input:disabled + label { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.perfiles-pick input:focus-visible + label { outline: 2px solid var(--pri); outline-offset: 2px; }
.resumen-venta { position: sticky; top: 76px; }
.resumen-fila { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; font-size: .9rem; border-bottom: 1px dashed var(--borde-suave); }
.resumen-fila:last-child { border-bottom: 0; }
.resumen-fila span { color: var(--suave); }
.lista-clientes { max-height: 260px; overflow-y: auto; border: 1px solid var(--borde-suave); border-radius: var(--radio); margin-top: .5rem; }
.lista-clientes button { display: flex; width: 100%; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border: 0; border-bottom: 1px solid var(--borde-suave); background: transparent; color: var(--texto); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.lista-clientes button:last-child { border-bottom: 0; }
.lista-clientes button:hover, .lista-clientes button.activo { background: var(--pri-suave); }
.cliente-elegido { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--pri); background: var(--pri-suave); border-radius: var(--radio); }

/* ── Ficha (pares dato/valor) ── */
.datos { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; font-size: .9rem; margin: 0; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.credenciales { background: var(--fondo-2); border: 1px dashed var(--borde); border-radius: var(--radio); padding: .9rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 .8rem; }
.items-venta { display: grid; gap: .5rem; margin-bottom: .9rem; }
.item-venta { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--borde-suave); border-radius: var(--radio); background: var(--fondo-2); flex-wrap: wrap; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { position: relative; padding: 0 0 .9rem 1.3rem; font-size: .88rem; }
.linea-tiempo li::before { content: ""; position: absolute; left: 0; top: .45rem; width: 9px; height: 9px; border-radius: 50%; background: var(--pri); }
.linea-tiempo li::after { content: ""; position: absolute; left: 4px; top: 1.1rem; bottom: 0; width: 1px; background: var(--borde-suave); }
.linea-tiempo li:last-child::after { display: none; }
.mensajes { display: grid; gap: .65rem; margin-bottom: 1rem; }
.mensaje { background: var(--fondo-2); border: 1px solid var(--borde-suave); border-radius: var(--radio); padding: .7rem .9rem; }
.mensaje-cab { display: flex; justify-content: space-between; gap: .6rem; font-size: .78rem; color: var(--suave); margin-bottom: .3rem; }
.mensaje p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }

/* ── Gráficas sencillas ── */
.barras { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: .5rem; }
.barras .b { flex: 1; min-width: 4px; background: var(--pri); border-radius: 4px 4px 0 0; position: relative; opacity: .85; transition: opacity var(--trans); }
.barras .b:hover { opacity: 1; }
.barras .b[data-cero] { background: var(--borde-suave); }
.barras-eje { display: flex; justify-content: space-between; font-size: .72rem; color: var(--suave); margin-top: .35rem; }
.duo { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.duo-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.duo-barras { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.duo-barras .b { width: 42%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; }
.duo-col span { font-size: .72rem; color: var(--suave); }
.leyenda { display: flex; gap: 1rem; font-size: .78rem; color: var(--suave); margin-top: .5rem; }
.leyenda span { display: inline-flex; align-items: center; gap: .35rem; }
.anillo { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--borde-suave) 0); display: flex; align-items: center; justify-content: center; margin: .4rem auto; }
.anillo::before { content: attr(data-texto); width: 88px; height: 88px; border-radius: 50%; background: var(--superficie); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; }
.top-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.top-lista li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; font-size: .88rem; }
.top-barra { height: 6px; border-radius: 99px; background: var(--borde-suave); overflow: hidden; grid-column: 2 / 4; margin-top: -.35rem; }
.top-barra i { display: block; height: 100%; background: var(--pri); border-radius: 99px; }

/* ── WhatsApp: vista previa del editor de mensajes ── */
.wa-prev { background: #0b141a; border-radius: var(--radio-g); padding: 1rem; min-height: 200px; }
:root[data-tema="claro"] .wa-prev { background: #efeae2; }
.wa-burbuja { background: #005c4b; color: #e9edef; border-radius: 10px 0 10px 10px; padding: .6rem .75rem; max-width: 92%; margin-left: auto; font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
:root[data-tema="claro"] .wa-burbuja { background: #d9fdd3; color: #111b21; }
@media (prefers-color-scheme: light) {
    :root:not([data-tema="oscuro"]) .wa-prev { background: #efeae2; }
    :root:not([data-tema="oscuro"]) .wa-burbuja { background: #d9fdd3; color: #111b21; }
}
.wa-burbuja .h { display: block; text-align: right; font-size: .68rem; opacity: .65; margin-top: .2rem; }
.vars { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0 .6rem; }
.vars button { padding: .25rem .55rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo-2); color: var(--pri-texto); font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }

/* ── Diálogos ── */
dialog { border: 1px solid var(--borde); border-radius: var(--radio-g); background: var(--superficie); color: var(--texto); padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: var(--sombra); }
dialog::backdrop { background: rgba(5, 8, 20, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg-cab { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 1rem 1.2rem .4rem; }
.dlg-cab h3 { font-size: 1.05rem; }
.dlg-cuerpo { padding: .6rem 1.2rem 1.2rem; }

/* ── Barra móvil ── */
.barra-movil { display: none; }

/* ── Comprobante ── */
.comprobante { max-width: 420px; margin: 0 auto; background: #fff; color: #0f172a; border-radius: 18px; padding: 1.6rem 1.5rem; box-shadow: var(--sombra); }

@media (max-width: 1100px) {
    .rejilla-lateral { grid-template-columns: 1fr; }
    .resumen-venta { position: static; }
    .rejilla-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    :root, :root[data-lateral="plegada"] { --lateral: 260px; }
    .lateral { transform: translateX(-100%); box-shadow: var(--sombra); }
    :root[data-lateral="plegada"] .lateral .marca-texto, :root[data-lateral="plegada"] .lateral li a span, :root[data-lateral="plegada"] .lateral-grupo { display: revert; }
    :root[data-lateral="plegada"] .lateral li a { justify-content: flex-start; }
    .lateral.abierta { transform: none; }
    .lateral-fondo.abierta { display: block; position: fixed; inset: 0; background: rgba(5, 8, 20, .5); z-index: 35; }
    .plegar { display: none; }
    .principal { margin-left: 0; padding-bottom: 76px; }
    .btn-icono.hamburguesa { display: inline-flex; }
    .barra { padding: .6rem 1rem; }
    .contenido { padding: 1.1rem 1rem 2rem; }
    .solo-escritorio { display: none !important; }
    .rejilla, .campos { grid-template-columns: 1fr; }
    .barra-movil { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; align-items: center; padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--fondo-2) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--borde-suave); }
    .barra-movil a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .68rem; font-weight: 700; color: var(--suave); padding: .25rem 0; }
    .barra-movil a i { font-size: 1.1rem; }
    .barra-movil a.activo { color: var(--pri-texto); }
    .barra-movil a:hover { text-decoration: none; }
    .barra-movil .fab { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(180deg, var(--pri), var(--pri-2)); color: #fff; justify-content: center; margin-top: -24px; box-shadow: 0 8px 20px -6px rgba(37, 99, 235, .7); }
    .barra-movil .fab i { font-size: 1.25rem; }
    /* Tablas → tarjetas */
    .tabla-env { background: transparent; border: 0; overflow: visible; }
    .tabla thead { display: none; }
    .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
    .tabla tr { background: var(--superficie); border: 1px solid var(--borde-suave); border-radius: var(--radio-g); margin-bottom: .65rem; padding: .55rem .2rem; }
    .tabla td { border: 0; padding: .3rem .85rem; display: flex; justify-content: space-between; align-items: center; gap: .8rem; text-align: right; }
    .tabla td[data-l]::before { content: attr(data-l); font-size: .74rem; font-weight: 700; color: var(--suave); text-align: left; flex-shrink: 0; }
    .tabla td.td-principal { display: block; text-align: left; padding-bottom: .4rem; }
    .tabla td.td-principal::before { display: none; }
    .tabla .acc { justify-content: flex-end; }
    .paginas { background: var(--superficie); border: 1px solid var(--borde-suave); border-radius: var(--radio-g); }
}
@media (max-width: 560px) {
    .kpis { grid-template-columns: 1fr 1fr; gap: .55rem; }
    .kpi { padding: .8rem .85rem; }
    .kpi-v { font-size: 1.2rem; }
    .rejilla-3, .campos-3 { grid-template-columns: 1fr; }
    .titulo-sec h1 { font-size: 1.3rem; }
    .titulo-acc { width: 100%; }
    .titulo-acc .btn { flex: 1; }
    .caja { padding: 1rem; }
    .barra-quien span { display: none; }
}
@media print {
    .lateral, .barra, .barra-movil, .titulo-sec, .no-imprimir { display: none !important; }
    .principal { margin: 0; }
    body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
