.content-wrapper { background: #f4f5f7; }

#OverlayPrecuenta.form-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248,249,250,.96) !important;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 16px;
    z-index: 10;
}

#OverlayPrecuenta.form-overlay i { font-size: 26px; color: #adb5bd; }
#OverlayPrecuenta.form-overlay p  { font-size: 11px; color: #555; line-height: 1.5; }
#OverlayPrecuenta.form-overlay p strong { color: #243747; }
@media (min-width: 768px) {

    /* 1. La fila principal toma todo el alto disponible */
    .pos-main-row {
        height: calc(100vh - 57px);
        overflow: hidden;
    }

    /* 2. Cada panel ocupa el 100% de esa fila */
    .pos-panel-left,
    .pos-panel-right {
        height: 100%;
        overflow: hidden;  /* contiene a los hijos; el scroll va en el hijo */
    }

    /* 3. Panel izquierdo: topbar + tabs son flex-shrink-0,
            pos-products-scroll crece y scrollea */
    .pos-products-scroll {
        flex: 1 1 0;       /* crece para llenar el espacio restante */
        min-height: 0;     /* imprescindible en flex para que overflow funcione */
        overflow-y: auto;
    }

    /* 4. Panel derecho: pos-right-scroll crece dentro del panel */
    .pos-right-scroll {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;  /* scroll cuando el detalle crece mucho */
    }

    /* 5. Detalle: crece entre cliente y totales */
    .pos-detalle-section {
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }
    .pos-detalle-scroll {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
    }
}

@media (max-width: 767px) {
    .pos-main-row,
    .pos-panel-left,
    .pos-panel-right   { height: auto; overflow: visible; }
    .pos-products-scroll,
    .pos-right-scroll,
    .pos-detalle-section,
    .pos-detalle-scroll { flex: none; overflow: visible; min-height: 0; }
    .pos-products-scroll { min-height: 220px; }
    .pos-panel-right { border-left: none !important; border-top: 2px solid var(--pos-border); }
}

.pos-kbd {
    font-size: 10px; font-family: monospace;
    background: #f4f5f7; color: #6c757d;
}

.pos-cat-tabs {
    display: flex; gap: 4px;
    overflow-x: hidden; scroll-behavior: smooth;
    padding: 2px 0;
}
.pos-cat-tab {
    flex-shrink: 0;
    padding: 2px 11px;
    border: 1px solid var(--pos-border);
    border-radius: 20px;
    font-size: 11.5px; font-weight: 500;
    color: #6c757d; background: transparent;
    cursor: pointer; white-space: nowrap;
    transition: all .12s; line-height: 1.6;
}
.pos-cat-tab:hover {
    border-color: var(--pos-accent);
    color: var(--pos-accent);
    background: var(--pos-accent-soft);
}
.pos-cat-tab.active {
    background: var(--pos-accent);
    border-color: var(--pos-accent);
    color: #fff;
}

