
* { box-sizing: border-box; }
body{
margin:0;
font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
background:linear-gradient(135deg,#dce8f5,#eef4fb);
}
.app { min-height: 100vh; display: flex; justify-content: center; gap: 30px; padding: 25px; align-items: flex-start; flex-wrap: wrap; }
.panel-derecho { width: 420px; }

.panel{
width:420px;
background:#ffffff;
padding:25px;
border-radius:18px;
box-shadow:0 10px 30px rgba(0,0,0,.18);
border:1px solid #dbe4ef;
}
label{
display:block;
margin-top:12px;
margin-bottom:5px;
font-size:13px;
font-weight:700;
color:#23415f;
}
input,
textarea{
width:100%;
padding:11px;
border:1px solid #c7d3df;
border-radius:10px;
font-size:14px;
transition:.25s;
background:white;
}
input:focus,
textarea:focus{
outline:none;
border-color:#0d6efd;
box-shadow:0 0 0 4px rgba(13,110,253,.18);
}
input[readonly], textarea[readonly] { background: #e9e9e9; cursor: not-allowed; }
.buscar { display: flex; gap: 8px; }
button{
padding:11px 18px;
border:none;
border-radius:10px;
cursor:pointer;
font-weight:700;
font-size:14px;
transition:.25s;
color:white;
background:#0d6efd;
}
button:hover{
transform:translateY(-2px);
box-shadow:0 5px 12px rgba(0,0,0,.25);
}
.resultado{
width:100%;
margin-top:8px;
text-align:left;
background:white;
color:#23415f;
border:1px solid #d8e2ef;
}
.resultado:hover{
background:#0d6efd;
color:white;
}
.acciones { display: flex; gap: 10px; margin-top: 15px; }
.fila-dos { display: flex; gap: 10px; }
.fila-dos > div { flex: 1; }

#areaEtiquetas { flex-shrink: 0; }
/* Area temporal para armar las etiquetas a imprimir (fuera de pantalla) */
#areaImpresion { position: absolute; left: -10000px; top: 0; }

/* ===== ETIQUETA 100x100 mm: todas las medidas fijas en mm (pantalla = impresion) ===== */
.etiqueta{
width:100mm;
height:100mm;
background:#ffffff;
background-size:cover;
background-position:center;
background-repeat:no-repeat;
border:none;
border-radius:16px;
padding:3.5mm;
box-sizing:border-box;
box-shadow:0 15px 40px rgba(0,0,0,.25);
color:#111;
overflow:hidden;
display:flex;
flex-direction:column;
}
.control-doc{
flex:none;
height:5mm;
line-height:5mm;
background:#0d4b8f;
color:white;
border-radius:1.5mm;
font-size:2.3mm;
font-weight:700;
text-align:center;
white-space:nowrap;
overflow:hidden;
}
.encabezado{
flex:none;
height:14mm;
display:flex;
justify-content:space-between;
align-items:center;
border-bottom:0.5mm solid #d8e5f3;
margin-bottom:1.5mm;
}
.marca { display: flex; align-items: center; }
.simed-logo { width: 40mm; height: 12mm; object-fit: contain; display: block; }
.fecha{ text-align:right; font-size:3.3mm; color:#0d4b8f; font-weight:600; line-height:1.2; }
.fecha strong { display: block; margin-top: 0.5mm; font-size: 4mm; }

/* RECUADRO NARANJA: ocupa todo el espacio libre; el texto se autoajusta por JS (--fs) */
.destino{
flex:1 1 0;
min-height:0;
margin:1mm 0;
overflow:hidden;
display:flex;
flex-direction:column;
justify-content:center;
text-align:center;
font-weight:900;
color:#163f72;
--fs:5mm;
}
.destinoTxt{ display:flow-root; width:100%; }
.destino h2, .destino h3, .destino h4, .destino h5{
margin:0.22em 0;
text-transform:uppercase;
overflow-wrap:anywhere;
line-height:1.15;
font-weight:900;
}
.destino h2{ font-size:var(--fs); }
.destino h3{ font-size:calc(var(--fs) * .9); }
.destino h4, .destino h5{ font-size:calc(var(--fs) * .8); }

/* BLOQUE INFERIOR de tamano fijo: (pedido + CAJAS) a la izquierda y QR a la derecha */
.bloqueInferior{
flex:none;
height:25mm;
display:flex;
gap:3mm;
align-items:stretch;
}
.colIzq{ flex:1 1 0; min-width:0; max-width:calc(100% - 28mm); display:flex; flex-direction:column; justify-content:space-between; }
.pedido{
flex:1;
min-height:0;
display:flex;
flex-direction:column;
justify-content:center;
text-align:center;
font-size:3.2mm;
line-height:1.2;
overflow:hidden;
--pf:4.2mm;
}
.pedidoTop{ flex:none; display:flex; justify-content:center; align-items:center; gap:2.5mm; }
.pedidoLbl{ flex:none; line-height:1.1; font-size:3.6mm; font-weight:900; white-space:nowrap; }
/* Pedidos/guias: si son muchos, se pasan a 2 lineas y la letra se ajusta sola */
.pedidoFila{ flex:1; min-height:0; display:flex; justify-content:center; align-items:center; gap:2mm; margin-top:0; overflow:hidden; }
.pedidoValor{ flex:1; min-width:0; font-size:var(--pf); line-height:1.05; font-weight:900; text-align:center; white-space:normal; overflow-wrap:anywhere; text-transform:uppercase; }
.pedidoTipo{
flex:none;
min-width:9mm;
max-width:18mm;
height:6mm;
padding:0 1.5mm;
box-sizing:border-box;
overflow:hidden;
text-overflow:ellipsis;
display:flex;
align-items:center;
justify-content:center;
font-size:4.4mm;
line-height:1;
font-weight:900;
white-space:nowrap;
text-transform:uppercase;
}
/* RECUADRO VERDE: CAJAS x/x (A) tamano fijo */
.cajas{
flex:none;
height:13mm;
display:flex;
align-items:center;
justify-content:center;
gap:2mm;
font-size:6.5mm;
font-weight:900;
color:#0d6efd;
white-space:nowrap;
overflow:hidden;
line-height:1;
}
/* RECUADRO AMARILLO: QR tamano fijo */
.qrBox{
flex:none;
flex-shrink:0;
width:25mm;
min-width:25mm;
max-width:25mm;
height:25mm;
min-height:25mm;
max-height:25mm;
box-sizing:border-box;
display:block;
visibility:hidden;
}
.qrBox img{ width:25mm; height:25mm; object-fit:contain; display:block; }
.tipoTemp { display: none; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; }
#loginOverlay { z-index: 999; background: rgba(10,20,30,.88); }

.loginCard {
  width: 800px;
  max-width: 94vw;
  background: white;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  animation: loginAparecer .55s cubic-bezier(.2,.8,.2,1);
}
@keyframes loginAparecer {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.loginBanda {
  position: relative;
  flex: 1;
  min-width: 260px;
  background: linear-gradient(135deg, #08304f, #146ca8, #08304f);
  background-size: 220% 220%;
  animation: loginGradiente 9s ease infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 26px;
  color: white;
  text-align: center;
  overflow: hidden;
}
@keyframes loginGradiente {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.loginBanda::before, .loginBanda::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.loginBanda::before { width: 230px; height: 230px; top: -70px; left: -70px; animation: loginFlota1 9s ease-in-out infinite; }
.loginBanda::after { width: 170px; height: 170px; bottom: -55px; right: -45px; animation: loginFlota2 7s ease-in-out infinite; }
@keyframes loginFlota1 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(22px); } }
@keyframes loginFlota2 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }

.loginLogoWrap {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: white;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  box-shadow: 0 10px 26px rgba(0,0,0,.3);
  animation: loginLatido 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes loginLatido { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.loginLogoWrap img { width: 76px; height: auto; }

.loginTitulo { margin: 0 0 8px; font-size: 26px; letter-spacing: 3px; font-weight: 900; position: relative; z-index: 1; }
.loginTagline { margin: 0; font-size: 13px; opacity: .92; max-width: 240px; line-height: 1.6; position: relative; z-index: 1; }

.loginFormulario {
  flex: 1;
  min-width: 270px;
  padding: 44px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.loginFormulario h3 { margin: 0 0 20px; font-size: 21px; color: #08304f; }
.loginFormulario input[type="text"], .loginFormulario input[type="password"] {
  border: 1px solid #d3dde5;
  border-radius: 7px;
  background: #f6f9fb;
}
.loginFormulario input[type="text"]:focus, .loginFormulario input[type="password"]:focus {
  outline: none;
  border-color: #146ca8;
  background: white;
}
.btnLoginPrincipal {
  background: linear-gradient(135deg, #146ca8, #08304f);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 11px 26px;
  font-size: 14px;
  letter-spacing: .5px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btnLoginPrincipal:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(8,48,79,.35); }
.btnLoginPrincipal:active { transform: translateY(0); }

@media (max-width: 620px) {
  .loginCard { flex-direction: column; }
  .loginBanda { padding: 30px 20px; }
}
.oculto { display: none !important; }
.modalCaja { width: 430px; background: white; padding: 18px; border-radius: 8px; }
.modalAcciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.grupoTipo { display: flex; gap: 12px; align-items: flex-end; }
.grupoTipo > div { flex: 1; }
.grupoTipo input { text-align: center; }

hr{
border:none;
height:1px;
background:#d8e5f3;
margin:18px 0;
}

#btnBuscar{
background:#0d6efd;
}

#btnActualizar{
background:#198754;
}

#btnLimpiar{
background:#6c757d;
}

#btnImprimir{
background:#198754;
font-size:15px;
}

#descargarZpl{
background:#fd7e14;
}

#btnQuitarFondo{
background:#dc3545;
}

.modalCaja{
border-radius:18px;
box-shadow:0 20px 45px rgba(0,0,0,.30);
}

@media print {

@page { size: 100mm 100mm; margin: 0; }

body { background: white; margin: 0; padding: 0; }

#panelControl, #panelFormulario, .modal, #usuarioActivo, #areaEtiquetas {
display: none !important;
}

.app { display: block; padding: 0; margin: 0; width: 100mm; min-height: 0; }

#areaImpresion {
position: static !important;
display: block !important;
width: 100mm;
margin: 0;
padding: 0;
}

#areaImpresion .etiqueta {
box-shadow: none !important;
border-radius: 0 !important;
margin: 0 !important;
page-break-after: always;
break-after: page;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
#areaImpresion .etiqueta:last-child { page-break-after: auto; break-after: auto; }
}


