/* =====================================================================================
   Sistema CIFSA · diseño 2 (aplicación con barra lateral). Se carga DESPUÉS de ventas.css
   y lo refina; quitar este archivo devuelve el diseño anterior.
   ===================================================================================== */
:root {
  --fondo-1: #050b18; --fondo-2: #081530;
  --caja: rgba(13, 25, 50, .72); --caja-solida: #0c1a35; --caja-alta: #10213f;
  --borde: rgba(148, 178, 230, .10); --borde-fuerte: rgba(148, 178, 230, .20);
  --texto: #eef3fb; --suave: #a3b4cc; --tenue: #71839e;
  --acento: #3987e5; --acento-2: #5aa2ff; --brillo: 0 0 0 1px rgba(90, 162, 255, .25), 0 10px 40px rgba(57, 135, 229, .18);
  --radio: 16px; --barra-ancho: 252px;
}
body {
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(57, 135, 229, .20), transparent 60%),
    radial-gradient(700px 420px at 15% 110%, rgba(229, 53, 43, .08), transparent 60%),
    linear-gradient(180deg, #071226 0%, var(--fondo-1) 60%);
  background-attachment: fixed;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.fondo-ondas { opacity: .45; height: 380px; }
.vidrio { background: var(--caja); border: 1px solid var(--borde); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px rgba(0,0,0,.28); }

/* ---------- Estructura: barra lateral + contenido ---------- */
.app { display: grid; grid-template-columns: var(--barra-ancho) minmax(0, 1fr); min-height: 100vh; position: relative; z-index: 1; }
.app[hidden] { display: none; }
.barra {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 22, 46, .96), rgba(6, 14, 30, .98));
  border-right: 1px solid var(--borde); padding: calc(1.1rem + env(safe-area-inset-top, 0px)) .8rem 1rem; z-index: 20;
}
.barra-marca { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; padding: .2rem .6rem 1.2rem; }
.barra-marca .marca-logo { font-size: 1.75rem; }
.barra-sub { color: var(--tenue); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; margin-top: .3rem; }
.barra-nav { display: grid; gap: .15rem; flex: 1; align-content: start; }
.barra-item {
  display: flex; align-items: center; gap: .7rem; padding: .58rem .7rem; border-radius: 10px; color: var(--suave);
  text-decoration: none; font-weight: 550; font-size: .9rem; cursor: pointer; list-style: none; transition: background .15s, color .15s;
}
.barra-item::-webkit-details-marker { display: none; }
.barra-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.barra-item em { margin-left: auto; font-style: normal; font-size: .7rem; color: var(--tenue); }
.barra-item:hover { background: rgba(255, 255, 255, .05); color: var(--texto); }
.barra-item.activo, .barra-item.actual { color: #fff; background: linear-gradient(90deg, color-mix(in srgb, var(--tono, var(--acento)) 30%, transparent), transparent); box-shadow: inset 3px 0 0 var(--tono, var(--acento)); }
.barra-sub-lista { display: grid; gap: .05rem; padding: .15rem 0 .5rem 2.3rem; }
.barra-tab { display: flex; justify-content: space-between; gap: .4rem; color: var(--suave); text-decoration: none; font-size: .83rem; padding: .36rem .6rem; border-radius: 8px; }
.barra-tab:hover { color: var(--texto); background: rgba(255, 255, 255, .04); }
.barra-tab.activo { color: #fff; background: rgba(57, 135, 229, .18); }
.barra-tab.pronto { color: var(--tenue); cursor: default; }
.barra-tab small { font-size: .66rem; opacity: .8; }
.barra-pie { display: flex; align-items: center; gap: .6rem; padding: .8rem .5rem 0; border-top: 1px solid var(--borde); margin-top: .8rem; }
.barra-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3987e5, #e5352b); flex: none; }
.barra-usuario { color: var(--suave); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.barra-salir { background: transparent; border: 1px solid var(--borde); padding: .35rem; border-radius: 8px; color: var(--suave); display: grid; }
.barra-salir svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.principal { min-width: 0; padding: 0 clamp(16px, 2.2vw, 36px) 2rem; }

/* ---------- Barra superior ---------- */
.superior {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: calc(1rem + env(safe-area-inset-top, 0px)) 0 1rem;
}
.superior .titulo { flex: 1 1 320px; min-width: 0; border: 0; padding: 0; }
.migas { display: flex; gap: .45rem; align-items: center; color: var(--tenue); font-size: .78rem; margin: 0 0 .2rem; }
.migas a { color: #8fb8ee; text-decoration: none; }
.superior h1 { font-size: 1.55rem; font-weight: 750; letter-spacing: -.02em; }
.superior .sub { font-size: .78rem; max-width: 90ch; }
#btn-menu { display: none; background: transparent; border: 1px solid var(--borde-fuerte); padding: .45rem .55rem; }
#btn-menu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Buscador de clientes */
.busqueda { position: relative; flex: 0 1 380px; min-width: 220px; }
.busqueda input {
  width: 100%; padding: .62rem .9rem .62rem 2.4rem; border-radius: 12px; border: 1px solid var(--borde-fuerte);
  background: rgba(5, 12, 26, .7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8ea6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat .8rem center / 17px;
  color: var(--texto); font: inherit; font-size: .88rem;
}
.busqueda input:focus { outline: none; border-color: var(--acento); box-shadow: var(--brillo); }
.busqueda ul { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: .35rem; list-style: none; z-index: 40;
  background: #0d1b36; border: 1px solid var(--borde-fuerte); border-radius: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.5); max-height: 60vh; overflow-y: auto; }
.busqueda li { display: grid; gap: .1rem; padding: .5rem .65rem; border-radius: 8px; cursor: pointer; }
.busqueda li:hover, .busqueda li.sel { background: rgba(57, 135, 229, .18); }
.busqueda li.vacio { color: var(--tenue); cursor: default; }
.r-n { font-weight: 600; font-size: .86rem; }
.r-m { color: var(--tenue); font-size: .74rem; }
.etq-mini { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--texto); }
.etq-mini::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* ---------- Filtros ---------- */
.filtros { background: rgba(9, 19, 40, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--borde); border-radius: 14px; padding: .5rem .6rem; gap: .5rem; }
.grupo { border-color: var(--borde); background: rgba(255, 255, 255, .03); border-radius: 10px; padding: 2px; gap: 2px; }
.grupo button { border-radius: 8px; padding: .38rem .75rem; font-size: .82rem; }
.grupo button:hover { color: var(--texto); filter: none; background: rgba(255,255,255,.05); }
.grupo button.activo { background: linear-gradient(180deg, #4793ef, #2b6fcb); box-shadow: 0 4px 14px rgba(57, 135, 229, .35); }

/* ---------- Indicadores ---------- */
.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.kpi { border-radius: var(--radio); padding: 1.05rem 1.15rem .6rem; transition: transform .15s, box-shadow .15s; }
.kpi::before { height: 2px; background: linear-gradient(90deg, var(--k, var(--acento)), transparent); opacity: 1; }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, var(--k, var(--acento)), transparent 70%); opacity: .14; pointer-events: none; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--brillo); }
.kpi-cab { display: flex; align-items: center; gap: .55rem; }
.kpi-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--k, var(--acento)) 22%, transparent); border: 1px solid color-mix(in srgb, var(--k, var(--acento)) 40%, transparent); }
.kpi-ic svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .v { font-size: 2rem; margin: .45rem 0 .1rem; }

/* ---------- Cajas, gráficos y tablas ---------- */
.caja { border-radius: var(--radio); padding: 1.1rem 1.2rem; }
.caja h2, .cabeza-caja h2 { color: #c9d6ea; letter-spacing: .09em; }
.rejilla { gap: 1rem; margin-bottom: 1rem; }
.pestanas { gap: .35rem; margin: 1.4rem 0 .7rem; padding: .3rem; background: rgba(255,255,255,.03); border: 1px solid var(--borde); border-radius: 12px; width: fit-content; max-width: 100%; }
.pestanas button { border: 0; border-radius: 9px; background: transparent; padding: .45rem .95rem; }
.pestanas button:hover { color: var(--texto); background: rgba(255,255,255,.05); filter: none; }
.tabla-envoltura { border-color: var(--borde); background: rgba(5, 12, 26, .35); }
th { background: #0b1832; text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(57, 135, 229, .08); }
tbody tr:nth-child(even) td { background-color: rgba(255,255,255,.012); }
.ver-ficha { color: #cfe1fb; text-decoration: none; border-bottom: 1px dashed rgba(143, 184, 238, .45); }
.ver-ficha:hover { color: #fff; border-bottom-color: #fff; }
canvas { cursor: default; }
.tenue { color: var(--tenue); }

/* ---------- Comparativa ---------- */
#cmp-controles { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#cmp-custom { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; color: var(--suave); font-size: .8rem; }
#cmp-custom[hidden] { display: none; }
#cmp-custom input { width: 9.5rem; }
.cmp-titular { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; padding: .9rem 1.1rem; margin: .4rem 0 .8rem; border-radius: 14px;
  background: linear-gradient(110deg, rgba(57, 135, 229, .16), rgba(16, 33, 63, .4)); border: 1px solid rgba(57, 135, 229, .25); }
.cmp-titular > div { display: grid; }
.cmp-titular .t { font-size: .72rem; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; }
.cmp-titular .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.cmp-titular .tenue-v { color: #9fb1cb; }
.cmp-titular .vs { color: var(--tenue); font-weight: 700; }
.cmp-var { margin-left: auto; text-align: right; font-size: 1.35rem; font-weight: 800; }
button.cubeta { text-align: left; color: var(--texto); font: inherit; cursor: pointer; }
button.cubeta:hover { filter: none; background: rgba(255,255,255,.05); }
button.cubeta.activa { box-shadow: 0 0 0 2px var(--c) inset; }
#caja-g-cmp { height: 380px; margin: .4rem 0 1rem; }

/* ---------- Ficha del cliente ---------- */
dialog.ficha { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--borde-fuerte); border-radius: 20px;
  background: linear-gradient(180deg, #0f2042, #0a1630); color: var(--texto); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.ficha::backdrop { background: rgba(2, 6, 14, .7); backdrop-filter: blur(4px); }
#ficha-cuerpo { padding: 1.4rem 1.5rem 1.5rem; overflow-y: auto; max-height: calc(100vh - 50px); }
.ficha-cab { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.ficha-cab h2 { font-size: 1.5rem; color: #fff; text-transform: none; letter-spacing: -.01em; margin: .15rem 0 .3rem; }
.ficha-pre { margin: 0; color: var(--suave); font-size: .8rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.cerrar { background: rgba(255,255,255,.06); border: 1px solid var(--borde); color: var(--texto); border-radius: 10px; padding: .4rem .65rem; }
.ficha-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.fk { display: grid; gap: .15rem; padding: .8rem .9rem; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid var(--borde); }
.fk .t { font-size: .7rem; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; }
.fk .v { font-size: 1.35rem; font-weight: 750; }
.fk .v.chico { font-size: 1.02rem; }
.fk .d { font-size: .76rem; color: var(--suave); }
.ficha-graf, .ficha-sec { padding: .9rem 1rem; border-radius: 14px; background: rgba(255,255,255,.025); border: 1px solid var(--borde); margin-bottom: .8rem; }
.ficha-graf h3, .ficha-sec h3 { font-size: .78rem; color: var(--suave); text-transform: uppercase; letter-spacing: .07em; margin: 0 0 .5rem; }
.ficha-graf .grafico { height: 230px; }
.ficha-sec.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ficha-sec p { margin: 0; font-size: .86rem; }
.ficha-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .84rem; }
.ficha-lista li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--borde); padding: .3rem 0; }

/* ---------- Portada ---------- */
.portada .hero { padding: 1.6rem 0 1.2rem; }
.portada .saludo { font-size: clamp(1.8rem, 3.6vw, 2.5rem); }
.area { border-radius: 18px; min-height: 170px; }
.area:hover { box-shadow: var(--brillo); }
.modulo { border-radius: 16px; }

/* ---------- Teléfono ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .barra { position: fixed; inset: 0 auto 0 0; width: min(290px, 85vw); transform: translateX(-102%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  body.menu-abierto .barra { transform: none; }
  #btn-menu { display: inline-grid; }
  .busqueda { flex: 1 1 100%; }
  .ficha-sec.dos { grid-template-columns: 1fr; }
  .cmp-var { margin-left: 0; text-align: left; }
}

.mezcla-fila.clic { cursor: pointer; border-radius: 8px; }
.mezcla-fila.clic:hover { background: rgba(255,255,255,.05); }

/* ===== Diseño 2.1: cada tablero con su color, más profundidad, filtros y orden ===== */
.modulo { --tono: #3987e5; position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--tono) 22%, var(--borde));
  background: linear-gradient(160deg, color-mix(in srgb, var(--tono) 14%, #0e1c38) 0%, #0b162d 55%, #091327 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 14px 30px rgba(0,0,0,.35); }
.modulo::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--tono), color-mix(in srgb, var(--tono) 20%, transparent)); }
.modulo::after { content: ""; position: absolute; right: -60px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, var(--tono), transparent 70%); opacity: .16; pointer-events: none; transition: opacity .2s; }
a.modulo:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tono) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tono) 35%, transparent), 0 22px 44px rgba(0,0,0,.45), 0 0 40px color-mix(in srgb, var(--tono) 22%, transparent); }
a.modulo:hover::after { opacity: .3; }
.modulo .modulo-icono { width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(145deg, var(--tono), color-mix(in srgb, var(--tono) 45%, #0b162d));
  border: 1px solid color-mix(in srgb, var(--tono) 70%, white 10%); box-shadow: 0 8px 22px color-mix(in srgb, var(--tono) 40%, transparent); }
.modulo .modulo-icono svg { stroke: #fff; width: 23px; height: 23px; }
.modulo .flecha { color: var(--tono); font-size: 1.35rem; }
.modulo .modulo-txt strong { font-size: 1.08rem; color: #fff; }
.modulo.destacado { background: linear-gradient(115deg, color-mix(in srgb, var(--tono) 32%, #0e1c38), #0b162d 70%); }
.modulo.pronto, .modulo.sin-acceso { background: rgba(10, 20, 40, .55); border-style: dashed; box-shadow: none; }
.modulo.pronto::before, .modulo.pronto::after, .modulo.sin-acceso::before, .modulo.sin-acceso::after { display: none; }
.modulo.pronto .modulo-icono, .modulo.sin-acceso .modulo-icono { background: rgba(255,255,255,.05); border-color: var(--borde); box-shadow: none; }
.area { background: linear-gradient(160deg, color-mix(in srgb, var(--tono) 16%, #0e1c38), #0a1530 70%); border-color: color-mix(in srgb, var(--tono) 25%, var(--borde)); }
.area::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--tono), transparent); }
.area-icono { background: linear-gradient(145deg, var(--tono), color-mix(in srgb, var(--tono) 40%, #0b162d)); box-shadow: 0 8px 22px color-mix(in srgb, var(--tono) 35%, transparent); }

/* Tabla: más contraste, color del segmento en el borde de cada fila, encabezados ordenables a la vista */
.tabla-envoltura { box-shadow: 0 10px 30px rgba(0,0,0,.3); }
th { padding-top: .7rem; padding-bottom: .7rem; }
th:hover { color: #fff; background: #10224a; }
th.ordenada { color: #fff; background: #12295a; }
.flecha-orden { margin-left: .35rem; opacity: .45; font-size: .7rem; }
th.ordenada .flecha-orden { opacity: 1; color: var(--acento-2); }
td { padding-top: .62rem; padding-bottom: .62rem; }
tbody tr.con-seg td:first-child { box-shadow: inset 3px 0 0 var(--fila); }
tbody tr:nth-child(even) td { background-color: rgba(255,255,255,.025); }
tbody tr:hover td { background: rgba(57, 135, 229, .12); }
td .etq { box-shadow: 0 2px 10px rgba(0,0,0,.25); }

/* Barra de herramientas de la tabla */
.herramientas { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.herramientas #buscar { flex: 1 1 260px; }
#f-orden { min-width: 220px; }
.boton-filtro { display: inline-flex; align-items: center; gap: .4rem; }
.boton-filtro svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.boton-filtro[aria-expanded="true"] { border-color: var(--acento); box-shadow: var(--brillo); }
.insignia { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 99px; background: var(--acento); color: #fff; font-size: .7rem; font-weight: 700; }
.panel-filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem 1.4rem; margin: .7rem 0 .4rem; padding: 1rem 1.1rem;
  border-radius: 14px; background: linear-gradient(160deg, #10224a, #0b1833); border: 1px solid rgba(57,135,229,.35); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.panel-filtros[hidden] { display: none; }
.pf-grupo { display: grid; gap: .45rem; align-content: start; }
.pf-t { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); font-weight: 650; }
.pf-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { --c: #8795a3; display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.04); border: 1px solid var(--borde-fuerte); color: var(--suave);
  border-radius: 99px; padding: .3rem .75rem; font-size: .8rem; font-weight: 550; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip:hover { filter: none; color: #fff; }
.chip.activo { background: color-mix(in srgb, var(--c) 28%, transparent); border-color: var(--c); color: #fff; }
.pf-fila { display: flex; gap: .5rem; flex-wrap: wrap; }
.pf-fila label { display: grid; gap: .2rem; font-size: .74rem; color: var(--tenue); }
.pf-fila input { width: 8.5rem; }
.pf-acciones { display: flex; gap: .5rem; align-items: end; justify-content: flex-end; grid-column: 1 / -1; }

button.chico { padding: .25rem .7rem; font-size: .78rem; margin-left: .3rem; }

/* ===== Países ===== */
.sub-cr { display: inline-flex; gap: 2px; margin-left: .35rem; padding-left: .45rem; border-left: 1px solid var(--borde-fuerte); }
.sub-cr button { font-size: .74rem !important; padding: .3rem .6rem !important; }
.paises-tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; margin: .4rem 0 1rem; }
.pais-tarjeta { --c: #3987e5; display: grid; gap: .35rem; text-align: left; padding: 1rem 1.1rem; border-radius: 14px; color: var(--texto); font: inherit; cursor: pointer;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 20%, #0e1c38), #0b162d 70%); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  box-shadow: 0 12px 28px rgba(0,0,0,.3); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.pais-tarjeta::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.pais-tarjeta:hover { transform: translateY(-3px); filter: none; box-shadow: 0 0 0 1px var(--c), 0 18px 36px rgba(0,0,0,.4); }
.pt-nombre { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; }
.pt-nombre .punto { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.pt-v { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.pt-d { font-size: .8rem; color: var(--suave); }
.pt-barra { height: 6px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin: .2rem 0; }
.pt-barra span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.pt-mini { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; font-size: .76rem; color: var(--suave); }
.pt-mini b { color: var(--texto); }
#tabla-paises .punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .2rem; }

/* Ficha: historial de compras */
.fh-cab { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.fh-cab h3 { margin: 0; }
.fh-tot { text-transform: none; letter-spacing: 0; color: var(--texto); font-weight: 600; margin-left: .5rem; font-size: .82rem; }
.fh-sel { font-size: .8rem; color: var(--suave); display: inline-flex; gap: .4rem; align-items: center; }
.fh-sel select { padding: .25rem .5rem; }
.grafico.chico-alto { height: 160px; }
#fh-tabla-caja summary { cursor: pointer; list-style: none; }
#fh-tabla-caja summary h3 { display: inline; }
#fh-tabla-caja summary::before { content: "▸ "; color: var(--suave); }
#fh-tabla-caja[open] summary::before { content: "▾ "; }
.fh-mapa td, .fh-mapa th { padding: .4rem .5rem; font-size: .76rem; }

/* Filtros por columna + columna de cliente fija al deslizar */
.pf-grupo.ancho { grid-column: 1 / -1; }
.chip small { color: var(--tenue); font-weight: 500; margin-left: .15rem; }
.chip.activo small { color: #dfe7f2; }
.pf-acciones { align-items: center; }
.pf-acciones .nota { margin-right: auto; }
#tabla th:first-child, #tabla td:first-child { position: sticky; left: 0; z-index: 2; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
#tabla td:first-child { background: #0b1730; }
#tabla tbody tr:nth-child(even) td:first-child { background: #0d1b36; }
#tabla tbody tr:hover td:first-child { background: #12264d; }
#tabla th:first-child { z-index: 3; }
#tabla td:first-child::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: var(--borde-fuerte); }
.herramientas { position: sticky; top: 0; z-index: 4; background: linear-gradient(180deg, rgba(12, 26, 53, .97), rgba(12, 26, 53, .9)); padding: .5rem 0; }

/* ===== Lectura de los datos (conclusiones y decisiones) ===== */
.lectura { border-radius: var(--radio); padding: 1.1rem 1.2rem; margin-bottom: 1rem; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(57,135,229,.16), rgba(13,25,50,.75) 45%); border-color: rgba(90,162,255,.30); }
.lectura::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, #5aa2ff, #9085e9); }
.lectura-cab h2 { color: #fff; letter-spacing: .08em; display: flex; align-items: center; gap: .5rem; }
.lectura-cab h2::before { content: "✦"; color: #9fc6ff; }
.lectura-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: .75rem; margin-top: .8rem; }
.lectura-item { display: grid; grid-template-columns: auto 1fr; gap: .75rem; padding: .85rem .95rem; border-radius: 12px; background: rgba(5, 12, 26, .45); border: 1px solid var(--borde); }
.lectura-item h3 { font-size: .92rem; margin: 0 0 .25rem; color: #fff; line-height: 1.35; }
.lectura-item p { margin: 0; font-size: .82rem; color: var(--suave); line-height: 1.45; }
.lectura-item .li-accion { margin-top: .45rem; color: #dfe9f8; padding-top: .45rem; border-top: 1px dashed var(--borde-fuerte); }
.lectura-item .li-accion b { color: #9fc6ff; }
.li-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; }
.lectura-item.bien { border-left: 3px solid #0ca30c; } .lectura-item.bien .li-ic { background: #0ca30c; }
.lectura-item.alerta { border-left: 3px solid #e66767; } .lectura-item.alerta .li-ic { background: #d03b3b; }
.lectura-item.info { border-left: 3px solid #5aa2ff; } .lectura-item.info .li-ic { background: #2b6fcb; }

/* ===== Clientes según última compra ===== */
.recencia { margin-bottom: 1rem; }
.rec-acum { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; margin-bottom: .9rem; }
.rec-acum > div { display: grid; gap: .1rem; padding: .75rem .9rem; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid var(--borde); }
.rec-acum .t { font-size: .7rem; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; }
.rec-acum .v { font-size: 1.5rem; font-weight: 800; }
.rec-acum .d { font-size: .76rem; color: var(--tenue); }
.rec-barras { display: grid; gap: .3rem; }
.rec-fila { display: grid; grid-template-columns: 130px 1fr 70px 150px; gap: .7rem; align-items: center; background: transparent; border: 0; color: var(--texto); font: inherit; padding: .35rem .4rem; border-radius: 8px; text-align: left; }
.rec-fila:hover { background: rgba(255,255,255,.05); filter: none; }
.rec-t { font-size: .82rem; color: var(--suave); }
.rec-b { height: 12px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.rec-b span { display: block; height: 100%; border-radius: 99px; }
.rec-n { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.rec-h { font-size: .76rem; color: var(--tenue); }
.rec-paises { margin-bottom: .9rem; }
.sub-t { font-size: .74rem; color: var(--suave); text-transform: uppercase; letter-spacing: .07em; margin: .6rem .6rem .4rem; }
#rec-paises .punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 720px) { .rec-fila { grid-template-columns: 100px 1fr 50px; } .rec-h { display: none; } .lectura-lista { grid-template-columns: 1fr; } }

.aviso-datos { margin: .3rem 0 .6rem; padding: .6rem .8rem; border-radius: 10px; background: rgba(250,178,25,.12); border: 1px solid rgba(250,178,25,.45); color: #ffe2a6; font-size: .84rem; }

/* Ficha: detalle de compras */
#tabla tr[data-cli] { cursor: pointer; }
.ficha-detalle .ficha-sec { margin-bottom: .8rem; }
.ficha-sec.ultima { border-color: rgba(57,135,229,.4); background: linear-gradient(160deg, rgba(57,135,229,.12), rgba(255,255,255,.02)); }
.mini-tabla { width: 100%; border-collapse: collapse; font-size: .8rem; }
.mini-tabla th { position: static; background: transparent; font-size: .68rem; padding: .35rem .5rem; color: var(--tenue); cursor: default; }
.mini-tabla td { padding: .38rem .5rem; white-space: normal; }
.mini-tabla tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.cod { display: inline-block; font-size: .68rem; padding: .05rem .35rem; border-radius: 5px; background: rgba(255,255,255,.07); color: var(--suave); margin-right: .2rem; }
.barrita { display: inline-block; width: 70px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.07); margin-right: .45rem; vertical-align: middle; overflow: hidden; }
.barrita span { display: block; height: 100%; background: #3987e5; border-radius: 99px; }
