/* =====================================================================
   Panel de Bleu — estilo admin de Shopify con más vida. Reglas en DESIGN.md (siempre seguirlas).
   Claro: menú lateral gris muy claro, contenido blanco con borde fino, Inter, azul Bleu con función.
   Animaciones de 150–250 ms, sin rebote, apagadas con prefers-reduced-motion.
   Sin recursos externos: la CSP solo permite 'self'.
   ===================================================================== */

@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-ext.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --azul: #1b5cff;
  --azul-hover: #134ee6;
  --azul-suave: #eaf0ff;
  --azul-texto: #1546c7;
  --texto: #1a1c21;
  --texto-2: #5c6170;
  --texto-3: #8a8f9c;
  --fondo: #f4f5f7;
  --fondo-2: #eceef2;
  --blanco: #ffffff;
  --borde: #e3e5ea;
  --borde-2: #d3d6dd;
  /* tonos de estado: fondo suave + texto oscuro + punto */
  --verde: #1f8a4c; --verde-suave: #e3f5ea; --verde-punto: #2fb366;
  --amarillo: #8a5a00; --amarillo-suave: #fff3d1; --amarillo-punto: #e9a800;
  --rojo: #b42318; --rojo-suave: #fde8e6; --rojo-punto: #e5483b;
  --violeta: #5b3fd6; --violeta-suave: #efebfe;
  --gris: #4d5260; --gris-suave: #eceef2; --gris-punto: #a3a8b4;
  --radio: 8px;
  --radio-ch: 6px;
  --lateral: 240px;
  --curva: cubic-bezier(.2, 0, 0, 1);
  --rapido: 150ms;
  --medio: 200ms;
  /* compatibilidad con estilos en línea de vistas antiguas (variables del sistema anterior) */
  --hueso: var(--texto); --tinta-2: var(--texto-2); --tinta-3: var(--texto-3); --linea: var(--borde); --linea-2: var(--borde-2);
  --e405: var(--azul); --e436: var(--azul); --e486: var(--azul); --e546: var(--verde-punto); --e589: var(--amarillo-punto); --e615: var(--amarillo-punto); --e656: var(--rojo-punto);
  --riel: 240px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--fondo); color: var(--texto);
  font: 400 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--azul-suave); }
