:root {
    --primary: #1e293b;
    --accent: #ff8c00;
    --success: #10b981;
    --danger: #ef4444;
    --bg-light: #f4f7f6;
    --border: #e2e8f0;
    --text-main: #334155;
    --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
    height: 100vh;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow: hidden;
}

.tpv-container { display: flex; height: 100vh; width: 100vw; }

/* --- PANEL TICKET --- */
.ticket-panel {
    width: 380px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.customer-selected-card {
    padding: 15px;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border);
}

.customer-selector-wrapper {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    gap: 10px;
}

.customer-selector-wrapper i {
    color: var(--accent);
    font-size: 2rem;
}

.customer-selector-wrapper select {
    border: none;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    background: transparent;
    cursor: pointer;
}

.customer-data-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.75rem;
    color: #64748b;
}

.panel-header { padding: 20px; background: var(--primary); color: var(--white); display: flex; justify-content: space-between; align-items: center; }
.ticket-content { flex: 1; overflow-y: auto; padding: 15px; }
.ticket-item { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--bg-light); font-size: 0.95rem; cursor: pointer; }
.item-qty { font-weight: bold; color: var(--accent); margin: 0 8px; cursor: cell; min-width: 20px; display: inline-block; text-align: center; }
.empty-state { text-align: center; color: #94a3b8; margin-top: 40px; }

.panel-footer { padding: 20px; background: var(--bg-light); border-top: 1px solid var(--border); }
.total-section { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-weight: 800; font-size: 1.4rem; }
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-pay { border: none; padding: 15px; border-radius: 12px; color: white; font-weight: bold; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.action-buttons .btn-pay {
    min-width: 0;
    font-size: 0.82rem;
    line-height: 1.1;
}
.btn-cash { background-color: var(--success); }
.btn-card { background-color: #3b82f6; }

.btn-split-pay {
    background-color: #393f71;
}

.ticket-item.is-paid {
    opacity: 0.55;
    background: #ecfdf5 !important;
    text-decoration: line-through;
}

.ticket-item.is-paid::after {
    content: "COBRADO";
    align-self: center;
    color: #047857;
    font-size: 0.7rem;
    font-weight: 900;
    margin-left: 8px;
}

.split-pay-modal {
    max-width: 720px;
    width: min(92vw, 720px);
    padding: 20px;
}

.split-pay-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.split-pay-header h3 {
    margin: 0;
    color: #1f2937;
}

.split-pay-header p {
    margin: 6px 0 0;
    color: #64748b;
    font-weight: 600;
}

.split-pay-close {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: #eef2f7;
    color: #334155;
    font-size: 1.1rem;
    cursor: pointer;
}

.split-pay-ticket {
    display: grid;
    gap: 8px;
    max-height: min(48vh, 430px);
    overflow-y: auto;
    padding-right: 4px;
}

.split-pay-row {
    width: 100%;
    min-height: 74px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 98px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
}

.split-pay-row.is-extra {
    margin-left: 18px;
    width: calc(100% - 18px);
    background: #f8fafc;
}

.split-pay-row.is-selected {
    border-color: #393f71;
    background: #eef0ff;
}

.split-pay-row.is-paid {
    opacity: 0.55;
    background: #ecfdf5;
    border-color: #10b981;
    cursor: not-allowed;
}

.split-pay-row.is-paid .split-pay-main strong::after {
    content: "COBRADO";
    display: inline-block;
    margin-left: 8px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #10b981;
    color: #ffffff;
    font-size: 0.62rem;
    vertical-align: middle;
}

.split-pay-row.is-paid .split-pay-controls button {
    background: #94a3b8;
    cursor: not-allowed;
}

.split-pay-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.split-pay-main strong {
    color: #1f2937;
    font-size: 1rem;
    line-height: 1.2;
}

.split-pay-main span {
    color: #64748b;
    font-weight: 700;
}

.split-pay-controls {
    display: inline-grid;
    grid-template-columns: 46px 42px 46px;
    align-items: center;
    gap: 6px;
}

.split-pay-controls button {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: #1f2937;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
}

.split-pay-controls span {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 900;
    color: #393f71;
}

.split-pay-line-total {
    display: grid;
    gap: 2px;
    text-align: right;
}

.split-pay-line-total span {
    font-size: 1.05rem;
    font-weight: 900;
    color: #111827;
}

.split-pay-line-total small {
    color: #64748b;
    font-weight: 700;
}

.split-pay-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.split-pay-summary > div {
    border-radius: 12px;
    background: #f1f5f9;
    padding: 14px;
    display: grid;
    gap: 4px;
}

.split-pay-summary span {
    color: #64748b;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.split-pay-summary strong {
    color: #111827;
    font-size: 1.6rem;
}

.split-pay-summary > div:first-child {
    background: #393f71;
}

.split-pay-summary > div:first-child span,
.split-pay-summary > div:first-child strong {
    color: #ffffff;
}

.split-pay-actions {
    display: grid;
    grid-template-columns: 0.9fr 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.split-pay-actions button {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.split-pay-actions .split-pay-cash {
    background: #10b981;
}

.split-pay-actions .split-pay-card {
    background: #3b82f6;
}

/* --- PANEL CATALOGO --- */
.catalog-panel { flex: 1; display: flex; flex-direction: column; padding: 5px; }

.tpv-top-menu {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: var(--primary);
    align-items: center;
    border-radius: 8px;
    
    /* 🌟 SOLUCIÓN PARA QUE NO SE LLEVE POR DELANTE LOS BOTONES: */
    flex-shrink: 0;       /* Impide que el menú superior se aplaste verticalmente */
    overflow-x: auto;     /* Si los botones no caben a lo ancho, permite scroll horizontal con el dedo */
    white-space: nowrap;  /* Fuerza a que los botones se mantengan siempre en una sola línea */
    
    /* Opcional: Oculta la barra de scroll de los navegadores para que quede limpio */
    scrollbar-width: none; 
}

.tpv-top-menu::-webkit-scrollbar {
    display: none; /* Oculta el scroll en Chrome, Safari y Capacitor (Android/iOS) */
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border: none;
    border-radius: 8px !important;
    cursor: pointer;
    transition: background 0.2s;

    /* 🌟 EL BLINDAJE ANTI-DEFORMACIÓN: */
    flex-shrink: 0;       /* Prohibido encogerse o estirarse pase lo que pase abajo */
    
    /* 🌟 DIMENSIONES FIJAS RECOMENDADAS PARA TPV/TABLET: */
    width: 85px;          /* Sustituye al min-width para que midan EXACTAMENTE lo mismo */
    height: 65px;         /* Altura fija ideal para alojar el icono y el texto en vertical */
    padding: 5px;         /* Un padding controlado para que no desborde el texto */
}

/* 🌟 EXTRA RECOMENDADO POR SI EL TEXTO DEL BOTÓN ES LARGO: */
.menu-item span {
    font-size: 0.75rem;   /* Tamaño de fuente cómodo para leer en TPV */
    font-weight: 600;
    margin-top: 4px;      /* Separación del icono */
    white-space: nowrap;  /* Evita que el texto salte a dos líneas y deforme el botón */
    overflow: hidden;     /* Recorta si se pasa */
    text-overflow: ellipsis; /* Añade los "..." si el nombre es demasiado largo */
    width: 100%;          /* Asegura que use el ancho del botón */
    text-align: center;
}

.menu-item i {
    font-size: 1.2rem;    /* Tamaño estático para el icono de Font-Awesome */
}

.menu-item:hover { background: rgba(255,255,255,0.2); }
.menu-item i { font-size: 1.2rem; margin-bottom: 4px; }
.menu-item span { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }

.notification-item { position: relative; }
.badge-count {
    /* 🌟 ELIMINAMOS EL FONDO Y EL CIRCULO */
    position: static;          /* Ya no flota en la esquina, se coloca abajo en el flujo */
    background: none !important; /* Quitamos el fondo naranja */
    box-shadow: none !important; /* Sin sombras de círculo */
    border-radius: 0 !important; /* Quitamos la forma redonda */
    min-width: auto;
    height: auto;
    padding: 0;
    
    /* 🌟 ESTILO DE TEXTO INTEGRADO ABAJO */
    display: block;            /* Se comporta como una línea de texto nueva */
    color: white ;      
    font-size: 0.75rem;        /* Un tamaño sutil y limpio */
    font-weight: bold;
    margin-top: 2px;           /* Separación respecto al texto de "Delivery" */
    text-align: center;
    width: 100%;
}

/* Nueva zona de notas */
#order-notes-container {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.02);
}

.catalog-header { display: flex; gap: 15px; margin-bottom: 10px; margin-top: 10px;}
.search-bar { flex: 1; background: var(--white); border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; padding: 0 15px; }
.search-bar input { border: none; padding: 12px; width: 100%; outline: none; font-size: 1rem; }
.btn-exit { padding: 10px 20px; border-radius: 12px; border: 1px solid var(--border); background: var(--white); cursor: pointer; font-weight: 600; }

/* Asegura que el contenedor de categorías mantenga su altura pase lo que pase abajo */
.categories-nav {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    height: 60px; /* Forzamos una altura fija para que no baile */
    align-items: center;
    flex-shrink: 0; /* Evita que el panel de productos la aplaste */
}

.categories-scroll {
    display: flex;
    flex: 1 1 auto;
    width: 0;
    gap: 10px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    align-items: center;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: pan-x;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.cat-pill-fixed {
    flex-shrink: 0;
}

.cat-arrow {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}

.cat-arrow:hover {
    background: #111827;
    transform: translateY(-1px);
}

.cat-arrow:active {
    transform: translateY(0);
}

.cat-arrow:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
}

.cat-arrow-left {
    order: 2;
}

.categories-scroll {
    order: 3;
}

.cat-arrow-right {
    order: 4;
    margin-left: auto;
}

/* Fuerza a que las píldoras mantengan su tamaño visual idéntico siempre */
.cat-pill {
    display: inline-block;
    padding: 16px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Crucial: impide que el navegador altere su ancho/alto */
    height: 55px;   /* Altura fija para la pill */
    line-height: 20px;
}

.cat-pill.active {
    background: var(--primary);
    color: var(--white);
}
.product-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
    gap: 15px; 
    overflow-y: auto; 
    padding-top: 10px;
    flex-grow: 1;       /* Hace que el grid se estire para ocupar el alto restante */
    min-height: 0;      /* Crucial en flexbox para que respete el contenedor y active el scroll */
}

.product-grid.delivery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
    padding: 10px 6px 12px;
    align-content: start;
    overflow-x: hidden;
}

.delivery-toolbar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px 150px auto auto;
    gap: 10px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}

.delivery-search {
    position: relative;
    min-width: 0;
}

.delivery-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

.delivery-search input {
    width: 100%;
    height: 42px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 12px 0 36px;
    font-size: 0.95rem;
    outline: none;
    background: #f8fafc;
    color: #1f2937;
}

.delivery-search input:focus {
    border-color: #3b82f6;
    background: #ffffff;
}

.delivery-date-button {
    width: 100%;
    height: 54px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    padding: 7px 10px;
    background: #f8fafc;
    color: #1f2937;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    cursor: pointer;
    text-align: left;
    touch-action: manipulation;
}

.delivery-date-button small {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.delivery-date-button strong {
    font-size: 1rem;
    line-height: 1.1;
}

.delivery-date-button.is-active {
    border-color: #2563eb;
    background: #eaf3ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.delivery-date-panel {
    grid-column: 1 / -1;
    background: #ffffff;
    border: 1px solid #cfe0f5;
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.delivery-date-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    grid-column: 1 / -1;
}

.delivery-date-panel-head strong {
    font-size: 1rem;
    color: #14213d;
}

.delivery-date-panel-head button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: #eaf3ff;
    color: #2563eb;
    font-size: 1.05rem;
}

.delivery-date-selectors {
    display: grid;
    grid-template-columns: 94px minmax(150px, 1fr) 112px;
    gap: 10px;
}

.delivery-date-selectors label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.delivery-date-selectors select {
    height: 58px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #f8fafc;
    color: #111827;
    font-size: 1.12rem;
    font-weight: 800;
    padding: 0 12px;
}

.delivery-date-quick {
    display: grid;
    grid-template-columns: repeat(4, minmax(74px, 1fr));
    gap: 8px;
}

.delivery-date-quick button {
    height: 58px;
    border: none;
    border-radius: 10px;
    background: #14213d;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
}

.delivery-history-btn {
    height: 54px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 8px;
    background: #2c3e50;
    color: #ffffff;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.delivery-history-btn.is-open {
    background: #17a2b8;
}

.delivery-auto-print {
    height: 54px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 12px;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.delivery-auto-print input {
    width: 18px;
    height: 18px;
    margin: 0 8px 0 0;
    accent-color: #16a34a;
}

.fichaje-report-panel {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    text-align: left;
}

.fichaje-report-dates {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    margin-top: 10px;
}

.fichaje-report-dates label {
    display: grid;
    gap: 4px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
}

.fichaje-report-dates input,
.fichaje-report-dates button {
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px;
}

.fichaje-report-dates button {
    border: none;
    background: #2c3e50;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.delivery-history-panel {
    min-width: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    max-height: 460px;
    overflow-y: auto;
}

.delivery-history-layout {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(270px, .85fr);
    gap: 12px;
    min-width: 0;
    align-items: stretch;
}

.delivery-history-list-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.delivery-history-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 6px 8px;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 9px;
}

.delivery-history-actions-label {
    flex: 1;
    min-width: 0;
    color: #64748b;
    font-size: .78rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delivery-history-action-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 0 10px;
    background: #fff;
    color: #334155;
    font-size: .76rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.delivery-history-action-button.generate { color: #0f766e; }
.delivery-history-action-button.whatsapp { color: #15803d; }
.delivery-history-action-button:disabled { color: #94a3b8; background: #eef2f7; cursor: not-allowed; opacity: .8; }

.delivery-history-row {
    display: grid;
    grid-template-columns: minmax(105px, auto) minmax(120px, 1fr) 92px 68px;
    gap: 10px;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.85rem;
    color: #334155;
    cursor: default;
    user-select: none;
}

.delivery-history-pending {
    color: #b45309;
    font-size: .76rem;
    white-space: nowrap;
}

.delivery-history-row:last-child {
    border-bottom: none;
}

.delivery-history-row:hover,
.delivery-history-row.is-selected {
    background: #f1f8ff;
}

.delivery-history-row strong,
.delivery-history-row b {
    color: #1f2937;
}

.delivery-history-row time {
    color: #64748b;
}

.delivery-history-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
}

.delivery-history-preview {
    min-width: 0;
    min-height: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}

.delivery-history-preview.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 118px;
    color: #94a3b8;
    text-align: center;
    font-size: 0.85rem;
}

.delivery-history-preview.empty i {
    font-size: 1.4rem;
}

.delivery-preview-header,
.delivery-preview-total {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.delivery-preview-header span,
.delivery-preview-total time {
    color: #64748b;
    font-size: 0.82rem;
}

.delivery-preview-client {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
    font-size: 0.84rem;
}

.delivery-preview-client b {
    color: #1f2937;
}

.delivery-preview-client span {
    color: #475569;
}

.delivery-preview-items {
    display: grid;
    gap: 4px;
    min-height: 30px;
    margin-bottom: 10px;
    color: #334155;
    font-size: 0.86rem;
}

.delivery-preview-total {
    border-top: 1px solid #eee;
    border-bottom: none;
    padding-top: 8px;
    padding-bottom: 0;
    margin-top: auto;
    margin-bottom: 0;
    align-items: center;
}

.delivery-preview-total strong {
    color: #22c55e;
    font-size: 1.08rem;
}

.delivery-grid .comanda-card {
    min-width: 0;
    padding: 12px !important;
    border-radius: 10px !important;
}

.delivery-grid .comanda-card button,
.delivery-grid .comanda-card a {
    min-width: 0;
    font-size: 0.78rem;
}

.delivery-empty-state {
    grid-column: 1 / -1 !important;
}
.product-card { 
    background: var(--white); 
    border-radius: 15px; 
    text-align: center; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
    cursor: pointer; 
    transition: transform 0.1s; 
    position: relative; 
    overflow: hidden; 
    padding: 0;
    height: 150px;
}
.product-card:active { transform: scale(0.95); }
.product-img-placeholder { height: 100%; background: #eee; border-radius: 0; margin-bottom: 0; overflow: hidden; }
.product-info {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.75);
    padding: 2px;
    z-index: 2;
    pointer-events: none;
    border-radius: 10px;
    border: 2px solid rgba(0,222,0,0.3);
}
.p-name { display: block; font-weight: 700; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); }
.p-price { color: var(--success); font-weight: bold; }

/* --- LOGIN --- */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #f4f7f6;
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

.login-card {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    width: 90%; max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.input-group { position: relative; margin-bottom: 15px; }
.input-group input { width: 100%; padding: 12px 40px 12px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; }
.input-group select { width: 100%; padding: 12px 40px 12px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; background-color: var(--white); appearance: none; /* Oculta la flecha nativa */ }
.input-group .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.btn-login { width: 100%; padding: 12px; background-color: var(--accent); border: none; color: white; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* --- LOGIN EXTRAS & FOOTER --- */
.login-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #64748b;
}
.remember-me { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.forgot-link { color: var(--accent); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }

.login-footer-links {
    margin-top: 25px;
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}
.login-footer-links a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* --- ESTILOS PIN LOGIN (Acceso Rápido) --- */
.pin-display {
    width: 100%;
    padding: 15px;
    font-size: 2.5rem;
    text-align: center;
    letter-spacing: 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    background: var(--bg-light);
    color: var(--primary);
}

.btn-link {
    background: none; border: none; color: #64748b;
    text-decoration: underline; margin-top: 15px; cursor: pointer;
}

/* --- INDICADORES DE ESTADO --- */
.status-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}
.status-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    background: #94a3b8; /* Color neutro por defecto */
    transition: background 0.4s ease;
}

/* --- RESPONSIVE OPTIMIZATION PARA TABLET 10" (Landscape & Portrait) --- */

@media (min-width: 769px) and (max-width: 1024px) {
    .ticket-panel {
        width: 320px; /* Reducimos el ancho del ticket para ganar espacio en el catálogo */
    }
    .customer-data-grid {
        grid-template-columns: 1fr; /* Apilamos datos de cliente si el ancho es justo */
    }
    .menu-item {
        min-width: 70px;
        padding: 6px;
    }
    .menu-item i { font-size: 1rem; }
    .menu-item span { font-size: 0.6rem; }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    .tpv-container { flex-direction: column; }
    .ticket-panel { width: 100%; height: 45vh; border-right: none; border-bottom: 1px solid var(--border); }
    .catalog-panel { height: 55vh; padding: 10px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .product-grid.delivery-grid { grid-template-columns: 1fr !important; }
    .delivery-toolbar { grid-template-columns: 1fr; }
    .delivery-history-layout { grid-template-columns: 1fr; }
    .delivery-history-panel,
    .delivery-history-preview { grid-column: 1 / -1; }
    .delivery-history-actions-bar { flex-wrap: wrap; }
    .delivery-history-actions-label { flex-basis: 100%; }
    .delivery-history-row { grid-template-columns: minmax(105px, auto) 1fr; }
    .delivery-history-row time,
    .delivery-history-row b { display: none; }
    .tpv-top-menu { margin-bottom: 10px; padding: 5px; }

    .split-pay-modal {
        width: 94vw;
        padding: 14px;
    }

    .split-pay-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .split-pay-controls {
        grid-template-columns: 52px 1fr 52px;
    }

    .split-pay-controls button {
        width: 52px;
        height: 48px;
    }

    .split-pay-line-total {
        text-align: left;
    }

    .split-pay-summary {
        grid-template-columns: 1fr;
    }

    .split-pay-actions {
        grid-template-columns: 1fr 1fr;
    }

    .split-pay-actions .btn-cancel {
        grid-column: 1 / -1;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none; /* Se cambia a flex por JS */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 420px; /* Tamaño aproximado de los dos primeros botones del menú */
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.delivery-invoice-modal {
    width: min(92vw, 560px);
}
.delivery-invoice-modal h3 { margin: 0 0 1.25rem; color: var(--text-main); }
.delivery-invoice-modal form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.delivery-invoice-modal .fiscal-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.delivery-invoice-modal .fiscal-field-wide { grid-column: 1 / -1; }
.delivery-invoice-modal label { font-weight: 600; color: var(--text-main); font-size: .9rem; }
.delivery-invoice-modal input { width: 100%; box-sizing: border-box; padding: .7rem .75rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.delivery-invoice-modal [data-error] { grid-column: 1 / -1; margin: 0; color: #b91c1c; }
.delivery-invoice-modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .65rem; margin-top: .35rem; }
.delivery-invoice-modal-actions button { min-width: 120px; }
@media (max-width: 520px) {
    .delivery-invoice-modal form { grid-template-columns: 1fr; }
    .delivery-invoice-modal .fiscal-field-wide { grid-column: auto; }
    .delivery-invoice-modal-actions { flex-direction: column-reverse; }
    .delivery-invoice-modal-actions button { width: 100%; }
}

.waiter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas para que quepa bien en el modal estrecho */
    gap: 15px;
    margin-top: 20px;
}

.waiter-card {
    cursor: pointer;
    padding: 8px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: var(--text-main);
    min-width: 0;
    text-align: center;
    background: #fff;
}

.waiter-card span {
    display: block;
    font-weight: 600;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waiter-card small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waiter-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 8px 10px;
    border-style: dashed;
    background: #f8fafc;
    text-align: left;
}

.waiter-action-card .waiter-img-container {
    width: 32px;
    height: 32px;
    margin: 0;
    border-width: 2px;
}

.waiter-action-card i {
    font-size: 1rem;
}

.waiter-action-add {
    border-color: #22c55e;
    color: #15803d;
}

.waiter-action-edit {
    border-color: #94a3b8;
    color: #475569;
}

/* Estilos para las imágenes de los camareros */
.waiter-img-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 3px solid var(--border);
}

.waiter-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.waiter-edit-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
}

.waiter-edit-main {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.waiter-edit-card .waiter-img-container {
    width: 72px;
    height: 72px;
    margin: 0;
    cursor: pointer;
    position: relative;
}

.waiter-edit-card .waiter-img-container::after {
    content: "Cambiar";
    position: absolute;
    inset: auto 0 0 0;
    padding: 3px 0;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    text-align: center;
    opacity: 0;
    transition: opacity .2s ease;
}

.waiter-edit-card .waiter-img-container:hover::after {
    opacity: 1;
}

.waiter-edit-fields {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.waiter-edit-fields input[type="text"],
.waiter-edit-fields input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    font-size: 0.95rem;
}

.waiter-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.waiter-edit-file {
    display: none;
}

.waiter-toggle-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.waiter-edit-save {
    flex: 0 0 auto;
    min-width: 96px;
    padding: 10px 14px;
}

.waiter-edit-delete {
    flex: 0 0 auto;
    width: 42px;
    min-width: 42px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border: none;
}

.waiter-edit-card .toggle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.waiter-edit-card .toggle-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.waiter-edit-card .soft-switch {
    width: 75px;
    height: 32px;
    background: #e0e0e0;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 5px 5px 10px #bebebe, inset -5px -5px 10px #ffffff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    overflow: hidden;
    border: none;
    outline: none;
}

.waiter-edit-card .soft-switch.on {
    background: #0db686;
    box-shadow: inset 4px 4px 8px #009475, inset -4px -4px 8px #00dbb6;
}

.waiter-edit-card .switch-text {
    font-size: 10px;
    font-weight: 900;
    color: rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 1;
}

.waiter-edit-card .soft-switch .text-on { opacity: 0; }
.waiter-edit-card .soft-switch.on .text-on { opacity: 1; color: rgba(255,255,255,0.4); }
.waiter-edit-card .soft-switch.on .text-off { opacity: 0; }

.waiter-edit-card .switch-thumb {
    width: 24px;
    height: 24px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    left: 4px;
    top: 4px;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 3px 3px 6px #b1b1b1, -3px -3px 6px #ffffff;
    z-index: 2;
}

.waiter-edit-card .soft-switch.on .switch-thumb {
    transform: translateX(43px);
    box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
}

@media (max-width: 560px) {
    .waiter-edit-actions {
        justify-content: stretch;
    }

    .waiter-toggle-row {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .waiter-edit-card .soft-switch {
        width: 68px;
    }

    .waiter-edit-card .soft-switch.on .switch-thumb {
        transform: translateX(36px);
    }

    .waiter-edit-save {
        min-width: 86px;
        padding: 10px 12px;
    }

    .waiter-edit-delete {
        width: 38px;
        min-width: 38px;
    }
}

/* Estilos para el PIN y Numpad */
#waiter-pin-input {
    width: 100%;
    padding: 15px;
    font-size: 1.8rem;
    text-align: center;
    letter-spacing: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    margin: 15px 0;
    background: var(--bg-light);
    color: var(--primary);
}

#selected-waiter-info {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.numpad button {
    padding: 18px;
    font-size: 1.4rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.numpad button:active {
    background: #e2e8f0;
    transform: scale(0.95);
}

.numpad .btn-clear { color: var(--danger); }
.numpad .btn-delete { color: var(--text-main); }

.btn-confirm-pin { width: 100%; padding: 18px; background: var(--success); color: white; border: none; border-radius: 12px; font-weight: 800; font-size: 1.1rem; cursor: pointer; margin-bottom: 10px; text-transform: uppercase; }
.btn-confirm-pin:active { transform: scale(0.98); background: #0da371; }

.bootstrap-admin-form { background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 10px 28px rgba(15, 23, 42, .08); }
.bootstrap-admin-form h3 { color: var(--text-main); margin-bottom: 8px; }
.bootstrap-admin-form input { width: 100%; box-sizing: border-box; padding: 13px 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #1e293b; font: inherit; outline: none; transition: border-color .2s, box-shadow .2s; }
.bootstrap-admin-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 135, 226, .14); }
.bootstrap-admin-form .btn-cancel, .bootstrap-admin-form .btn-confirm { min-height: 46px; border-radius: 10px; }

.btn-confirm { padding: 14px; background: var(--success); color: white; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; text-transform: uppercase; }
.btn-confirm:active { transform: scale(0.98); background: #0da371; }

.btn-cancel { padding: 14px; background: #94a3b8; color: white; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; text-transform: uppercase; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.modal-actions button {
    flex: 1;
}

/* Botón + Extras en Ticket */
.btn-add-extra-label {
    background: var(--success);
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    text-transform: uppercase;
    transition: background 0.2s;
}

.btn-add-extra-label:hover {
    background: #0d9488;
}

/* Modal Extras Styling */
.extras-modal h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
    color: var(--primary);
}

.extras-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.extra-option {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.extra-option:hover {
    border-color: var(--accent);
    background: #fff;
}

.extra-option.active {
    background: #f0fdf4;
    border-color: var(--success);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.extra-option:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.35);
    outline-offset: 2px;
}

.extra-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    text-align: center;
}

.extra-price {
    font-weight: 700;
    color: var(--success);
    font-size: 0.85rem;
}

/* --- SISTEMA DE MESAS (Plano y Rejilla) --- */

/* Estilo base de los elementos del plano */
.element-item {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.table-item {
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    flex-direction: column;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 80px;
    height: 80px;
}

.table-item i { font-size: 1.4rem; color: #64748b; margin-bottom: 4px; }
.table-item span { font-weight: 700; font-size: 0.85rem; }
.table-item .capacity { font-size: 0.65rem; color: #94a3b8; }

/* Mesas Ocupadas (Rojo como en el móvil) */
.table-item.busy {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
}
.table-item.busy i { color: #ef4444 !important; }

.wall-item { background: #64748b; border-radius: 4px; height: 10px; }

/* Modo Rejilla Ordenada (Grid) */
#world.grid-view-active {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 20px !important;
    padding: 20px !important;
    transform: none !important; /* Desactiva zoom/pan visualmente */
    width: 100% !important;
    height: 100% !important;
    top: 0 !important; left: 0 !important;
    overflow-y: auto !important;
}

#world.grid-view-active .grid-background {
    display: none !important;
}

#world.grid-view-active .element-item {
    position: relative !important; left: auto !important; top: auto !important;
    transform: none !important; margin: 0 auto !important;
    width: 110px !important; height: 110px !important;
}

/* Controles de Zoom para Mesas */
.mesas-zoom-controls {
    display: flex;
    gap: 5px;
}

.zoom-btn {
    width: 45px;
    height: 45px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--primary);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mesas-overlay-ui {
    position: relative;
    top: 0; left: 0; transform: none;
    z-index: 10;
    width: 100%;
    padding: 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.mesas-overlay-ui * {
    pointer-events: auto; /* Reactivar eventos para los controles */
}

.mesas-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.9);
    padding: 8px 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    gap: 10px;
}

.mesas-zoom-controls {
    display: flex;
    gap: 8px;
}

.mesas-control-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.mesas-control-btn:hover {
    background: var(--bg-light);
}

/* Ocultamos la leyenda */
.status-legend {
    display: none;
}

.mesas-overlay-ui button, .mesas-overlay-ui .status-legend {
    pointer-events: auto;
}

.status-legend {
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Estilos Informe Z */
.cierre-ticket { font-family: 'Courier New', Courier, monospace; color: #000; padding: 10px; background: #fff; }
.cierre-header { text-align: center; font-weight: bold; border-bottom: 1px dashed #000; padding-bottom: 10px; margin-bottom: 10px; }
.cierre-seccion { margin-bottom: 15px; }
.cierre-subtitulo { font-weight: bold; text-decoration: underline; margin-bottom: 5px; font-size: 0.9rem; }
.cierre-fila { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 3px; }
.cierre-total { border-top: 1px solid #000; margin-top: 8px; padding-top: 5px; display: flex; justify-content: space-between; font-weight: bold; font-size: 1.1rem; }

/* Estilo para selectores de fecha */
input[type="date"].waiter-pin-input {
    letter-spacing: normal !important;
    font-size: 1.1rem !important;
    text-align: left;
    padding: 12px 15px;
    border: 2px solid var(--border);
    background-color: var(--white);
    color: var(--primary);
    cursor: pointer;
}

/* Reglas de impresión */
@media print {
    #modal-reporte-view .modal-actions {
        display: none !important;
    }
}

.btn-action-small {
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.btn-action-mini {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    transition: transform 0.1s;
}
.btn-action-mini:hover { transform: scale(1.2); }

/* NUEVO: Contenedor oscuro para la vista PDA */
/* Toggle PDA Mode */
.pda-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #151c25;
    color: white;
    border-bottom: 1px solid #334155;
}

.pda-header-container h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.15;
}

.pda-mode-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 4px;
    font-size: 0.78rem;
    font-weight: bold;
    background: #1e293b;
    padding: 4px 12px;
    border-radius: 50px;
    border: 1px solid #334155;
}

.print-width-setting {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.print-width-setting-label {
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
}

/* Ajustes de colores para el switch en fondo oscuro */
.pda-mode-switch .slider {
    background-color: #475569;
}


#pda-comandas-view {
    background: #1b2530  !important; /* Slate muy oscuro */
}

#pda-comandas-list {
    padding: 14px 18px !important;
}

/* PDA Comanda Card */
.pda-comanda-card {
    background: #1e293b; /* Slate oscuro */
    border-radius: 9px;
    border: 1px solid #334155;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.24);
    overflow: hidden;
}

.pda-comanda-card .comanda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #151c25;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: bold;
    border-bottom: 2px solid #334155;
}

.pda-comanda-card .comanda-header span {
    font-size: 0.9em;
    font-weight: normal;
    opacity: 0.8;
}

.pda-comanda-notes {
    margin: 10px 12px;
    padding: 10px 12px;
    border: 2px dashed #f59e0b;
    border-radius: 10px;
    background: #243044;
    color: #fef3c7;
}

.pda-comanda-notes-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    color: #fbbf24;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pda-comanda-notes-text {
    color: #fff7ed;
    font-size: 0.95rem;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

.pda-comanda-card .comanda-items {
    padding: 0;
}

.pda-comanda-card .comanda-item-row {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 8px 14px;
    border-bottom: 1px solid #334155;
    font-size: 0.98rem;
    background-color: #1e293b;
    color: #f1f5f9;
    transition: transform 0.2s ease-out;
    position: relative;
    z-index: 1;
}

.pda-comanda-card .comanda-item-row:nth-child(odd) {
    background-color: #334155;
}

.pda-comanda-card .comanda-item-row.is-extra {
    min-height: 46px;
    margin-left: 34px;
    padding-left: 12px;
    background: #162235;
    border-left: 4px solid #f59e0b;
    border-bottom-color: #243044;
    font-size: 0.9rem;
}

.pda-comanda-card .comanda-item-row.is-extra:nth-child(odd) {
    background: #1b2a40;
}

.pda-comanda-card .comanda-item-row.is-extra .item-qty {
    color: #fbbf24;
    min-width: 48px;
}

.pda-comanda-card .comanda-item-row.is-extra .item-name {
    color: #fde68a;
}

.pda-comanda-card .comanda-item-row.is-extra .item-name i {
    transform: rotate(90deg);
    margin-right: 8px;
    font-size: 0.78rem;
    opacity: 0.9;
}

.pda-comanda-card .item-qty {
    font-weight: bold;
    color: #fb923c; /* Naranja para resaltar */
    margin-right: 10px;
    min-width: 62px;
    text-align: center;
    font-size: 1rem;
}

.pda-comanda-card .item-name {
    flex-grow: 1;
    color: #f1f5f9;
    font-size: 0.98rem;
}

.pda-comanda-card .btn-check-item {
    background: #3f7e6d;
    color: white;
    border: none;
    border-radius: 8px;
    min-width: 72px;
    height: 44px;
    padding: 8px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-left: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 2;
}

/* --- MODO COMPACTO TPV 15" 1024x768 --- */
@media (min-width: 769px) and (max-width: 1100px) and (max-height: 850px) {
    .tpv-container {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }

    .ticket-panel {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }

    .panel-header {
        padding: 8px 10px;
        gap: 6px;
        min-height: 52px;
    }

    .panel-header h2 {
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .ticket-actions {
        gap: 4px;
        flex-shrink: 0;
    }

    .ticket-actions .btn-icon-only,
    .ticket-actions .btn-qty {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        margin-right: 0 !important;
        border-radius: 7px !important;
        font-size: 0.95rem !important;
        padding: 0 !important;
    }

    .customer-selected-card {
        padding: 7px 9px;
    }

    .customer-selector-wrapper {
        min-height: 38px;
        padding: 4px 8px;
        gap: 6px;
        border-radius: 8px;
    }

    .customer-selector-wrapper i {
        font-size: 1.35rem;
    }

    .customer-selector-wrapper select {
        font-size: 0.82rem;
    }

    .customer-data-grid {
        margin-top: 5px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 2px 8px;
        font-size: 0.67rem;
        line-height: 1.2;
    }

    .customer-data-grid > div {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ticket-content {
        padding: 8px 10px;
        min-height: 0;
    }

    .ticket-item {
        gap: 6px;
        padding: 8px 0 !important;
        font-size: 0.82rem !important;
        align-items: center;
    }

    .ticket-item .item-info {
        min-width: 0;
        flex: 1 1 auto;
    }

    .ticket-item .qty-controls {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-bottom: 2px;
    }

    .ticket-item .btn-qty {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        font-size: 1.05rem !important;
        line-height: 1 !important;
    }

    .ticket-item .item-name {
        display: block;
        max-width: 150px;
        margin-left: 0 !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ticket-item .item-price {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .ticket-item button[onclick^="TPV.removeItemByLineId"] {
        width: 28px;
        height: 28px;
        padding: 0 !important;
        font-size: 0.95rem !important;
        flex-shrink: 0;
    }

    .panel-footer {
        padding: 8px 10px 10px;
    }

    .total-section {
        margin-bottom: 7px;
        font-size: 1.12rem;
    }

    .action-buttons {
        gap: 6px !important;
    }

    .btn-pay {
        min-height: 46px;
        padding: 7px 5px !important;
        border-radius: 8px;
        font-size: 0.78rem;
        gap: 3px;
    }

    .btn-pay i {
        font-size: 0.95rem;
    }

    .btn-close-no-pay {
        padding: 9px !important;
        border-radius: 7px !important;
        font-size: 0.78rem;
    }

    .catalog-panel {
        min-width: 0;
        padding: 3px;
        overflow: hidden;
    }

    .tpv-top-menu {
        gap: 6px;
        padding: 6px 8px;
        border-radius: 7px;
        overflow: hidden;
    }

    .menu-item {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: 50px;
        padding: 4px;
        border-radius: 7px !important;
    }

    .menu-item i {
        font-size: 1rem;
        margin-bottom: 2px;
    }

    .menu-item span {
        font-size: 0.58rem;
        margin-top: 1px;
    }

    .badge-count {
        font-size: 0.62rem;
        line-height: 1;
        margin-top: 1px;
    }

    .catalog-header {
        gap: 8px;
        margin: 6px 0;
    }

    .search-bar {
        min-height: 40px;
        padding: 0 10px;
        border-radius: 9px;
    }

    .search-bar input {
        padding: 9px;
        font-size: 0.9rem;
    }

    #btn-fullscreen {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        margin-right: 0 !important;
    }

    .btn-exit {
        padding: 8px 11px;
        border-radius: 9px;
        font-size: 0.85rem;
    }

    .categories-nav {
        height: 48px;
        padding: 6px 8px;
        gap: 7px;
    }

    .cat-pill {
        height: 38px;
        padding: 8px 11px;
        border-radius: 8px;
        font-size: 0.8rem;
        line-height: 18px;
    }

    .cat-arrow {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
        gap: 9px;
        padding-top: 7px;
        overflow-x: hidden;
        align-content: start;
    }

    .product-grid.delivery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px !important;
        padding: 7px 2px 10px;
    }

    .delivery-toolbar {
        grid-template-columns: minmax(0, 1fr) 116px 116px auto auto;
        padding: 6px;
        gap: 8px;
        border-radius: 8px;
    }

    .delivery-search input,
    .delivery-date-button,
    .delivery-history-btn,
    .delivery-auto-print {
        height: 46px;
        font-size: 0.82rem;
    }

    .delivery-date-button {
        padding: 6px 8px;
    }

    .delivery-date-button small {
        font-size: 0.62rem;
    }

    .delivery-date-button strong {
        font-size: 0.86rem;
    }

    .delivery-date-panel {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }

    .delivery-date-selectors {
        grid-template-columns: 82px minmax(120px, 1fr) 96px;
        gap: 8px;
    }

    .delivery-date-selectors select,
    .delivery-date-quick button {
        height: 50px;
        font-size: 0.95rem;
    }

    .delivery-date-quick {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .delivery-grid .comanda-card {
        padding: 9px !important;
        border-radius: 9px !important;
    }

    .delivery-grid .comanda-card button,
    .delivery-grid .comanda-card a {
        padding: 8px 4px !important;
        font-size: 0.66rem !important;
        border-radius: 6px !important;
        line-height: 1.05 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .delivery-grid .comanda-card > div[style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    .delivery-history-row {
        grid-template-columns: 92px minmax(100px, 1fr) 92px 58px;
        gap: 7px;
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .product-card {
        height: 124px;
        border-radius: 10px;
    }

    .product-info {
        left: 5px;
        right: 5px;
        bottom: 5px;
        padding: 2px 3px;
        border-radius: 7px;
        border-width: 1px;
    }

    .p-name {
        font-size: 0.74rem;
    }

    .p-price {
        font-size: 0.82rem;
    }

    #order-notes-container {
        padding: 7px 10px !important;
        border-radius: 0 0 8px 8px !important;
    }

    #pedido-notas {
        height: 38px !important;
        padding: 7px 9px !important;
        font-size: 0.78rem !important;
        border-radius: 7px !important;
    }

    .login-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 8px !important;
        overflow: hidden !important;
    }

    .login-card {
        width: min(92vw, 370px) !important;
        max-width: 370px !important;
        max-height: calc(100vh - 16px) !important;
        padding: 16px 20px !important;
        border-radius: 12px;
        overflow: hidden !important;
    }

    .login-logo-container {
        margin-bottom: 8px !important;
        padding-top: 0 !important;
    }

    .login-logo-container img {
        max-width: 118px !important;
    }

    .status-indicators {
        margin-bottom: 10px;
    }

    #pin-login-pad {
        gap: 0;
    }

    #pin-login-pad h2 {
        font-size: 1.35rem;
        line-height: 1.15;
        margin: 4px 0 2px;
    }

    #pin-login-pad p {
        font-size: 0.92rem;
        margin: 0 0 6px;
    }

    #pin-logo-container img {
        max-height: 54px !important;
        margin-bottom: 8px !important;
        border-radius: 8px !important;
    }

    .pin-display {
        height: 58px;
        padding: 8px 12px;
        font-size: 2rem;
        letter-spacing: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .numpad {
        gap: 10px;
        margin-bottom: 10px;
    }

    .numpad button {
        height: 54px;
        padding: 0;
        border-radius: 10px;
        font-size: 1.25rem;
    }

    #btn-switch-account {
        margin-top: 2px;
        font-size: 0.82rem;
    }

    .waiter-selection {
        width: min(72vw, 560px) !important;
        max-width: 560px !important;
        max-height: calc(100vh - 44px) !important;
        padding: 22px 28px !important;
        overflow-y: auto;
    }

    .waiter-selection h3 {
        font-size: 1.1rem;
        margin: 0 0 10px;
    }

    .waiter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 18px;
        margin-top: 8px;
    }

    .waiter-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 5px 6px;
        min-width: 0;
        text-align: center;
    }

    .waiter-card .waiter-img-container {
        width: 72px;
        height: 72px;
        margin-bottom: 6px;
        border-width: 2px;
    }

    .waiter-card span {
        font-size: 0.9rem;
        line-height: 1.15;
        width: 100%;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .waiter-card small {
        display: block;
        font-size: 0.74rem;
        line-height: 1.1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .waiter-action-card {
        flex-direction: row;
        justify-content: flex-start;
        min-height: 42px;
        padding: 6px 10px;
        text-align: left;
    }

    .waiter-action-card .waiter-img-container {
        width: 28px;
        height: 28px;
        margin: 0;
    }

    .waiter-action-card span {
        font-size: 0.86rem;
        font-weight: 800;
    }

    #waiter-list-container > div[style*="margin-top"] {
        margin-top: 10px !important;
    }

    #waiter-pin-section {
        max-width: 380px;
        margin: 0 auto;
    }

    #selected-waiter-info {
        font-size: 1.05rem;
        margin-bottom: 8px;
        text-align: left;
    }

    #waiter-pin-input {
        height: 54px;
        padding: 8px 12px;
        font-size: 1.65rem;
        letter-spacing: 10px;
        margin: 8px 0 10px;
        border-radius: 10px;
    }

    #waiter-pin-section .numpad {
        gap: 8px;
        margin-bottom: 10px;
    }

    #waiter-pin-section .numpad button {
        height: 44px;
        padding: 0;
        border-radius: 9px;
        font-size: 1.1rem;
    }

    #waiter-pin-section .btn-confirm-pin {
        height: 46px;
        padding: 0;
        border-radius: 10px;
        font-size: 0.98rem;
        margin-bottom: 8px;
    }

    #waiter-pin-section > .btn-cancel {
        display: block;
        min-width: 82px;
        padding: 10px 14px;
        margin: 0 auto;
        border-radius: 9px;
        font-size: 0.82rem;
    }

    .pda-header-container {
        padding: 8px 10px;
        gap: 8px;
    }

    .pda-header-container h3 {
        font-size: 0.96rem;
        max-width: 150px;
    }

    .pda-mode-switch {
        gap: 6px;
        margin: 0 2px;
        padding: 3px 9px;
        font-size: 0.72rem;
    }

    #pda-comandas-list {
        padding: 12px 16px !important;
    }

    .pda-comanda-card {
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .pda-comanda-card .comanda-header {
        padding: 7px 12px;
        font-size: 0.88rem;
    }

    .pda-comanda-card .comanda-header span {
        font-size: 0.82em;
    }

    .pda-comanda-card .comanda-item-row {
        min-height: 48px;
        padding: 7px 12px;
        font-size: 0.9rem;
    }

    .pda-comanda-card .item-qty {
        min-width: 58px;
        margin-right: 8px;
        font-size: 0.92rem;
    }

    .pda-comanda-card .item-name {
        font-size: 0.92rem;
    }

    .pda-comanda-card .btn-check-item {
        min-width: 58px;
        height: 36px;
        padding: 6px 14px;
        margin-left: 10px;
        font-size: 0.86rem;
        border-radius: 7px;
    }
}
