/* === SOTA MOBILE MESA MODAL (override) === */
@media (max-width: 767px), (max-width: 1024px) and (max-height: 600px), (max-width: 1024px) and (orientation: portrait) {
    #mesa-modal {
        --mesa-mobile-bar-height: 92px;
    }

    #mesa-modal .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    }

    #mesa-modal .modal-header {
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        padding: 12px 14px;
        position: sticky;
        top: 0;
        z-index: 120;
    }

    #mesa-modal .mesa-header-info {
        gap: 8px;
        min-width: 0;
    }

    #mesa-modal .mesa-header-info h2 {
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

    #mesa-modal .mesa-etiqueta-display {
        max-width: 120px;
        padding: 3px 8px;
        font-size: 0.66rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        background: rgba(var(--primary-rgb), 0.12);
        color: var(--primary-color-dark);
    }

    #mesa-modal .mesa-mobile-status-chip {
        padding: 4px 10px;
        font-size: 0.68rem;
        font-weight: 700;
        border-radius: 999px;
        letter-spacing: 0.05em;
        background: rgba(16, 185, 129, 0.14);
        color: #059669;
    }

    #mesa-modal .mesa-mobile-status-chip.ocupada {
        background: rgba(239, 68, 68, 0.14);
        color: #dc2626;
    }

    #mesa-modal .modal-body {
        background: transparent;
        overflow-y: auto;
        padding-bottom: calc(var(--mesa-mobile-bar-height) + env(safe-area-inset-bottom));
        scroll-padding-bottom: calc(var(--mesa-mobile-bar-height) + env(safe-area-inset-bottom));
    }

    #mesa-modal .top-controls {
        position: sticky;
        top: 0;
        z-index: 30;
        gap: 9px;
        padding: 10px 12px 9px;
        background: rgba(248, 250, 252, 0.9);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    }

    #mesa-modal .search-container {
        background: #ffffff;
        border-radius: 14px;
        border: 1px solid rgba(15, 23, 42, 0.08);
        box-shadow: 0 6px 18px -14px rgba(15, 23, 42, 0.3);
    }

    #mesa-modal #buscador-articulos {
        border: none;
        background: transparent;
        padding: 11px 38px 11px 36px;
        font-size: 0.9rem;
    }

    #mesa-modal .search-icon {
        left: 11px;
        color: #64748b;
    }

    #mesa-modal .search-clear {
        width: 28px;
        height: 28px;
        border-radius: 10px;
        background: rgba(15, 23, 42, 0.08);
        color: #0f172a;
    }

    #mesa-modal .tag-button {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: #ffffff;
        border: 1px solid rgba(15, 23, 42, 0.08);
        box-shadow: 0 6px 16px -12px rgba(15, 23, 42, 0.35);
    }

    #mesa-modal .tag-button-label {
        display: none;
    }

    #mesa-modal .categorias-section {
        position: sticky;
        top: 62px;
        z-index: 25;
        padding: 8px 12px 6px;
        background: linear-gradient(180deg, rgba(248, 250, 252, 0.94) 0%, rgba(248, 250, 252, 0.75) 100%);
        border: none;
    }

    #mesa-modal .categorias-container {
        gap: 8px;
        padding-bottom: 6px;
        scroll-snap-type: x proximity;
    }

    #mesa-modal .category-button {
        width: auto;
        min-width: auto;
        min-height: 40px;
        padding: 8px 13px;
        border-radius: 999px;
        border: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.96);
        color: #334155;
        box-shadow: 0 8px 18px -16px rgba(15, 23, 42, 0.4);
        font-size: 0.82rem;
        scroll-snap-align: start;
    }

    #mesa-modal .category-button.active {
        background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.95), rgba(var(--primary-rgb), 0.7));
        border-color: transparent;
        color: #ffffff;
        box-shadow: 0 10px 22px -12px rgba(var(--primary-rgb), 0.55);
    }

    #mesa-modal .articulos-section {
        padding: 10px 12px 132px;
    }

    #mesa-modal .articulos-container {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-content: start;
    }

    #mesa-modal .articulo-btn {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        min-height: 126px;
        padding: 10px;
        border-radius: 15px;
        border: 1px solid rgba(15, 23, 42, 0.08);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
        box-shadow: 0 14px 24px -18px rgba(15, 23, 42, 0.48);
        position: relative;
    }

    #mesa-modal .articulo-btn:active {
        transform: scale(0.985);
    }

    #mesa-modal .articulo-btn.articulo-btn--just-added {
        border-color: rgba(var(--primary-rgb), 0.42);
        box-shadow: 0 16px 28px -18px rgba(var(--primary-rgb), 0.55);
        background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(233, 246, 242, 0.96));
    }

    #mesa-modal .articulo-btn-body {
        align-items: flex-start;
        text-align: left;
        gap: 6px;
        width: 100%;
        min-width: 0;
    }

    #mesa-modal .articulo-nombre {
        font-size: 0.87rem;
        font-weight: 600;
        color: #0f172a;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #mesa-modal .articulo-meta {
        font-size: 0.7rem;
        line-height: 1.25;
        color: #64748b;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #mesa-modal .articulo-btn-side {
        margin-left: 0;
        margin-top: auto;
        width: 100%;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-right: 0;
    }

    #mesa-modal .articulo-btn-price {
        background: rgba(var(--primary-rgb), 0.12);
        color: var(--primary-color);
        font-size: 0.8rem;
        font-weight: 700;
        border-radius: 999px;
        padding: 4px 9px;
    }

    #mesa-modal .articulo-add-control {
        position: static;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1.1rem;
        box-shadow: 0 12px 20px -10px rgba(var(--primary-rgb), 0.45);
    }

    #mesa-modal .articulo-option-icon {
        top: 8px;
        right: 8px;
        font-size: 0.72rem;
        background: rgba(15, 23, 42, 0.06);
        padding: 4px 6px;
        border-radius: 8px;
        opacity: 0.7;
    }

    #mesa-modal .modal-footer {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
    }

    #mesa-modal .mesa-mobile-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 8px;
    }

    #mesa-modal .mesa-mobile-bar-summary {
        min-width: 0;
        gap: 2px;
    }

    #mesa-modal .mesa-mobile-bar.is-updated .mesa-mobile-bar-total,
    #mesa-modal #pedido-count.is-updated,
    #mesa-modal #btn-ver-pedido.is-updated {
        animation: mesaMobilePulse 0.45s ease;
    }

    #mesa-modal .mesa-mobile-bar-total {
        font-size: 1.02rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #mesa-modal .mesa-mobile-bar-items {
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn {
        border-radius: 12px;
        min-height: 44px;
        padding: 0 13px;
        font-size: 0.8rem;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn .pedido-count {
        font-size: 0.72rem;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn--primary {
        background: linear-gradient(135deg, #22c55e, #16a34a);
        border: none;
        box-shadow: 0 12px 24px -16px rgba(22, 163, 74, 0.6);
    }

    #mesa-modal .pedido-panel {
        height: 88dvh;
        bottom: 0;
        transform: translateY(108%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        border-radius: 24px 24px 0 0;
        background: #ffffff;
        box-shadow: 0 -16px 38px rgba(15, 23, 42, 0.25);
    }

    #mesa-modal .pedido-panel.active {
        transform: translateY(0);
    }

    body.mesa-panel-open #mesa-modal .modal-footer {
        opacity: 0;
        pointer-events: none;
        transform: translateY(14px);
    }

    body.mesa-panel-open #mesa-modal .modal-column-seleccion {
        opacity: 0.42;
        filter: blur(1px);
        pointer-events: none;
    }

    #mesa-modal .pedido-panel-header {
        padding: 16px 16px 10px;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        position: sticky;
        top: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
    }

    #mesa-modal .pedido-panel-header h3 {
        font-size: 0.95rem;
        letter-spacing: 0.01em;
    }

    #mesa-modal #pedido-panel-summary-movil {
        margin: 4px 0 0;
        font-size: 0.76rem;
        color: #94a3b8;
        font-weight: 600;
    }

    #mesa-modal .pedido-panel-header::before {
        content: '';
        position: absolute;
        top: 7px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.15);
    }

    #mesa-modal .pedido-panel-body {
        padding: 12px;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    }

    #mesa-modal .pedido-panel-body .pedido-item {
        margin-bottom: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid rgba(148, 163, 184, 0.2);
        background: #ffffff;
        box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.45);
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-nombre {
        font-size: 0.92rem;
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-cantidad,
    #mesa-modal .pedido-panel-body .pedido-item .item-precio {
        font-size: 0.86rem;
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-acciones {
        margin-top: 6px;
        padding-top: 8px;
        border-top: 1px dashed rgba(148, 163, 184, 0.45);
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-control,
    #mesa-modal .pedido-panel-body .pedido-item .btn-add-nota,
    #mesa-modal .pedido-panel-body .pedido-item .item-nota-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 0.95rem;
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-nota {
        margin-top: 8px;
        font-size: 0.74rem;
    }

    #mesa-modal .pedido-panel-footer {
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.94);
    }

    #mesa-modal .pedido-panel-total {
        margin-bottom: 12px;
        font-size: 1.1rem;
    }

    #mesa-modal .pedido-panel-actions {
        gap: 8px;
    }

    #mesa-modal .pedido-panel-actions button {
        min-height: 44px;
        border-radius: 11px;
        font-size: 0.84rem;
        font-weight: 700;
    }

    #mesa-modal .modal-footer,
    #mesa-modal .modal-column-seleccion {
        transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
    }

    @keyframes mesaMobilePulse {
        0% { transform: scale(1); }
        40% { transform: scale(1.05); }
        100% { transform: scale(1); }
    }
}