a { color: var(--azul); text-decoration: none; transition: color var(--rapido) var(--curva); }
a:hover { color: var(--azul-hover); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
small { font-size: 13px; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; background: var(--fondo); padding: 1px 5px; border-radius: 4px; }
code.clave { font-size: 15px; user-select: all; letter-spacing: .04em; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ================================================================ armazón: menú lateral + contenido */
.app {
  display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100vh;
  /* el gris del menú llega hasta abajo aunque la página sea más larga que la pantalla */
  background: linear-gradient(90deg, var(--fondo) calc(var(--lateral) - 1px), var(--borde) calc(var(--lateral) - 1px) var(--lateral), transparent var(--lateral));
}
.lateral {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  padding: 16px 12px; background: var(--fondo); border-right: 1px solid var(--borde);
}
.cuenta .quien .avatar { width: 32px; height: 32px; }
.marca-producto { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--texto); }
.marca-producto:hover { color: var(--texto); text-decoration: none; }
.marca-producto b { width: 18px; height: 26px; display: inline-block; background: url('/static/img/bleu-simbolo.svg') no-repeat center / contain; }
.lateral nav { display: grid; gap: 2px; }
.lateral nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radio-ch);
  color: var(--texto-2); font-weight: 500; position: relative;
  transition: background-color var(--rapido) var(--curva), color var(--rapido) var(--curva);
}
.lateral nav a:hover { background: var(--fondo-2); color: var(--texto); text-decoration: none; }
.lateral nav a.activo { background: var(--azul-suave); color: var(--azul-texto); font-weight: 600; }
.lateral nav a.activo svg.i { color: var(--azul); }
.contador { margin-left: auto; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 999px; background: var(--amarillo-suave); color: var(--amarillo); white-space: nowrap; }
.cuenta { margin-top: auto; border-top: 1px solid var(--borde); padding: 14px 2px 0; display: grid; gap: 2px; }
.cuenta .quien { display: flex; align-items: center; gap: 10px; padding: 0 8px 10px; min-width: 0; }
.cuenta .quien > div > span { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuenta .quien small { color: var(--texto-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuenta .quien > div { min-width: 0; }
.cuenta a, .cuenta button.enlace {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; height: 34px; padding: 0 10px; color: var(--texto-2);
  border-radius: var(--radio-ch); width: 100%; font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background-color var(--rapido) var(--curva), color var(--rapido) var(--curva);
}
.cuenta a:hover, .cuenta button.enlace:hover { color: var(--texto); background: var(--fondo-2); text-decoration: none; }
.cuenta form { margin: 0; }
.barra-movil { display: none; }

.contenido { min-width: 0; padding: 0 32px 64px; max-width: 1280px; width: 100%; animation: entrar var(--medio) var(--curva) both; }
main.centrado { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
@keyframes entrar { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* cabecera con la marca del cliente: su logo (o inicial) y su color */
.cabecera-marca {
  --marca: var(--azul);
  display: flex; align-items: center; gap: 12px; margin: 0 -32px; padding: 12px 32px;
  background: var(--blanco); border-bottom: 1px solid var(--borde); position: relative;
}
.cabecera-marca::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--marca); }
.cabecera-marca .logo-marca { width: 36px; height: 36px; border-radius: var(--radio-ch); object-fit: cover; flex: none; border: 1px solid var(--borde); }
.cabecera-marca .logo-marca.inicial { display: grid; place-items: center; background: var(--marca); color: #fff; font-weight: 700; font-size: 16px; border: 0; }
.cabecera-marca b { font-size: 15px; font-weight: 650; display: block; line-height: 1.2; }
.cabecera-marca small { color: var(--texto-2); }
.cabecera-marca .der { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* encabezado de página */
.cabecera-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px 0 20px; }
.cabecera-pagina > .izq { min-width: 0; }
.cabecera-pagina > .der { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cabecera-pagina h1 { margin: 0; }
.cabecera-pagina .meta { color: var(--texto-2); font-size: 13px; }
.migas { margin: 0 0 4px; font-size: 13px; color: var(--texto-3); }
.migas a { color: var(--texto-2); }

/* ================================================================ secciones blancas (riel, tarjeta, seccion) */
.seccion, .riel, .tarjeta {
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: 20px;
}
.seccion, .tarjeta { padding: 20px; }
.riel { overflow: hidden; }
.tarjeta.estrecha { width: 100%; max-width: 420px; }
.tarjeta.media { max-width: 720px; }
.tarjeta.destacada { border-color: var(--amarillo-punto); background: #fffdf5; }
.tarjeta > h2:first-child, .tarjeta > .encabezado:first-child { margin-top: 0; }
.seccion-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seccion-cab h2 { margin: 0; }

.riel-titulo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--borde); }
.riel-titulo > .izq { font-size: 15px; font-weight: 600; color: var(--texto); }
.riel-titulo > .der { color: var(--texto-2); font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.riel-titulo > .der .acciones { margin-left: auto; }
.riel-fila { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; min-height: 52px; position: relative; transition: background-color var(--rapido) var(--curva); }
.riel-fila + .riel-fila { border-top: 1px solid var(--borde); }
.riel-titulo + .riel-fila { border-top: 0; }
.riel-fila > .izq { padding: 12px 16px 12px 20px; color: var(--texto-2); min-width: 0; }
.riel-fila > .der { padding: 12px 20px 12px 0; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; min-width: 0; position: relative; }
.riel-fila > .izq strong { color: var(--texto) !important; }
.riel > .tabla-envoltura, .riel > table { border-top: 0; }
.cifra-grande { font-size: 18px; font-weight: 650; letter-spacing: -.01em; color: var(--texto); }
.sub { color: var(--texto-2); }

/* marcas de estado del sistema anterior (.m): ahora un punto de color a la izquierda del valor */
.m { --c: var(--gris-punto); }
.riel-fila > .der.m { padding-left: 16px; }
.riel-fila > .der.m::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--c); }
td.m { position: relative; }
.c-violeta, .c-indigo, .c-cian { --c: transparent; }   /* sin estado: sin punto */
.riel-fila > .der.m.c-violeta, .riel-fila > .der.m.c-indigo, .riel-fila > .der.m.c-cian { padding-left: 0; }
.c-verde { --c: var(--verde-punto); }
.c-sodio, .c-naranja, .m.doble, .m.discontinua { --c: var(--amarillo-punto); }
.c-rojo, .m.tachada { --c: var(--rojo-punto); }

/* ================================================================ etiquetas de estado */
.estado {
  --f: var(--gris-suave); --t: var(--gris); --p: var(--gris-punto);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 999px;
  background: var(--f); color: var(--t); font-size: 12.5px; font-weight: 550; white-space: nowrap; line-height: 1;
}
.estado::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--p); flex: none; }
.t-verde, .estado-activo, .estado-activa, .cobro-pagado, .reporte-resuelto, .mov-recarga { --f: var(--verde-suave); --t: var(--verde); --p: var(--verde-punto); }
.t-amarillo, .estado-suspendido, .cobro-pendiente, .reporte-en_revision, .mov-ajuste, .reporte-media { --f: var(--amarillo-suave); --t: var(--amarillo); --p: var(--amarillo-punto); }
.t-rojo, .estado-pausado, .cobro-vencido, .reporte-alta, .estado.tachado { --f: var(--rojo-suave); --t: var(--rojo); --p: var(--rojo-punto); }
.t-azul, .reporte-nuevo { --f: var(--azul-suave); --t: var(--azul-texto); --p: var(--azul); }
.t-gris, .estado-inactivo, .estado-terminada, .cobro-anulado, .reporte-baja { --f: var(--gris-suave); --t: var(--gris); --p: var(--gris-punto); }
.cobro-anulado { text-decoration: line-through; }
.estado-suspendido { --f: var(--rojo-suave); --t: var(--rojo); --p: var(--rojo-punto); }
/* vistas que fijan el tono con style="--c: …" */
.estado[style*="--c"] { --p: var(--c); }
.mov { font-size: 13px; font-weight: 550; }
.mov-consumo { color: var(--texto-2); font-weight: 400; background: none; padding: 0; height: auto; }
.mov-consumo::before { display: none; }

/* ================================================================ tarjetas de resumen */
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.resumen-item {
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 14px; align-items: start; color: var(--texto);
  transition: border-color var(--rapido) var(--curva), background-color var(--rapido) var(--curva);
}
a.resumen-item:hover { border-color: var(--borde-2); text-decoration: none; color: var(--texto); background: #fcfcfd; }
.resumen-icono { grid-row: span 3; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--azul-suave); color: var(--azul); }
.resumen-icono svg.i { width: 20px; height: 20px; }
.resumen-item.verde .resumen-icono { background: var(--verde-suave); color: var(--verde); }
.resumen-item.amarillo .resumen-icono { background: var(--amarillo-suave); color: var(--amarillo); }
.resumen-item.violeta .resumen-icono { background: var(--violeta-suave); color: var(--violeta); }
.resumen-item.rojo .resumen-icono { background: var(--rojo-suave); color: var(--rojo); }
.resumen-item .etiqueta { font-size: 13px; color: var(--texto-2); font-weight: 500; }
.resumen-item .valor { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.resumen-item .valor.negativo { color: var(--rojo); }
.resumen-item .nota { font-size: 12.5px; color: var(--texto-3); }

/* cifras en bloque (vistas que aún no usan el resumen con íconos) */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cifra { padding: 14px 16px; display: grid; gap: 2px; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); }
.cifra span { font-size: 13px; color: var(--texto-2); }
.cifra strong { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.cifra small { color: var(--texto-3); }
.cifras.compactas .cifra strong { font-size: 17px; }

/* gráficos pequeños: barras de saldo (peine) y de actividad (emisión) */
.peine { display: flex; align-items: center; gap: 10px; min-width: 0; }
.peine .pista { position: relative; width: 160px; height: 8px; flex: none; border-radius: 999px; background: var(--fondo-2); overflow: hidden; }
.peine .pista::after { content: ""; position: absolute; left: calc(7 / 45 * 100%); top: 0; bottom: 0; width: 2px; background: var(--blanco); }
.peine .dientes { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--azul); transition: width .6s var(--curva); }
.peine.bajo .dientes { background: var(--amarillo-punto); }
.peine.cero .pista { background: var(--rojo-suave); }
.peine b { font-weight: 550; min-width: 56px; }
.emision { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.emision i { display: block; width: 8px; border-radius: 2px 2px 0 0; background: var(--azul-suave); min-height: 2px; transform-origin: bottom; animation: barra .5s var(--curva) both; }
.emision i:last-child { background: var(--azul); }
.emision i:nth-child(2n) { animation-delay: 20ms; } .emision i:nth-child(3n) { animation-delay: 40ms; }
@keyframes barra { from { transform: scaleY(0); } to { transform: none; } }
.grafico-emision { min-width: 150px; }
.emision-eje { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--texto-3); margin-top: 4px; white-space: nowrap; }

/* ================================================================ bienvenida y vacíos */
.bienvenida {
  display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: center;
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 24px 28px; margin-bottom: 20px; overflow: hidden;
}
.bienvenida h2 { font-size: 18px; margin: 0 0 6px; }
.bienvenida p { color: var(--texto-2); margin: 0 0 14px; max-width: 60ch; }
.bienvenida .paso-de { font-size: 12.5px; font-weight: 600; color: var(--azul-texto); margin-bottom: 6px; display: block; }
.bienvenida .avance { display: flex; gap: 4px; margin: 0 0 14px; }
.bienvenida .avance i { width: 28px; height: 4px; border-radius: 999px; background: var(--fondo-2); }
.bienvenida .avance i.hecho { background: var(--azul); }
.bienvenida svg.ilustracion { width: 200px; height: 140px; justify-self: end; }
.vacio { color: var(--texto-2); padding: 36px 16px; text-align: center; display: grid; justify-items: center; gap: 6px; }
p.vacio, td.vacio, li.vacio { display: block; margin: 0; }
p.vacio::before, li.vacio::before {
  content: ""; display: block; width: 120px; height: 84px; margin: 0 auto 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 100' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='70' cy='88' rx='52' ry='6' fill='%23f4f5f7'/%3E%3Crect x='34' y='22' width='72' height='56' rx='8' fill='%23fff' stroke='%239aa7c7' stroke-width='2'/%3E%3Cpath d='M46 40h48M46 52h30' stroke='%231b5cff' stroke-width='2'/%3E%3Ccircle cx='98' cy='72' r='10' fill='%23eaf0ff' stroke='%231b5cff' stroke-width='2'/%3E%3Cpath d='M98 67v10M93 72h10' stroke='%231b5cff' stroke-width='2'/%3E%3C/svg%3E") no-repeat center / contain;
}
.vacio svg.ilustracion { width: 140px; height: 100px; margin-bottom: 8px; }
.vacio b { color: var(--texto); font-size: 15px; font-weight: 600; }
.vacio p { margin: 0 0 8px; max-width: 46ch; }
svg.ilustracion { fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.ilustracion .l { stroke: #9aa7c7; stroke-width: 2; }
svg.ilustracion .a { stroke: var(--azul); stroke-width: 2; }
svg.ilustracion .fa { fill: var(--azul-suave); }
svg.ilustracion .fg { fill: var(--fondo); }
svg.ilustracion .fb { fill: var(--blanco); }

/* avatar con inicial */
.avatar {
  --av: var(--azul-suave); --avt: var(--azul-texto);
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--av); color: var(--avt); font-weight: 650; font-size: 12.5px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.av1 { --av: var(--verde-suave); --avt: var(--verde); }
.avatar.av2 { --av: var(--amarillo-suave); --avt: var(--amarillo); }
.avatar.av3 { --av: var(--violeta-suave); --avt: var(--violeta); }
.avatar.av4 { --av: var(--rojo-suave); --avt: var(--rojo); }
.con-avatar { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

/* esqueletos */
.esqueleto, .esqueleto-img {
  background: linear-gradient(90deg, var(--fondo-2) 0%, #f6f7f9 40%, var(--fondo-2) 80%) 0 0 / 300% 100%;
  animation: brillo 1.2s linear infinite; border-radius: var(--radio-ch);
}
@keyframes brillo { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.esqueleto-pantalla { display: grid; gap: 16px; padding-top: 24px; }
.esqueleto-pantalla .e-titulo { width: 220px; height: 26px; }
.esqueleto-pantalla .e-tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.esqueleto-pantalla .e-tarjetas i { height: 92px; border-radius: var(--radio); }
.esqueleto-pantalla .e-bloque { height: 260px; border-radius: var(--radio); }

/* avisos flotantes que entran desde arriba */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radio);
  background: var(--texto); color: #fff; font-weight: 500; box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
  animation: toast-entra 220ms var(--curva) both;
}
.toast svg.i { color: #6ee7a0; }
.toast.error svg.i { color: #ff9b91; }
.toast button { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); height: auto; padding: 0 2px; box-shadow: none; font-weight: 400; }
.toast button:hover { color: #fff; background: none; }
.toast.sale { animation: toast-sale 180ms var(--curva) both; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes toast-sale { to { opacity: 0; transform: translateY(-12px); } }

/* ================================================================ formularios */
.formulario { display: grid; gap: 16px; }
.formulario label { display: grid; gap: 6px; font-weight: 550; color: var(--texto); }
.formulario label small, label small { font-weight: 400; color: var(--texto-2); }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
fieldset { border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px 16px; margin: 0; display: grid; gap: 12px; background: var(--blanco); }
legend { font-weight: 600; padding: 0 6px; }
legend small { font-weight: 400; color: var(--texto-2); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--texto); width: 100%;
  background: var(--blanco); border: 1px solid var(--borde-2); border-radius: var(--radio-ch); padding: 8px 11px; min-height: 38px;
  transition: border-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva);
}
@media (min-width: 821px) { input, select, textarea { font-size: 14px; } }
input::placeholder, textarea::placeholder { color: var(--texto-3); }
input:hover, select:hover, textarea:hover { border-color: #b9bdc7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(27, 92, 255, .15); }
input[readonly] { color: var(--texto-2); background: var(--fondo); }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button { font: inherit; font-size: 14px; font-weight: 550; color: var(--texto); background: var(--blanco); border: 1px solid var(--borde-2); border-radius: 5px; padding: 5px 10px; margin-right: 10px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--azul); margin: 0; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--texto-2) 50%), linear-gradient(135deg, var(--texto-2) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.checks > span { width: 100%; font-weight: 550; }
.opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.opcion { border: 1px solid var(--borde-2); border-radius: var(--radio); padding: 10px 12px; cursor: pointer; display: grid !important; gap: 2px !important; position: relative; transition: border-color var(--rapido) var(--curva), background-color var(--rapido) var(--curva); }
.opcion:hover { border-color: #b9bdc7; }
.opcion:has(input:checked) { border-color: var(--azul); background: var(--azul-suave); }
.opcion small { color: var(--texto-2); }
.calculo { font-weight: 600; margin: 0; }
.subformulario { border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; align-content: start; background: var(--fondo); }
.subformulario h3 { margin-top: 0; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filtros input { flex: 1 1 240px; width: auto; }
.filtros select { width: auto; }
.filtros.sin-margen { margin: 0; }
.fila-precio { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 380px; }
.foto-producto { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.foto-producto img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radio); border: 1px solid var(--borde); }
.foto-producto label { flex: 1 1 240px; }
.instrucciones { white-space: pre-wrap; font-size: 15px; max-width: 65ch; }

/* ================================================================ botones */
button, .boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  font: inherit; font-weight: 600; font-size: 14px; border-radius: var(--radio-ch); cursor: pointer; white-space: nowrap; text-decoration: none;
  background: var(--azul); color: #fff; border: 1px solid var(--azul);
  transition: background-color var(--rapido) var(--curva), border-color var(--rapido) var(--curva), color var(--rapido) var(--curva), transform 100ms var(--curva);
  touch-action: manipulation;
}
button:hover, .boton:hover { background: var(--azul-hover); border-color: var(--azul-hover); color: #fff; text-decoration: none; }
button:active, .boton:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.secundario, .boton.secundario { background: var(--blanco); color: var(--texto); border-color: var(--borde-2); font-weight: 550; }
button.secundario:hover, .boton.secundario:hover { background: var(--fondo); border-color: #b9bdc7; color: var(--texto); }
button.peligro { background: var(--blanco); color: var(--rojo); border-color: #f3b8b2; font-weight: 550; }
button.peligro:hover { background: var(--rojo-suave); border-color: var(--rojo-punto); color: var(--rojo); }
button.enlace { background: none; border: 0; padding: 0; height: auto; color: var(--azul); font-weight: 500; }
button.enlace:hover { background: none; color: var(--azul-hover); text-decoration: underline; text-underline-offset: 3px; }
button.enlace.peligro { color: var(--rojo); }
.acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acciones form { margin: 0; }
.acciones-fila { display: flex; gap: 12px; align-items: center; justify-content: flex-start; }
.acciones-fila form { margin: 0; }
.zona-peligro { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--borde); }

/* ================================================================ tablas */
.tabla-envoltura { overflow-x: auto; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: 20px; }
.riel .tabla-envoltura, .tarjeta .tabla-envoltura, .seccion .tabla-envoltura { border: 0; border-radius: 0; margin-bottom: 0; }
.tarjeta .tabla-envoltura, .seccion .tabla-envoltura { margin: 0 -20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 550; font-size: 13px; color: var(--texto-2); padding: 10px 16px; background: #fafbfc; border-bottom: 1px solid var(--borde); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--borde); vertical-align: middle; text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--rapido) var(--curva); }
tbody tr:hover { background: #f8f9fb; }
td small { color: var(--texto-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.positivo { color: var(--verde); }
.negativo { color: var(--rojo); }
.alerta-texto { color: var(--amarillo); }
tr.inactivo td { color: var(--texto-3); }
.miniatura { width: 56px; }
.miniatura img, .sin-foto { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; display: block; background: var(--fondo-2); border: 1px solid var(--borde); }
.sin-foto { background: var(--fondo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a8b4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Ccircle cx='9.5' cy='10' r='1.5'/%3E%3Cpath d='m20 16-4.5-4.5L7 19'/%3E%3C/svg%3E") no-repeat center / 20px; }
/* celdas de acciones: siguen siendo celdas de tabla (el flex rompía los bordes) */
td.acciones-fila { display: table-cell; white-space: nowrap; }
td.acciones-fila > * + * { margin-left: 12px; }
td.acciones-fila form { display: inline; }

/* datos clave/valor */
.datos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.datos dt { color: var(--texto-2); }
.datos dd { margin: 0; overflow-wrap: anywhere; }

/* ================================================================ mensajes */
.aviso, .error { padding: 12px 14px 12px 16px; border-radius: var(--radio); margin: 0 0 16px; border: 1px solid; }
.aviso { background: var(--verde-suave); border-color: #bfe6cf; color: var(--verde); }
.error { background: var(--rojo-suave); border-color: #f6c6c0; color: var(--rojo); }
.error a { color: var(--rojo); text-decoration: underline; }
.error ul { margin: 6px 0 0; padding-left: 20px; }
.tenue { color: var(--texto-3); }
.desc { color: var(--texto-2); }

/* avisos del cliente */
.notificaciones { list-style: none; padding: 0; margin: 0 0 8px; display: grid; }
.notificaciones li { position: relative; padding: 12px 0 12px 18px; border-bottom: 1px solid var(--borde); }
.notificaciones li::before { content: ""; position: absolute; left: 0; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: var(--verde-punto); }
.notificaciones li.saldo_bajo::before { background: var(--amarillo-punto); }
.notificaciones li.saldo_agotado::before { background: var(--rojo-punto); }
.notificaciones li.reporte::before { background: var(--azul); }
.notificaciones small { color: var(--texto-2); display: block; }
form.sin-margen { margin: 0; }

.paginacion { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 16px 0; flex-wrap: wrap; }

/* desplegables (abren con transición suave) */
details.desplegable > summary { cursor: pointer; color: var(--azul); font-weight: 550; list-style: none; }
details.desplegable > summary::-webkit-details-marker { display: none; }
details.desplegable > summary:hover { color: var(--azul-hover); }
details.desplegable[open] > summary { margin-bottom: 12px; }
details[open] > :not(summary) { animation: abrir var(--medio) var(--curva) both; }
@keyframes abrir { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
details.desplegable.bloque { margin-top: 16px; border-top: 1px solid var(--borde); padding-top: 16px; }
.acciones-fila details[open] { position: relative; }
.acciones-fila details[open] form { position: absolute; right: 0; z-index: 5; min-width: 260px; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }

/* galerías de fotos y videos */
.galeria { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.galeria li { display: grid; gap: 6px; }
.galeria img, .galeria video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--fondo-2); }
.galeria span { font-weight: 550; overflow-wrap: anywhere; }
.galeria form { margin: 0; }
.galeria .renombrar { display: flex; gap: 8px; align-items: center; }
.galeria .renombrar input { padding: 5px 8px; font-size: 14px; min-height: 32px; }

/* conversaciones (bandeja) */
.conversaciones { list-style: none; margin: 0; padding: 0; }
.conversaciones li + li { border-top: 1px solid var(--borde); }
.conversaciones a { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; color: var(--texto); transition: background-color var(--rapido) var(--curva); }
.conversaciones a:hover { background: #f8f9fb; text-decoration: none; }
.conversaciones .avatar { grid-row: span 2; width: 36px; height: 36px; }
.conversaciones .contacto { font-weight: 600; }
.conversaciones .cuando { font-size: 12.5px; text-align: right; color: var(--texto-3); }
.conversaciones .vista-previa { grid-column: 2 / -1; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversaciones .meta { grid-column: 2 / -1; font-size: 12.5px; color: var(--texto-3); }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--fondo); border: 1px solid var(--borde); border-radius: var(--radio); }
.burbuja { max-width: min(560px, 85%); padding: 9px 12px; border-radius: 12px 12px 12px 4px; background: var(--blanco); border: 1px solid var(--borde); align-self: flex-start; }
.burbuja.bot, .burbuja.humano { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--azul-suave); border-color: #d5e0ff; }
.burbuja p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja small { color: var(--texto-3); font-size: 11.5px; }

/* accesos rápidos */
.atajos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
.atajos a { display: grid; gap: 2px; padding: 14px 16px; color: var(--texto); background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); transition: border-color var(--rapido) var(--curva); }
.atajos a:hover { border-color: var(--borde-2); text-decoration: none; }
.atajos span { color: var(--texto-2); font-size: 13px; }

/* listas en tarjetas, textos largos, respuestas */
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.rejilla > .tarjeta { margin-bottom: 0; }
.encabezado { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.encabezado h1, .encabezado h2 { margin: 0; }
.lista-tarjetas { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lista-tarjetas .tarjeta { margin: 0; }
.texto-largo { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 75ch; }
.respuesta { margin-top: 12px; padding: 12px 14px; background: var(--fondo); border-radius: var(--radio); border: 1px solid var(--borde); }
.respuesta strong { display: block; font-size: 13px; color: var(--texto-2); margin-bottom: 4px; }
.notas { white-space: pre-wrap; background: var(--fondo); padding: 12px; border-radius: var(--radio); color: var(--texto-2); }
.captura { max-width: 100%; border-radius: var(--radio); border: 1px solid var(--borde); }

/* ================================================================ publicidad */
.segmento { display: inline-flex; border: 1px solid var(--borde-2); border-radius: var(--radio-ch); overflow: hidden; background: var(--blanco); }
.segmento a { padding: 6px 12px; font-size: 13.5px; color: var(--texto-2); font-weight: 500; white-space: nowrap; transition: background-color var(--rapido) var(--curva); }
.segmento a + a { border-left: 1px solid var(--borde-2); }
.segmento a:hover { color: var(--texto); background: var(--fondo); text-decoration: none; }
.segmento a[aria-current="true"] { color: var(--azul-texto); background: var(--azul-suave); font-weight: 600; }
.cpv { font-variant-numeric: tabular-nums; }
.veredicto { color: var(--texto-2); }
.reglas-semaforo { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--texto-2); }
.pasos { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--texto-2); max-width: 70ch; }
.pasos b { color: var(--texto); font-weight: 600; }
.origen-anuncio { margin-top: -8px; }
.formulario.en-linea { grid-template-columns: minmax(0, 220px) auto; align-items: end; }
td.anuncio { max-width: 340px; }
td.anuncio a, td.anuncio strong { overflow-wrap: anywhere; }

/* ================================================================ diseños, asistente, dictado */
.cola { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.cola li { display: grid; grid-template-columns: 56px minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.cola img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--borde); }
.cola small { font-size: 13px; }
.asistente { border: 1px solid #d5e0ff; border-radius: var(--radio); padding: 16px 18px; display: grid; gap: 12px; background: #f7f9ff; }
.asistente h2 { margin: 0; font-size: 16px; }
.asistente p { margin: 0; }
.asistente-chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.asistente-chat:empty { display: none; }
.asistente-chat li { padding: 10px 12px; border-radius: var(--radio); max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; animation: entrar var(--medio) var(--curva) both; }
.asistente-chat li.tu { justify-self: end; background: var(--azul); color: #fff; }
.asistente-chat li.asistente { justify-self: start; background: var(--blanco); border: 1px solid var(--borde); }
.asistente-chat li ul { margin: 8px 0 0; padding-left: 18px; color: var(--amarillo); }
.asistente-chat li.aviso-alcance { border-color: var(--amarillo-punto); background: #fffdf5; }
.asistente-chat li.aviso-alcance a { font-weight: 600; }
.asistente-acciones { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cambiado { animation: cambiado 1.6s var(--curva); border-color: var(--azul) !important; }
@keyframes cambiado { 0% { box-shadow: 0 0 0 3px rgba(27, 92, 255, .35); } 100% { box-shadow: 0 0 0 3px rgba(27, 92, 255, 0); } }
.dictar { display: inline-flex; align-items: center; gap: 8px; }
.dictar.grabando { border-color: var(--rojo-punto); color: var(--rojo); background: var(--rojo-suave); }
.dictar.grabando .i { animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .35; } }
.marcas-catalogo { margin: 0 0 16px; flex-wrap: wrap; }
.marca-admin { margin-bottom: 12px; }
.marca-datos { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pedido-cambios { display: grid; gap: 12px; padding-left: 20px; }
.pedido-cambios blockquote { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--azul); background: var(--fondo); border-radius: 0 var(--radio) var(--radio) 0; }
.dictado-campo { display: grid; gap: 8px; }
.dictado-campo > label { font-weight: 550; }
.captura-campo { display: grid; gap: 6px; }
.captura-previa { max-width: 100%; max-height: 320px; width: auto; border-radius: var(--radio); border: 1px solid var(--borde); justify-self: start; }

/* modo soporte */
.franja-soporte { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 -32px; padding: 10px 32px; background: var(--amarillo-suave); border-bottom: 1px solid #f3dc9a; color: var(--amarillo); font-size: 14px; }
.franja-soporte a { color: var(--amarillo); font-weight: 650; text-decoration: underline; }

/* admin: bots del cliente arriba de su ficha */
.bots-cliente { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.bot-ficha { display: grid; gap: 6px; padding: 16px; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); color: inherit; transition: border-color var(--rapido) var(--curva), background-color var(--rapido) var(--curva); }
.bot-ficha:hover { border-color: var(--borde-2); background: #fcfcfd; text-decoration: none; color: inherit; }
.bot-ficha-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bot-ficha-cab b { font-size: 15px; }

/* ================================================================ celular y pantallas angostas */
@media (max-width: 1100px) {
  .riel-fila { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; background: none; }
  /* tablas: scroll horizontal dentro de su sección en vez de apretar las columnas */
  .tabla-envoltura table { min-width: 620px; }
  .tabla-envoltura td:first-child, .tabla-envoltura th:first-child { position: sticky; left: 0; background: var(--blanco); z-index: 1; }
  .tabla-envoltura th:first-child { background: #fafbfc; }
  .barra-movil {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 12px;
    background: var(--blanco); border-bottom: 1px solid var(--borde);
  }
  .barra-movil .marca-producto { padding: 0; font-size: 16px; }
  .barra-movil .marca-producto b { width: 16px; height: 22px; }
  .barra-movil button { background: none; border: 0; color: var(--texto); width: 40px; height: 40px; padding: 0; }
  .barra-movil button:hover { background: var(--fondo); }
  .lateral {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-100%); transition: transform var(--medio) var(--curva); box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0);
  }
  body.menu-abierto .lateral { transform: none; box-shadow: 0 0 0 100vmax rgba(16, 24, 40, .35); }
  .lateral nav a { height: 42px; }
  .contenido { padding: 0 16px 48px; }
  .cabecera-pagina { padding: 18px 0 16px; align-items: flex-start; }
  .cabecera-pagina > .izq { width: 100%; }
  .cabecera-marca, .franja-soporte { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .riel-fila { grid-template-columns: 1fr; }
  .riel-fila > .izq { padding: 12px 16px 0; font-size: 13px; }
  .riel-fila > .der { padding: 6px 16px 12px; }
  .riel-fila > .der.m { padding-left: 32px; }
  .riel-fila > .der.m::before { left: 16px; }
  .riel-titulo { padding: 12px 16px; }
  .seccion, .tarjeta { padding: 16px; }
  .tarjeta .tabla-envoltura, .seccion .tabla-envoltura { margin: 0 -16px; }
  .bienvenida { grid-template-columns: 1fr; padding: 20px; }
  .bienvenida svg.ilustracion { display: none; }
  .resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .resumen-item { grid-template-columns: 1fr; padding: 14px; }
  .resumen-icono { grid-row: auto; width: 34px; height: 34px; margin-bottom: 6px; }
  .resumen-item .valor { font-size: 20px; }
  .peine .pista { width: 110px; }
  .grafico-emision { min-width: 0; }
  .riel-fila > .der > span[style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; }
  .cola li { grid-template-columns: 48px minmax(0, 1fr); }
  .cola li small { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* selector de color: muestra chica, no a todo el ancho */
input[type="color"] { width: 72px; height: 38px; padding: 3px; cursor: pointer; }

/* Cómo vende este bot */
.vende-lista { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.vende-lista li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.vende-lista li:last-child { border-bottom: 0; }
.precios-nuevos { border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 14px; }
.precios-nuevos h3 { margin: 0 0 6px; font-size: 15px; }
.precios-nuevos ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
textarea[data-texto] { font-size: 15px; line-height: 1.55; }
