/* =====================================================================
   KO Teclado — teclado en pantalla del sistema (Javascript/ko-teclado.js)
   ===================================================================== */
.ko-tec {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483000;
    background: #0f172a;
    border-top: 3px solid #E8A020;
    padding: 6px 6px 8px;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .25);
    transform: translateY(105%);
    transition: transform .16s ease-out;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.ko-tec.ko-tec-visible { transform: translateY(0); }

.ko-tec-preview {
    max-width: 980px;
    margin: 0 auto 6px;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 16px;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
}
.ko-tec-preview:empty::before { content: attr(data-vacio); color: #64748b; }

.ko-tec-teclas { max-width: 980px; margin: 0 auto; }
.ko-tec-numerico .ko-tec-teclas,
.ko-tec-numerico .ko-tec-preview { max-width: 440px; }
/* Numérico pegado a la derecha (cantidad, descuento, precio quedan a la derecha en el POS) */
.ko-tec-numerico .ko-tec-teclas,
.ko-tec-numerico .ko-tec-preview { margin-left: auto; margin-right: 8px; }

.ko-tec-fila { display: flex; gap: 5px; margin-top: 5px; }
.ko-tec-fila:first-child { margin-top: 0; }

.ko-tec-k {
    flex: 1 1 0;
    min-width: 0;
    height: 50px;
    border: none;
    border-radius: 7px;
    background: #334155;
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
    -webkit-tap-highlight-color: transparent;
}
.ko-tec-k.ko-tec-pulsada { background: #E8A020; color: #0f172a; transform: translateY(1px); box-shadow: none; }

/* Teclas especiales */
.ko-tec-esp { background: #1e293b; font-size: 16px; }
.ko-tec-space { flex-grow: 5; }
.ko-tec-tab, .ko-tec-sim, .ko-tec-abc { flex-grow: 1.5; }
.ko-tec-enter { flex-grow: 1.5; background: #E8A020; color: #0f172a; font-size: 22px; font-weight: 700; }
.ko-tec-back { flex-grow: 1.4; font-size: 22px; }
.ko-tec-shift { flex-grow: 1.4; font-size: 22px; }
.ko-tec-shift.ko-tec-activa { background: #64748b; }
.ko-tec-shift.ko-tec-fijo { background: #E8A020; color: #0f172a; }
.ko-tec-ocultar { font-size: 22px; }
.ko-tec-numerico .ko-tec-k { height: 54px; font-size: 22px; }

/* Espacio para que la vista no quede tapada (sin deformarla) */
html.ko-tec-abierto body { padding-bottom: var(--ko-tec-alto, 300px) !important; }
html.ko-tec-abierto .modal,
html.ko-tec-abierto .swal2-container { padding-bottom: var(--ko-tec-alto, 300px) !important; }

/* Botón ⌨ para encender/apagar (solo equipos táctiles) */
.ko-tec-boton {
    position: fixed;
    left: 8px;
    bottom: 8px;
    z-index: 2147482999;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, .85);
    color: #64748b;
    font-size: 20px;
    line-height: 36px;
    padding: 0;
    opacity: .7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    cursor: pointer;
}
.ko-tec-boton.ko-tec-boton-on { background: #E8A020; border-color: #E8A020; color: #0f172a; opacity: .9; }
html.ko-tec-abierto .ko-tec-boton { display: none; }

@media (max-width: 600px) {
    .ko-tec { padding: 4px 3px 6px; }
    .ko-tec-fila { gap: 3px; margin-top: 4px; }
    .ko-tec-k { height: 44px; font-size: 18px; border-radius: 5px; }
    .ko-tec-esp { font-size: 13px; }
}
@media (max-height: 500px) {
    .ko-tec-k { height: 38px; font-size: 17px; }
    .ko-tec-preview { min-height: 24px; font-size: 14px; line-height: 16px; margin-bottom: 4px; }
}

/* Página más ancha que el celular (el navegador la aleja): modales y su sombra
   cubren lo que realmente se ve. Las variables las pone ko-teclado.js. */
html.ko-alejado .modal,
html.ko-alejado .modal-backdrop,
html.ko-alejado .swal2-container {
    position: fixed !important;
    left: var(--ko-vv-x, 0) !important;
    top: var(--ko-vv-y, 0) !important;
    right: auto !important;
    bottom: auto !important;
    width: var(--ko-vv-w, 100vw) !important;
    height: var(--ko-vv-h, 100vh) !important;
}