@media (max-width: 420px) {
    #mesa-modal .mesa-mobile-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    #mesa-modal .mesa-mobile-bar-summary {
        flex: 1 1 100%;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
    }

    #mesa-modal .articulos-container {
        gap: 9px;
    }

    #mesa-modal .articulos-section {
        padding-bottom: 144px;
    }

    #mesa-modal .articulo-btn {
        min-height: 126px;
        padding: 10px;
    }

    #mesa-modal .articulo-nombre {
        font-size: 0.83rem;
    }
}

@media (min-width: 680px) and (max-width: 1024px) and (orientation: portrait) {
    #mesa-modal .articulos-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

#mesa-modal .mesa-mobile-tabs,
#mesa-modal .mesa-mobile-tray,
#mesa-modal .mesa-mobile-quick-actions {
    display: none;
}

/* === Ideal mobile mesa modal === */
@media (max-width: 767px), (max-width: 1024px) and (max-height: 600px), (max-width: 1024px) and (orientation: portrait) {
    #mesa-modal {
        --mesa-mobile-bar-height: 178px;
        padding: 12px 0 0;
        overflow: hidden;
        background: rgba(15, 23, 42, 0.34);
        backdrop-filter: blur(5px);
    }

    #mesa-modal .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: calc(100dvh - 12px);
        max-height: calc(100dvh - 12px);
        margin: 0;
        border-radius: 18px 18px 0 0;
        background: #f5f7fa;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.22);
    }

    #mesa-modal .modal-header {
        position: relative;
        z-index: 130;
        padding: 12px 14px 9px;
        border-radius: 18px 18px 0 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 22px -20px rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(14px);
    }

    #mesa-modal .mesa-header-info {
        min-width: 0;
        align-items: flex-start;
    }

    #mesa-modal .mesa-header-copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    #mesa-modal .mesa-header-info h2 {
        display: flex;
        align-items: center;
        gap: 7px;
        min-width: 0;
        font-size: 0.98rem;
        line-height: 1.12;
        font-weight: 800;
        color: #111827;
        letter-spacing: 0;
    }

    #mesa-modal .mesa-etiqueta-display {
        max-width: 96px;
        padding: 3px 7px;
        border-radius: 999px;
        background: #e5eaf0;
        color: #667085;
        font-size: 0.62rem;
        font-weight: 700;
    }

    #mesa-modal .mesa-header-stats {
        display: flex;
        align-items: center;
        gap: 5px;
        min-width: 0;
        overflow: hidden;
    }

    #mesa-modal .mesa-mobile-status-chip,
    #mesa-modal .mesa-header-chip {
        display: inline-flex;
        align-items: center;
        min-width: 0;
        max-width: 104px;
        height: 22px;
        padding: 0 8px;
        border-radius: 999px;
        font-size: 0.64rem;
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    #mesa-modal .mesa-mobile-status-chip {
        background: rgba(16, 185, 129, 0.12);
        color: #047857;
    }

    #mesa-modal .mesa-mobile-status-chip.ocupada {
        background: #fee2e2;
        color: #dc2626;
    }

    #mesa-modal .mesa-header-chip {
        background: #edf2f7;
        color: #667085;
        text-transform: none;
        letter-spacing: 0;
        font-weight: 700;
    }

    #mesa-modal .mesa-header-chip--total {
        background: rgba(22, 101, 52, 0.1);
        color: #166534;
    }

    #mesa-modal .modal-header .close {
        width: 44px;
        height: 44px;
        border-radius: 13px;
        background: #f1f5f9;
        color: #64748b;
        font-size: 1.45rem;
        box-shadow: 0 8px 22px -18px rgba(15, 23, 42, 0.6);
        flex: 0 0 auto;
    }

    #mesa-modal .mesa-mobile-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.96);
        border-bottom: 1px solid rgba(15, 23, 42, 0.07);
        z-index: 118;
    }

    #mesa-modal .mesa-mobile-tab {
        min-height: 38px;
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: 12px;
        background: #f8fafc;
        color: #475569;
        font-size: 0.82rem;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }

    #mesa-modal .mesa-mobile-tab.is-active {
        background: #204f4f;
        border-color: #204f4f;
        color: #ffffff;
        box-shadow: 0 12px 24px -20px rgba(32, 79, 79, 0.75);
    }

    #mesa-modal .mesa-mobile-tab:disabled {
        opacity: 0.48;
    }

    #mesa-modal .mesa-mobile-tab .pedido-count {
        min-width: 22px;
        height: 22px;
        padding: 0 7px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        color: #204f4f;
        font-size: 0.72rem;
        font-weight: 900;
    }

    #mesa-modal .modal-body-grid,
    #mesa-modal .modal-column-seleccion,
    #mesa-modal .modal-body {
        min-height: 0;
    }

    #mesa-modal .modal-body-grid {
        flex: 1 1 auto;
        display: block;
        overflow: hidden;
    }

    #mesa-modal .modal-column-seleccion {
        height: 100%;
    }

    #mesa-modal .modal-body {
        height: 100%;
        max-height: none;
        padding: 0;
        background: #f5f7fa;
        overflow-y: auto;
        padding-bottom: calc(var(--mesa-mobile-bar-height) + env(safe-area-inset-bottom));
        scroll-padding-bottom: calc(var(--mesa-mobile-bar-height) + env(safe-area-inset-bottom));
    }

    #mesa-modal .top-controls {
        position: sticky;
        top: 0;
        z-index: 42;
        gap: 8px;
        padding: 9px 10px;
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        backdrop-filter: blur(10px);
    }

    #mesa-modal .search-container {
        min-width: 0;
        height: 44px;
        border-radius: 13px;
        border: 1px solid rgba(148, 163, 184, 0.26);
        background: #ffffff;
        box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.46);
    }

    #mesa-modal #buscador-articulos {
        height: 100%;
        padding: 0 38px 0 36px;
        border: 0;
        background: transparent;
        color: #0f172a;
        font-size: 0.91rem;
        font-weight: 600;
    }

    #mesa-modal #buscador-articulos::placeholder {
        color: #98a2b3;
        font-weight: 500;
    }

    #mesa-modal .search-icon {
        left: 12px;
        color: #667085;
        font-size: 0.95rem;
    }

    #mesa-modal .search-clear {
        right: 8px;
        width: 27px;
        height: 27px;
        border-radius: 9px;
        background: #eef2f6;
        color: #475569;
    }

    #mesa-modal .tag-button {
        width: 54px;
        height: 44px;
        border-radius: 13px;
        background: #ffffff;
        border: 1px solid rgba(148, 163, 184, 0.26);
        box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.46);
    }

    #mesa-modal .tag-button-label {
        display: none;
    }

    #mesa-modal .categorias-section {
        position: sticky;
        top: 62px;
        z-index: 36;
        padding: 9px 10px 7px;
        background: linear-gradient(180deg, rgba(245, 247, 250, 0.98), rgba(245, 247, 250, 0.9));
        border: 0;
    }

    #mesa-modal .categorias-container {
        display: flex;
        gap: 8px;
        padding: 0 0 4px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    #mesa-modal .categorias-container::-webkit-scrollbar {
        display: none;
    }

    #mesa-modal .category-button {
        flex: 0 0 auto;
        width: auto;
        min-width: 94px;
        max-width: 164px;
        min-height: 48px;
        height: 48px;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid rgba(148, 163, 184, 0.22);
        background: #ffffff;
        color: #344054;
        box-shadow: 0 12px 24px -22px rgba(15, 23, 42, 0.5);
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: 1fr 1fr;
        column-gap: 7px;
        row-gap: 0;
        align-items: center;
        justify-content: start;
        text-align: left;
        scroll-snap-align: start;
    }

    #mesa-modal .category-button .icon {
        display: inline-flex;
        grid-row: 1 / span 2;
        font-size: 0.95rem;
        margin: 0;
    }

    #mesa-modal .category-button .category-name,
    #mesa-modal .category-button .category-count {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #mesa-modal .category-button .category-name {
        font-size: 0.76rem;
        line-height: 1.05;
        font-weight: 800;
    }

    #mesa-modal .category-button .category-count {
        width: auto;
        height: auto;
        padding: 0;
        border: 0;
        background: transparent;
        color: #667085;
        font-size: 0.69rem;
        line-height: 1.05;
        font-weight: 800;
    }

    #mesa-modal .category-button.active {
        background: #204f4f;
        border-color: #204f4f;
        color: #ffffff;
        box-shadow: 0 14px 28px -20px rgba(32, 79, 79, 0.8);
    }

    #mesa-modal .category-button.active .category-count {
        color: rgba(255, 255, 255, 0.86);
    }

    #mesa-modal .articulos-section {
        flex: initial;
        padding: 9px 10px 12px;
        background: transparent;
    }

    #mesa-modal .articulos-container {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        max-height: none;
        min-height: 0;
        overflow: visible;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    #mesa-modal .articulo-btn {
        min-height: 118px;
        padding: 10px;
        border-radius: 12px;
        border: 1px solid rgba(148, 163, 184, 0.24);
        background: #ffffff;
        box-shadow: 0 12px 24px -22px rgba(15, 23, 42, 0.58);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: space-between;
        gap: 9px;
    }

    #mesa-modal .articulo-btn-leading {
        display: none;
    }

    #mesa-modal .articulo-btn-body {
        width: 100%;
        min-width: 0;
        gap: 4px;
        align-items: flex-start;
        text-align: left;
    }

    #mesa-modal .articulo-nombre {
        max-width: 100%;
        color: #111827;
        font-size: 0.85rem;
        font-weight: 800;
        line-height: 1.22;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    #mesa-modal .articulo-meta {
        color: #667085;
        font-size: 0.69rem;
        line-height: 1.2;
    }

    #mesa-modal .articulo-btn-side {
        width: 100%;
        min-width: 0;
        margin: auto 0 0;
        padding: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    #mesa-modal .articulo-btn-price {
        align-self: auto;
        padding: 4px 8px;
        border-radius: 999px;
        background: #e7eef0;
        color: #285b5b;
        font-size: 0.79rem;
        font-weight: 900;
    }

    #mesa-modal .articulo-add-control {
        width: 40px;
        height: 40px;
        border-radius: 11px;
        background: #204f4f;
        color: #ffffff;
        font-size: 1.13rem;
        font-weight: 900;
        box-shadow: 0 12px 22px -14px rgba(32, 79, 79, 0.8);
    }

    #mesa-modal .articulo-option-icon {
        top: 8px;
        right: 8px;
        border-radius: 8px;
        background: #f3f6f8;
        color: #667085;
        font-size: 0.68rem;
        opacity: 0.76;
        padding: 4px 6px;
    }

    #mesa-modal .modal-footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 126;
        display: block;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 -18px 38px -28px rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(16px);
    }

    #mesa-modal .mesa-mobile-tray {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 8px;
    }

    #mesa-modal .mesa-mobile-tray-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    #mesa-modal .mesa-mobile-order-title {
        min-width: 0;
        color: #111827;
        font-size: 0.82rem;
        font-weight: 900;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #mesa-modal .mesa-mobile-order-line {
        min-height: 22px;
        color: #475569;
        font-size: 0.78rem;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #mesa-modal .mesa-mobile-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(132px, 1fr);
        align-items: stretch;
        gap: 8px;
        margin-bottom: 8px;
    }

    #mesa-modal .mesa-mobile-bar-summary {
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 8px 10px;
        border-radius: 12px;
        background: #f8fafc;
        border: 1px solid rgba(148, 163, 184, 0.18);
    }

    #mesa-modal .mesa-mobile-bar-total {
        color: #111827;
        font-size: 1.05rem;
        line-height: 1.1;
        font-weight: 900;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #mesa-modal .mesa-mobile-bar-label,
    #mesa-modal .mesa-mobile-bar-items {
        color: #667085;
        font-size: 0.66rem;
        line-height: 1.1;
        font-weight: 800;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    #mesa-modal .modal-footer #btn-ver-pedido {
        display: none;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn {
        min-height: 48px;
        width: 100%;
        border-radius: 12px;
        border: 1px solid rgba(148, 163, 184, 0.18);
        padding: 0 14px;
        font-size: 0.88rem;
        font-weight: 900;
        justify-content: center;
        box-shadow: none;
    }

    #mesa-modal .modal-footer .mesa-mobile-bar-btn--primary {
        background: #52b978;
        border-color: #52b978;
        color: #ffffff;
        box-shadow: 0 14px 28px -20px rgba(34, 197, 94, 0.8);
    }

    #mesa-modal .mesa-mobile-quick-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    #mesa-modal .mesa-mobile-quick-btn {
        min-height: 42px;
        border: 0;
        border-radius: 11px;
        color: #ffffff;
        font-size: 0.8rem;
        font-weight: 900;
        letter-spacing: 0;
    }

    #mesa-modal .mesa-mobile-quick-btn--partial {
        background: #4f7fe8;
    }

    #mesa-modal .mesa-mobile-quick-btn--invoice {
        background: #eda638;
    }

    #mesa-modal .mesa-mobile-quick-btn--print {
        background: #747b88;
    }

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

    #mesa-modal .mesa-mobile-bar.is-updated .mesa-mobile-bar-total,
    #mesa-modal #pedido-count.is-updated,
    #mesa-modal #btn-ver-pedido.is-updated {
        animation: mesaMobilePulse 0.45s ease;
    }

    #mesa-modal .pedido-panel {
        height: min(86dvh, calc(100dvh - 58px));
        bottom: 0;
        border-radius: 18px 18px 0 0;
        background: #ffffff;
        box-shadow: 0 -18px 46px rgba(15, 23, 42, 0.24);
        transform: translateY(108%);
        transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #mesa-modal .pedido-panel.active {
        bottom: 0;
        transform: translateY(0);
    }

    #mesa-modal .pedido-panel-header {
        padding: 18px 14px 11px;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(10px);
    }

    #mesa-modal .pedido-panel-header h3 {
        color: #111827;
        font-size: 0.95rem;
        line-height: 1.15;
        font-weight: 900;
    }

    #mesa-modal #pedido-panel-summary-movil {
        margin: 4px 0 0;
        color: #667085;
        font-size: 0.76rem;
        font-weight: 700;
    }

    #mesa-modal .pedido-panel-close {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: #f1f5f9;
        color: #64748b;
        font-size: 1.25rem;
    }

    #mesa-modal .pedido-panel-body {
        padding: 12px;
        background: #f5f7fa;
    }

    #mesa-modal .pedido-panel-body .pedido-item {
        margin-bottom: 9px;
        padding: 11px;
        border-radius: 12px;
        border: 1px solid rgba(148, 163, 184, 0.22);
        background: #ffffff;
        box-shadow: 0 10px 24px -22px rgba(15, 23, 42, 0.5);
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-acciones {
        gap: 8px;
        margin-top: 8px;
        padding-top: 9px;
        border-top: 1px dashed rgba(148, 163, 184, 0.42);
    }

    #mesa-modal .pedido-panel-body .pedido-item .item-control,
    #mesa-modal .pedido-panel-body .pedido-item .btn-add-nota,
    #mesa-modal .pedido-panel-body .pedido-item .item-nota-icon {
        min-width: 42px;
        width: 42px;
        height: 42px;
        border-radius: 11px;
        font-weight: 900;
    }

    #mesa-modal .pedido-panel-footer {
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        background: rgba(255, 255, 255, 0.98);
    }

    #mesa-modal .pedido-panel-total {
        margin-bottom: 12px;
        color: #111827;
        font-size: 1.08rem;
        font-weight: 900;
    }

    #mesa-modal .pedido-panel-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    #mesa-modal .pedido-panel-actions button {
        min-height: 46px;
        border-radius: 11px;
        border: 0;
        font-size: 0.84rem;
        font-weight: 900;
    }

    #mesa-modal .pedido-panel-actions .btn-cobrar {
        grid-column: 1 / -1;
        background: #52b978;
    }

    #mesa-modal .pedido-panel-actions .btn-parcial {
        background: #4f7fe8;
    }

    #mesa-modal .pedido-panel-actions .btn-factura {
        background: #eda638;
    }

    #mesa-modal .pedido-panel-actions .btn-imprimir {
        background: #747b88;
    }

    body.mesa-panel-open #mesa-modal .modal-footer {
        opacity: 0;
        pointer-events: none;
        transform: translateY(18px);
    }

    body.mesa-panel-open #mesa-modal .modal-column-seleccion {
        opacity: 0.34;
        filter: blur(1px);
        pointer-events: none;
    }
}

@media (max-width: 420px) {
    #mesa-modal {
        --mesa-mobile-bar-height: 184px;
    }

    #mesa-modal .modal-header {
        padding-left: 12px;
        padding-right: 12px;
    }

    #mesa-modal .mesa-header-chip {
        max-width: 86px;
    }

    #mesa-modal .mesa-mobile-tabs,
    #mesa-modal .top-controls,
    #mesa-modal .categorias-section,
    #mesa-modal .articulos-section {
        padding-left: 10px;
        padding-right: 10px;
    }

    #mesa-modal .articulos-container {
        gap: 8px;
    }

    #mesa-modal .articulo-btn {
        min-height: 116px;
        padding: 9px;
    }

    #mesa-modal .articulo-nombre {
        font-size: 0.82rem;
    }
}

@media (min-width: 680px) and (max-width: 1024px) and (orientation: portrait) {
    #mesa-modal .articulos-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #mesa-modal .modal-footer {
        left: 50%;
        transform: translateX(-50%);
        width: min(100vw, 720px);
        border-radius: 18px 18px 0 0;
    }

    body.mesa-panel-open #mesa-modal .modal-footer {
        transform: translateX(-50%) translateY(18px);
    }
}
