/* NOMINEX · sistema de diseño. Paleta ENLAVO definida una sola vez como variables (tokens) para que el ERP y las demás apps la compartan.
   Azul IA y Tecnología #0284C7 · Verde Innovación #84CC16 · Azul Marino Profundo #0F172A · Blanco Nieve #FFFFFF.
   Reglas: texto marino sobre blanco; sobre verde el texto va en marino, nunca en blanco; texto pequeño sobre azul usa el azul oscuro. */
:root {
  --azul: #0284C7; --azul-osc: #075985; --azul-claro: #E0F2FE;
  --verde: #84CC16; --verde-osc: #3F6212; --verde-claro: #F7FEE7;
  --marino: #0F172A; --blanco: #FFFFFF;
  --pri: var(--azul); --sec: var(--verde); --menu: var(--marino); --acento: var(--verde);
  --rojo: #DC2626; --rojo-claro: #FEE2E2; --ambar: #B45309; --ambar-claro: #FEF3C7;
  --gris-50: #F8FAFC; --gris-100: #F1F5F9; --gris-200: #E2E8F0; --gris-300: #CBD5E1; --gris-500: #64748B; --gris-700: #334155;
  --radio: 14px; --sombra: 0 6px 24px rgba(15, 23, 42, .08); --alto-barra: 60px; --ancho-menu: 264px;
  --zoom: 1;
}
* { box-sizing: border-box; }
html { font-size: calc(15px * var(--zoom)); }
body { margin: 0; font-family: Inter, 'Segoe UI', system-ui, sans-serif; color: var(--marino); background: var(--gris-50); line-height: 1.5; overflow-x: hidden; }
h1, h2, h3 { font-family: Montserrat, Inter, sans-serif; line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
a { color: var(--azul-osc); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }

/* ---------- botones y campos (44 px: regla ENLAVO) ---------- */
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--pri); color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.claro { background: var(--gris-100); color: var(--marino); border: 1px solid var(--gris-200); }
.btn.verde { background: var(--verde); color: var(--marino); }
.btn.peligro { background: var(--rojo); }
.btn.mini { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn-icono { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; position: relative; flex: 0 0 auto; }
.btn-icono:hover { background: rgba(255, 255, 255, .1); }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.campo label { font-weight: 600; font-size: .86rem; color: var(--gris-700); }
.campo .ayuda { font-size: .78rem; color: var(--gris-500); }
.campo input, .campo select, .campo textarea { min-height: 44px; padding: 8px 12px; border: 1px solid var(--gris-300); border-radius: 10px; background: #fff; width: 100%; }
.campo textarea { min-height: 90px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px var(--azul-claro); }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--azul); }

