@media (max-width: 767px), (max-width: 1024px) and (max-height: 600px), (max-width: 1024px) and (orientation: portrait) {
    .mesa-mobile-overview,
    .mesa-mobile-quick-actions {
        display: none;
    }

    .item-control,
    .item-nota-icon,
    .btn-add-nota {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }

    .btn-add-nota {
        background: #FFFFFF;
        border: 1px solid #E2E8F0;
        color: #64748B;
    }

    .pedido-item {
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
        background: #FFFFFF;
        border: 1px solid #E2E8F0;
        border-radius: 8px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        padding: 12px;
        margin-bottom: 8px;
    }

    .pedido-item .item-nombre {
        order: 1;
        width: 100%;
        font-size: 1rem;
        color: var(--text-color);
        font-weight: 600;
    }

    .pedido-item .item-cantidad {
        order: 2;
        font-size: 0.95rem;
        color: var(--primary-color);
        font-weight: 600;
    }

    .pedido-item .item-precio {
        order: 2;
        margin-left: auto;
        font-size: 0.95rem;
        color: var(--text-color);
        font-weight: 600;
    }

    .pedido-item .item-acciones {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 8px;
        border-top: 1px dashed #E2E8F0;
        padding-top: 8px;
    }

    .item-control {
        background: #F1F5F9;
        border: 1px solid #E2E8F0;
        color: #475569;
        border-radius: 6px;
    }

    .item-control:hover {
        background: #E2E8F0;
    }

    .item-badge {
        background: #F0F9FF;
        color: #0284C7;
        border: 1px solid #BAE6FD;
    }

    .item-nota {
        background: #FFFBEB;
        color: #B45309;
        border: 1px solid #FDE68A;
    }

    /* Footer - Botón Ver Pedido fijo */
    #mesa-modal .modal-footer {
        display: block;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        background: #FFFFFF;
        border-top: 1px solid #E2E8F0;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        flex-shrink: 0;
        z-index: 120;
    }

    #mesa-modal .mesa-mobile-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    #mesa-modal .mesa-mobile-bar-summary {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
        flex: 1 1 140px;
    }

    #mesa-modal .mesa-mobile-bar-total {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-color);
    }

    #mesa-modal .mesa-mobile-bar-items {
        font-size: 0.7rem;
        color: #64748B;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn {
        min-height: 44px;
        padding: 0 14px;
        border-radius: 10px;
        border: 1px solid #E2E8F0;
        background: #F8FAFC;
        color: var(--text-color);
        font-size: 0.85rem;
        font-weight: 600;
        text-transform: none;
        letter-spacing: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
        cursor: pointer;
        width: auto;
        white-space: nowrap;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn--primary {
        background: var(--success-color);
        color: #FFFFFF;
        border-color: var(--success-color);
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn--primary:not(:disabled):hover {
        background: #3d9040;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn .pedido-count {
        background: #FFFFFF;
        color: var(--primary-color);
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 700;
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    /* Panel deslizable del pedido */
    #mesa-modal .pedido-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        height: 85vh;
        background: #FFFFFF;
        border-radius: 20px 20px 0 0;
        transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 140;
        display: flex;
        flex-direction: column;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    #mesa-modal .pedido-panel.active {
        bottom: 0;
    }

    #mesa-modal .pedido-panel-header {
        padding: 16px 20px;
        border-bottom: 1px solid #E2E8F0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #mesa-modal .pedido-panel-header h3 {
        color: var(--text-color);
        font-size: 1.1rem;
        margin: 0;
    }

    #mesa-modal .pedido-panel-close {
        width: 32px;
        height: 32px;
        background: #F1F5F9;
        border: none;
        border-radius: 8px;
        color: #64748B;
        font-size: 1.2rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #mesa-modal .pedido-panel-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        background: #F8FAFC;
    }

    #mesa-modal .pedido-panel-footer {
        padding: 20px;
        border-top: 1px solid #E2E8F0;
        background: #FFFFFF;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    #mesa-modal .pedido-panel-total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-color);
    }

    #mesa-modal .pedido-panel-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    #mesa-modal .pedido-panel-actions button {
        padding: 12px;
        border: none;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }

    #mesa-modal .btn-cobrar {
        background: #10b981;
        color: #ffffff;
        grid-column: 1 / -1;
    }

    #mesa-modal .btn-cobrar:hover {
        background: #059669;
    }

    #mesa-modal .btn-parcial {
        background: #3b82f6;
        color: #ffffff;
    }

    #mesa-modal .btn-parcial:hover {
        background: #2563eb;
    }

    #mesa-modal .btn-factura {
        background: #f59e0b;
        color: #ffffff;
    }

    #mesa-modal .btn-factura:hover {
        background: #d97706;
    }

    #mesa-modal .btn-imprimir {
        background: #6b7280;
        color: #ffffff;
    }

    #mesa-modal .btn-imprimir:hover {
        background: #4b5563;
    }

    /* Mejoras de performance y UX */
    .category-button, .articulo-btn {
        will-change: transform;
        backface-visibility: hidden;
        -webkit-font-smoothing: antialiased;
    }

    /* Scroll suave */
    .categorias-container, .articulos-container, .pedido-actual-container {
        scroll-behavior: smooth;
    }
}