#pos-view-list .pos-list-item {
    display: flex; align-items: center; gap: 10px;
    background: #fff;
    border: 1px solid var(--pos-border);
    border-radius: 6px;
    padding: 6px 10px; margin-bottom: 4px;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
}
#pos-view-list .pos-list-item:hover {
    border-color: var(--pos-accent);
    box-shadow: 0 0 0 2px rgba(0,123,255,.1);
}
.pos-list-thumb {
    width: 36px; height: 36px; border-radius: 4px;
    background: #f4f5f7;
    display: flex; align-items: center; justify-content: center;
    color: #ced4da; font-size: 16px; flex-shrink: 0;
    position: relative;
}
.pos-list-thumb img {
    border-radius: 4px;
    overflow: hidden;
}
.pos-list-name  { font-size: 12.5px; font-weight: 600; color: #212529; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-list-price { font-size: 11.5px; color: var(--pos-accent); font-family: monospace; margin-top: 1px; }
.pos-list-umed  { font-size: 10px; color: #6c757d; font-family: monospace; line-height: 1.2; }

.pos-grid-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 8px;
}
.pos-grid-item {
    background: #fff; border: 1px solid var(--pos-border);
    border-radius: 6px; padding: 8px;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; cursor: pointer; text-align: center;
    transition: border-color .12s, box-shadow .12s, transform .1s;
}
.pos-grid-item:hover {
    border-color: var(--pos-accent);
    box-shadow: 0 0 0 2px rgba(0,123,255,.1);
    transform: translateY(-1px);
}
.pos-grid-thumb {
    width: 50px; height: 50px; border-radius: 6px;
    background: #f4f5f7;
    display: flex; align-items: center; justify-content: center;
    color: #ced4da; font-size: 20px;
    position: relative;
}
.pos-grid-thumb img {
    border-radius: 6px;
    overflow: hidden;
}
.pos-grid-name  {
    font-size: 11px; font-weight: 600; color: #212529; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.pos-grid-price { font-size: 11px; font-weight: 700; color: var(--pos-accent); font-family: monospace; }

.pos-detalle-table { font-size: 11.5px; }
.pos-detalle-table thead th {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: .04em; padding: 4px 5px;
    white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.pos-detalle-table tbody td { padding: 4px 5px; vertical-align: middle; }
.col-prod  { min-width: 80px; }
.col-umed  { width: 64px; }
.col-cant  { width: 96px; }
.col-total { width: 54px; }
.col-acc   { width: 30px; }

.pos-total-input {
    width: 110px !important;
    font-family: monospace !important;
    font-size: 12px !important;
    background: #f8f9fa !important;
}
.pos-total-grand {
    font-size: 15px !important;
    background: var(--pos-accent-soft) !important;
    color: var(--pos-accent) !important;
    border-color: transparent !important;
}

.min-width-0 { min-width: 0; }

@media (min-width: 768px) {
    .pos-products-scroll::-webkit-scrollbar,
    .pos-right-scroll::-webkit-scrollbar,
    .pos-detalle-scroll::-webkit-scrollbar      { width: 4px; }
    .pos-products-scroll::-webkit-scrollbar-thumb,
    .pos-right-scroll::-webkit-scrollbar-thumb,
    .pos-detalle-scroll::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 4px; }
}

.deta_precio_display {
    cursor: pointer;
    border-radius: 3px;
    padding: 1px 3px;
    transition: background .15s;
    display: inline-block;
}

.deta_precio_display:hover {
    background: #e8f4fd;
}

@keyframes precio-ok {
    0%   { background: #d4edda; }
    100% { background: transparent; }
}
.precio-edit-ok {
    animation: precio-ok .6s ease-out;
}

.mesa-nombre-display {
    border-bottom: 1px dashed transparent;
    transition: border-color .15s;
    padding-bottom: 1px;
}
.mesa-nombre-display:hover {
    border-bottom-color: rgba(255,255,255,.5);
    cursor: pointer;
}
.mesa-nombre-select {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    background: rgba(255,255,255,.15);
    border: none;
    border-bottom: 2px solid rgba(255,255,255,.8);
    outline: none;
    padding: 0 4px 1px;
    cursor: pointer;
    max-width: 160px;
    vertical-align: baseline;
}
.mesa-nombre-select option {
    font-weight: 600;
}

/* Total detalle — input transparente, se envía por POST */
.total_cuenta {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-family: monospace;
    font-weight: 700;
    font-size: 11px;
    text-align: right;
    width: 100%;
    color: #243747;
}

/* Select medio pago en thead oscuro */
.table_medio_pago thead .codmedio_pago {
    font-size: 10px;
    padding: 2px 3px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: 4px;
    width: 100%;
}
.table_medio_pago thead .codmedio_pago option {
    color: #333;
    background: #fff;
}

/* Recibido y Vuelto — inputs transparentes, se envían por POST */
.total_medio_pago,
.vuelto_medio_pago {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-family: monospace;
    font-weight: 700;
    font-size: 11px;
    text-align: right;
    width: 100%;
}
.total_medio_pago  { color: #243747; }
.vuelto_medio_pago { color: #28a745 !important; }


/* ── Chips de mesa unida en el header ── */
.union-mesa-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fff;
    border: 1px solid #bee5eb;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 10px;
    color: #0c5460;
    font-weight: 600;
    white-space: nowrap;
}
.union-mesa-chip .chip-remove {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin-left: 2px;
    line-height: 1;
}
.union-mesa-chip .chip-remove:hover { color: #dc3545; }

/* ── Grid del modal de unión ── */
.fum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}
.fum-mesa-card {
    border: 1.5px solid #28a745;
    border-radius: 8px;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
    background: #f0faf2;
}
.fum-mesa-card:hover { background: #d4edda; }
.fum-mesa-card.seleccionada {
    border-color: #007bff;
    background: #e8f0ff;
}
.fum-mesa-card .fum-num {
    font-size: 15px;
    font-weight: 700;
    color: #155724;
}
.fum-mesa-card.seleccionada .fum-num { color: #0044cc; }
.fum-mesa-card .fum-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 10px;
    margin-top: 3px;
    background: #d4edda;
    color: #155724;
}
.fum-mesa-card.seleccionada .fum-badge {
    background: #cce5ff;
    color: #004085;
}

.stock-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    font-family: monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.stock-badge-sm {
    position: absolute;
    bottom: -3px;
    right: -3px;
    min-width: 14px;
    height: 13px;
    padding: 0 3px;
    border-radius: 7px;
    font-size: 8px;
    font-weight: 700;
    font-family: monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 1px solid #fff;
}