/* App modules: screen-only layout; 100 x 100 mm print styles remain untouched. */
@media screen {
 .app-shell{min-height:100vh; padding:0;}
 .app-header{display:flex;align-items:center;gap:18px;padding:16px 24px;background:#fff;border-bottom:1px solid #dbe4ef;min-height:80px;}
 .app-titulo{font-size:24px;font-weight:900;color:#163f72;min-width:0;}
 .app-titulo span{font-size:14px;font-weight:500;margin-left:12px;}
 #usuarioActivo{position:static; margin-left:auto;flex:0 1 auto;max-width:42%;overflow-wrap:anywhere; background:#eaf2fa;padding:10px 16px;border-radius:10px;color:#23415f;font-weight:700;z-index:auto;}
 #usuarioActivo:empty{display:none;}
 #btnMenu{flex-shrink:0;white-space:nowrap;}
 .app-layout{display:grid;grid-template-columns:215px minmax(0,1fr);align-items:start;}
 .menu-lateral{padding:25px 14px;background:#163f72;min-height:calc(100vh - 80px);color:white;}
 .marca-menu{font-size:30px;font-weight:900;padding:10px 14px 30px;}
 .nav-modulo{display:block;text-align:left;width:100%;margin-bottom:12px;background:transparent;padding:16px 14px;}
 .nav-modulo.activo{background:#0d6efd;}
 .menu-oculto .app-layout{grid-template-columns:minmax(0,1fr);}
 .menu-oculto .menu-lateral{display:none;}
 #contenidoModulos{padding:25px;min-width:0;}
 .modulo{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;align-items:stretch;max-width:1250px;margin:0 auto;}
 #moduloImpresiones{grid-template-columns:repeat(2,minmax(0,1fr));}
 .modulo .panel{width:100%;min-width:0;padding:24px;height:100%;}
 .modulo h2{font-size:20px;color:#23415f;margin:0 0 20px;padding-bottom:12px;border-bottom:2px solid #d8e5f3;}
 #areaEtiquetas{grid-column:1/-1;justify-self:center; padding:12px 0;}
 .modulo input:not([type=checkbox]),.modulo textarea{font-family:inherit;width:100%;min-width:0;}
 .modulo input:not([type=checkbox]){height:46px;}
 .modulo input[type=file]{font-size:12px;padding:10px 6px;}
 .fila-dos>div{min-width:0;}
 .buscar input{min-width:0;}
 .acciones,.modalAcciones{flex-wrap:wrap;}
 .acciones button{flex:1;min-width:130px;}
 .ayuda{font-size:13px;color:#61758a;line-height:1.6;}
 .estado-conexion{padding:16px;background:#edf6ff;border:1px solid #d1e6fb;border-radius:10px;margin:18px 0;font-size:14px;line-height:1.6;}
 .estado-conexion p{margin:8px 0 0;}
 #estadoArchivo,#estadoNuevoCliente{font-size:14px;line-height:1.6;overflow-wrap:anywhere;}
 .secundario{background:#6c757d;}
 #guardarNuevoCliente,#btnExcelActualizado{background:#198754;}
 #btnExcelActualizado{width:100%;}
 #resultados{max-height:270px;overflow-y:auto;}
 #modalPrint{z-index:1100;overflow-y:auto;padding:18px;}
 #modalPrint .modalCaja{width:430px;max-width:100%;max-height:calc(100vh - 36px);overflow-y:auto;}
 #modalPrint input{height:46px;}
 #modalPrint .grupoTipo{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
 #modalPrint .grupoTipo>div{min-width:0;}
 #loginOverlay{z-index:2000;overflow-y:auto;}
 @media(min-width:1450px){#moduloImpresiones{grid-template-columns:repeat(2,minmax(0,1fr)) 378px;max-width:1650px;}#areaEtiquetas{grid-column:auto;align-self:start;padding:0;}}
 @media(max-width:1000px){.app-layout{grid-template-columns:190px minmax(0,1fr);}#contenidoModulos{padding:18px;}.modulo,#moduloImpresiones{grid-template-columns:minmax(0,1fr);}.modulo .panel{height:auto;}}
 @media(max-width:650px){.app-header{flex-wrap:wrap;padding:12px;gap:10px;}.app-titulo{font-size:20px;}.app-titulo span{display:none;}#usuarioActivo{max-width:100%;font-size:13px;}#btnMenu span{font-size:12px;}.app-layout{grid-template-columns:minmax(0,1fr);}.menu-lateral{min-height:0;padding:12px;}.marca-menu{display:none;}.nav-modulo{padding:12px;margin-bottom:6px;}#contenidoModulos{padding:12px;}.modulo .panel{padding:18px;}.fila-dos{flex-direction:column;}#areaEtiquetas{width:100%;overflow-x:auto;}.etiqueta{margin:0 auto;}}
}
@media print{
 .app-header,.menu-lateral,#moduloCliente,#moduloArchivo{display:none!important;}
 .app-shell,.app-layout,#contenidoModulos,#moduloImpresiones{display:block!important;margin:0!important;padding:0!important;min-height:0!important;width:100mm!important;}
}

@media screen{#btnSalir{background:#6c757d;flex-shrink:0;}button:disabled{opacity:.6;cursor:wait;}.config-fondo h3{font-size:16px;color:#23415f;}.config-fondo{margin-top:25px;}#estadoNube{overflow-wrap:anywhere;}}