/* ---------- etiquetas ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--gris-100); color: var(--gris-700); white-space: nowrap; }
.chip.ok { background: var(--verde-claro); color: var(--verde-osc); border: 1px solid #D9F99D; }
.chip.azul { background: var(--azul-claro); color: var(--azul-osc); }
.chip.ambar { background: var(--ambar-claro); color: var(--ambar); }
.chip.rojo { background: var(--rojo-claro); color: var(--rojo); }
.chip.pruebas { background: #FDE68A; color: #78350F; }

/* ---------- arranque ---------- */
.nm-splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--marino); color: #fff; }
.nm-splash img { width: 180px; border-radius: 22px; }
.nm-splash .barra { width: 180px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.nm-splash .barra i { display: block; height: 100%; width: 40%; background: var(--verde); animation: nm-carga 1.2s infinite ease-in-out; }
@keyframes nm-carga { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .nm-splash .barra i { animation: none; width: 100%; } }

/* ---------- ingreso ---------- */
.ingreso { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.ingreso-marca { background: var(--marino); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px; text-align: center; }
.ingreso-marca img.logo { width: min(340px, 80%); border-radius: 24px; }
.ingreso-marca p { color: #CBD5E1; max-width: 420px; }
.ingreso-forma { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.tarjeta-ingreso { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; box-shadow: var(--sombra); padding: 28px 24px; border-top: 6px solid var(--verde); }
.tarjeta-ingreso .empresa-logo { max-height: 56px; margin-bottom: 8px; }
.enlace { background: none; border: 0; color: var(--azul-osc); font-weight: 600; cursor: pointer; padding: 10px 0; min-height: 44px; text-decoration: underline; }
.aviso { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: .9rem; }
.aviso.info { background: var(--azul-claro); color: var(--azul-osc); }
.aviso.ok { background: var(--verde-claro); color: var(--verde-osc); border: 1px solid #D9F99D; }
.aviso.mal { background: var(--rojo-claro); color: var(--rojo); }
.aviso.ambar { background: var(--ambar-claro); color: var(--ambar); }
.pin-grande { font-family: Montserrat, monospace; font-size: 2rem; font-weight: 800; letter-spacing: 8px; color: var(--azul-osc); text-align: center; padding: 10px; background: var(--azul-claro); border-radius: 12px; margin: 8px 0; }

/* ---------- barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 50; height: var(--alto-barra); background: var(--menu); color: #fff; display: flex; align-items: center; gap: 6px; padding: 0 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.barra .marca { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: #fff; padding: 0 6px; flex: 0 0 auto; }
.barra .marca img { height: 40px; width: 40px; object-fit: cover; border-radius: 10px; background: #fff; }
.barra .marca b { font-family: Montserrat, sans-serif; font-weight: 800; letter-spacing: .5px; }
.barra .capa { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; }
.barra .capa select { min-height: 38px; max-width: 170px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; padding: 0 8px; }
.barra .capa select option { color: var(--marino); }
.barra .capa .sep { opacity: .5; }
.barra .buscar { flex: 1 1 200px; min-width: 120px; position: relative; }
.barra .buscar input { width: 100%; min-height: 40px; border-radius: 12px; border: 0; padding: 0 12px 0 36px; background: rgba(255, 255, 255, .12); color: #fff; }
.barra .buscar input::placeholder { color: #CBD5E1; }
.barra .buscar .lupa { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .7; }
.barra .acciones { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.barra .contador { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--verde); color: var(--marino); font-size: .7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.barra .usuario { display: flex; align-items: center; gap: 8px; border: 0; background: rgba(255, 255, 255, .08); color: #fff; min-height: 44px; border-radius: 12px; padding: 0 10px; cursor: pointer; }
.barra .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--verde); color: var(--marino); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.resultados { position: absolute; top: 46px; left: 0; right: 0; background: #fff; color: var(--marino); border-radius: 12px; box-shadow: var(--sombra); max-height: 360px; overflow: auto; z-index: 60; }
.resultados button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--gris-100); }
.resultados button:hover, .resultados button:focus { background: var(--azul-claro); }
.resultados small { color: var(--gris-500); display: block; }
.favs { display: flex; gap: 6px; padding: 6px 16px; background: #fff; border-bottom: 1px solid var(--gris-200); overflow-x: auto; }
.favs:empty { display: none; }
.favs a { white-space: nowrap; }

/* ---------- estructura ---------- */
.marco { display: flex; min-height: calc(100vh - var(--alto-barra)); }
.menu { width: var(--ancho-menu); background: var(--menu); color: #E2E8F0; flex: 0 0 auto; padding: 10px 8px 24px; overflow-y: auto; position: sticky; top: var(--alto-barra); height: calc(100vh - var(--alto-barra)); }
.menu .titulo { font-size: .72rem; font-weight: 800; letter-spacing: 1.4px; color: #94A3B8; padding: 12px 12px 4px; text-transform: uppercase; }
.menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #E2E8F0; text-decoration: none; font-weight: 500; }
.menu a:hover { background: rgba(255, 255, 255, .07); }
.menu a.activo { background: var(--pri); color: #fff; font-weight: 700; }
.menu a .ico { width: 20px; text-align: center; opacity: .9; }
.menu a.futuro { opacity: .55; }
.menu a.futuro .chip { margin-left: auto; background: rgba(255, 255, 255, .1); color: #CBD5E1; }
.menu .firma-menu { margin: 18px 12px 0; font-size: .78rem; color: #94A3B8; display: flex; align-items: center; gap: 6px; }
.contenido { flex: 1 1 auto; min-width: 0; padding: 20px 24px 80px; }
.cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.cabeza p { margin: 0; color: var(--gris-500); }
.pie { text-align: center; color: var(--gris-500); font-size: .8rem; padding: 24px 0 0; }
.pie b { color: var(--marino); }

/* ---------- tarjetas y tablas ---------- */
.tarjeta { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; border: 1px solid var(--gris-200); min-width: 0; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.cifra { background: #fff; border-radius: var(--radio); padding: 16px; border: 1px solid var(--gris-200); box-shadow: var(--sombra); }
.cifra .n { font-family: Montserrat, sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--marino); }
.cifra .t { color: var(--gris-500); font-size: .85rem; }
.cifra .barra-acento { height: 4px; width: 36px; border-radius: 4px; background: var(--verde); margin-bottom: 10px; }
.pasos { list-style: none; padding: 0; margin: 0; }
.pasos li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gris-100); }
.pasos li:last-child { border-bottom: 0; }
.pasos .marca-paso { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; background: var(--gris-100); color: var(--gris-500); }
.pasos .hecho .marca-paso { background: var(--verde); color: var(--marino); }
.pasos .txt { flex: 1 1 auto; min-width: 0; }
.pasos small { color: var(--gris-500); display: block; }
.progreso { height: 10px; background: var(--gris-100); border-radius: 6px; overflow: hidden; }
.progreso i { display: block; height: 100%; background: var(--verde); }
.tabla-env { overflow-x: auto; border-radius: 12px; border: 1px solid var(--gris-200); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; background: var(--gris-50); color: var(--gris-700); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--gris-200); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--gris-100); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--gris-500); font-size: .8rem; }
.pestanas { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--gris-200); }
.pestanas button { border: 0; background: none; min-height: 44px; padding: 0 14px; font-weight: 600; color: var(--gris-500); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.pestanas button.activo { color: var(--azul-osc); border-bottom-color: var(--azul); }
.arbol { list-style: none; padding-left: 0; margin: 0; }
.arbol ul { list-style: none; padding-left: 22px; border-left: 2px solid var(--gris-200); margin: 0 0 0 10px; }
.arbol li { padding: 4px 0; }
.arbol .nodo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vacio { text-align: center; color: var(--gris-500); padding: 28px 12px; }

/* ---------- modal, aviso emergente, carga ---------- */
.fondo-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.modal.ancho { max-width: 900px; }
.modal .mc { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--gris-200); }
.modal .mc h2 { margin: 0; font-size: 1.1rem; }
.modal .cerrar { width: 44px; height: 44px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; border-radius: 10px; }
.modal .mb { padding: 16px 18px; overflow: auto; }
.modal .mp { padding: 12px 18px; border-top: 1px solid var(--gris-200); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; width: min(92vw, 460px); }
#toast div { background: var(--marino); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sombra); font-weight: 600; border-left: 6px solid var(--azul); }
#toast div.ok { border-left-color: var(--verde); }
#toast div.mal { border-left-color: var(--rojo); }
.cargando-linea { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 400; background: linear-gradient(90deg, var(--azul), var(--verde)); animation: nm-carga 1s infinite; }
.panel-lateral { position: fixed; top: var(--alto-barra); right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; z-index: 120; box-shadow: -10px 0 30px rgba(15, 23, 42, .15); display: flex; flex-direction: column; }
.panel-lateral .mc { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--gris-200); }
.panel-lateral .mb { padding: 14px 16px; overflow: auto; flex: 1 1 auto; }
.alerta-item { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--gris-200); margin-bottom: 8px; }
.alerta-item.sin-leer { border-left: 5px solid var(--azul); }
.alerta-item.ALTA { border-left-color: var(--rojo); }
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat .msj { padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; max-width: 92%; }
.chat .yo { align-self: flex-end; background: var(--azul-claro); }
.chat .ia { align-self: flex-start; background: var(--gris-100); }

/* ---------- mascota ---------- */
#nm-mascota { position: fixed; right: 10px; bottom: 10px; z-index: 110; width: 96px; cursor: pointer; border-radius: 16px; overflow: hidden; }
#nm-mascota .mxa { margin: -25% 0 -16%; }
#nm-mascota canvas { pointer-events: none; user-select: none; }
#nm-globo { position: fixed; right: 112px; bottom: 60px; z-index: 111; background: #fff; color: var(--marino); padding: 10px 12px; border-radius: 14px; box-shadow: var(--sombra); font-size: .85rem; width: 210px; border: 1px solid var(--gris-200); }

/* ---------- modos de interfaz (Color e imagen de marca) ---------- */
.modo-PESTANAS .marco { flex-direction: column; }
.modo-PESTANAS .menu { width: 100%; height: auto; top: var(--alto-barra); z-index: 40; display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px; }
.modo-PESTANAS .menu .titulo, .modo-PESTANAS .menu .firma-menu { display: none; }
.modo-PESTANAS .menu a { white-space: nowrap; flex: 0 0 auto; }
@media (min-width: 901px) {
  .modo-TARJETAS .menu { display: none; }
  .modo-TARJETAS #ham { display: inline-flex; }
  .modo-TARJETAS .menu.abierto { display: block; position: fixed; left: 0; z-index: 100; }
}

/* ---------- celular y tablet (probado en 1366, 820 y 390 px) ---------- */
@media (max-width: 1100px) { .barra .capa select { max-width: 120px; } .barra .usuario .nombre { display: none; } }
@media (max-width: 900px) {
  .menu { position: fixed; left: 0; top: var(--alto-barra); z-index: 100; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0, 0, 0, .25); }
  .menu.abierto { transform: none; }
  .barra .capa { display: none; }
  .contenido { padding: 16px 16px 90px; }
  .ingreso { grid-template-columns: 1fr; }
  .ingreso-marca { padding: 24px 16px; }
  .ingreso-marca img.logo { width: 160px; }
  .ingreso-marca p { display: none; }
}
@media (min-width: 901px) { #ham { display: none; } }
.tarjeta-ingreso .btn { white-space: normal; }
@media (max-width: 600px) {
  .barra { gap: 2px; padding: 0 6px; }
  .barra .marca { padding: 0 2px; }
  .barra .marca img { height: 36px; width: 36px; }
  .barra .buscar { flex: 1 1 auto; min-width: 0; }
  .barra .buscar input { padding-right: 6px; }
  .barra .usuario { padding: 0 6px; }
  #nm-mascota { width: 70px; }
  #nm-globo { right: 86px; bottom: 40px; width: 180px; }
  .barra .marca b, .barra .marca .chip { display: none; }
  .barra .acciones .opcional { display: none; }
  .resultados { left: 8px; right: 8px; top: calc(var(--alto-barra) - 4px); position: fixed; }
  .modal { max-height: 96vh; border-radius: 18px 18px 0 0; align-self: flex-end; }
  .fondo-modal { padding: 0; align-items: flex-end; }
  th, td { padding: 8px; }
  #nm-mascota { width: 64px; height: 112px; right: 8px; bottom: 8px; }
  .tabla-movil thead { display: none; }
  .tabla-movil tr { display: block; border-bottom: 1px solid var(--gris-200); padding: 6px 0; }
  .tabla-movil td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 10px; }
  .tabla-movil td::before { content: attr(data-t); font-weight: 600; color: var(--gris-500); }
}
