/* AquaControl V79.17.22.12 - Experiencia movil completa para rol Cajero / Operador de planta.
   Capa visual y de navegacion: reutiliza vistas, validaciones y reglas existentes. */

.plant-mobile-nav,
.plant-mobile-new-customer,
.plant-mobile-customer-backdrop,
.plant-mobile-cut-hero {
  display: none;
}

@media (max-width: 760px) {
  body.plant-mobile-mode {
    --plant-nav-h: 70px;
    --plant-blue: #0a67d1;
    --plant-ink: #10233f;
    --plant-muted: #6d7a8c;
    --plant-line: #dce4ee;
    --plant-bg: #eef3f8;
    --plant-success: #0f9f6e;
    background: var(--plant-bg);
  }

  body.plant-mobile-mode #mainScreen {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--plant-bg);
  }

  body.plant-mobile-mode .topbar {
    position: relative;
    z-index: 1090;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 66px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid var(--plant-line);
    background: rgba(255,255,255,.98);
    box-shadow: 0 2px 10px rgba(20,44,75,.04);
  }

  body.plant-mobile-mode #aqMenuToggle,
  body.plant-mobile-mode #openGlobalSearchBtn,
  body.plant-mobile-mode #networkStatus,
  body.plant-mobile-mode .topbar-nav-context,
  body.plant-mobile-mode .session-badges {
    display: none !important;
  }

  body.plant-mobile-mode .topbar-brand {
    min-width: 0;
    display: grid;
    grid-template-columns: 40px minmax(0,1fr);
    gap: 9px;
    align-items: center;
  }

  body.plant-mobile-mode .brand-logo-small {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
  }

  body.plant-mobile-mode .topbar-brand h2 {
    margin: 0 !important;
    color: var(--plant-ink);
    font-size: 14px !important;
    line-height: 1.15;
  }

  body.plant-mobile-mode .topbar-brand .version-badge {
    display: none !important;
  }

  body.plant-mobile-mode #sessionInfo {
    display: block;
    max-width: 100%;
    margin-top: 3px;
    overflow: hidden;
    color: var(--plant-muted) !important;
    font-size: 10.5px !important;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.plant-mobile-mode .topbar-actions {
    display: flex !important;
    align-items: center;
    gap: 4px;
  }

  body.plant-mobile-mode #logoutBtn {
    min-height: 38px !important;
    padding: 7px 10px !important;
    border: 1px solid var(--plant-line) !important;
    border-radius: 11px !important;
    color: #385270 !important;
    background: #f7f9fc !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  body.plant-mobile-mode .layout {
    display: block !important;
    height: calc(100dvh - 66px);
    min-height: 0;
  }

  body.plant-mobile-mode .side-menu {
    display: none !important;
  }

  body.plant-mobile-mode #mainContent.content {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 12px 11px calc(var(--plant-nav-h) + 18px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: var(--plant-bg) !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
  }

  body.plant-mobile-mode .view {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body.plant-mobile-mode .view-header,
  body.plant-mobile-mode .enterprise-page-header,
  body.plant-mobile-mode .unified-center-header {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 0 0 11px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.plant-mobile-mode .view-header h3,
  body.plant-mobile-mode .enterprise-page-header h3,
  body.plant-mobile-mode .unified-center-header h3 {
    margin: 0 !important;
    color: var(--plant-ink) !important;
    font-size: 20px !important;
    line-height: 1.1 !important;
  }

  body.plant-mobile-mode .view-header .muted,
  body.plant-mobile-mode .enterprise-page-header .muted,
  body.plant-mobile-mode .unified-center-header .muted,
  body.plant-mobile-mode .enterprise-eyebrow {
    display: none !important;
  }

  body.plant-mobile-mode .panel,
  body.plant-mobile-mode .soft-panel,
  body.plant-mobile-mode .table-panel {
    border: 1px solid var(--plant-line) !important;
    border-radius: 17px !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(31,59,91,.04) !important;
  }

  /* Navegacion inferior: es el menu principal del operador de planta. */
  body.plant-mobile-mode .plant-mobile-nav {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    grid-template-columns: repeat(4, minmax(0,1fr));
    min-height: var(--plant-nav-h);
    padding: 7px max(6px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--plant-line);
    background: rgba(255,255,255,.97);
    box-shadow: 0 -7px 20px rgba(8,27,44,.10);
    backdrop-filter: blur(12px);
  }

  body.plant-mobile-mode .plant-mobile-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 52px !important;
    padding: 4px 2px !important;
    border: 0 !important;
    border-radius: 12px !important;
    color: #7a889b !important;
    background: transparent !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
  }

  body.plant-mobile-mode .plant-mobile-nav button span:first-child {
    display: grid;
    place-items: center;
    width: 34px;
    height: 28px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1;
  }

  body.plant-mobile-mode .plant-mobile-nav button.active {
    color: var(--plant-blue) !important;
  }

  body.plant-mobile-mode .plant-mobile-nav button.active span:first-child {
    background: #e7f2ff;
    color: var(--plant-blue);
  }

  /* Venta: dock de cobro arriba de la navegacion inferior. */
  body.plant-mobile-mode #saleView {
    padding-bottom: 88px !important;
  }

  body.plant-mobile-mode #saleView .mobile-sale-dock {
    bottom: calc(var(--plant-nav-h) + env(safe-area-inset-bottom)) !important;
    z-index: 1190 !important;
    border-radius: 17px 17px 0 0;
  }

  body.plant-mobile-mode #saleView .cart-panel {
    bottom: calc(var(--plant-nav-h) + 76px + env(safe-area-inset-bottom)) !important;
  }

  body.plant-mobile-mode #saleView .mobile-cart-backdrop {
    z-index: 1180 !important;
  }

  body.plant-mobile-mode #saleView .product-panel {
    box-shadow: none !important;
  }

  body.plant-mobile-mode #saleView .product-btn {
    min-height: 112px !important;
    border-radius: 17px !important;
    box-shadow: 0 5px 18px rgba(31,59,91,.055) !important;
  }

  body.plant-mobile-mode #saleView .product-btn > strong {
    font-size: .82rem !important;
  }

  body.plant-mobile-mode #saleView .product-btn .product-price {
    color: #12385f !important;
    font-size: 1.28rem !important;
  }

  /* Clientes: búsqueda primero; alta en hoja inferior. */
  body.plant-mobile-mode #customersView .toolbar-actions,
  body.plant-mobile-mode #customersView .unified-center-tabs,
  body.plant-mobile-mode #customersView .unified-center-note,
  body.plant-mobile-mode #customersView [data-customer-center-panel="delivery"] {
    display: none !important;
  }

  body.plant-mobile-mode #customersView .customer-tools {
    display: grid !important;
    gap: 9px !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
  }

  body.plant-mobile-mode #customerSearch {
    min-height: 46px !important;
    padding: 10px 12px !important;
    border-radius: 13px !important;
    font-size: 16px !important;
  }

  body.plant-mobile-mode #customersView .stat-strip {
    display: grid !important;
    grid-template-columns: repeat(3,minmax(0,1fr)) !important;
    gap: 6px !important;
  }

  body.plant-mobile-mode #customersView .stat-strip > div {
    min-width: 0;
    padding: 9px 7px !important;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    background: #f8fafc;
  }

  body.plant-mobile-mode #customersView .stat-strip span {
    font-size: 8.5px !important;
    line-height: 1.15;
  }

  body.plant-mobile-mode #customersView .stat-strip strong {
    font-size: 14px !important;
  }

  body.plant-mobile-mode #customersView .enterprise-customer-table-panel {
    padding: 6px 10px !important;
    overflow: visible !important;
  }

  body.plant-mobile-mode #customersView .enterprise-table-wrap {
    overflow: visible !important;
  }

  body.plant-mobile-mode #customersView table,
  body.plant-mobile-mode #customersView tbody,
  body.plant-mobile-mode #customersView tr,
  body.plant-mobile-mode #customersView td {
    display: block !important;
    width: 100% !important;
  }

  body.plant-mobile-mode #customersView thead {
    display: none !important;
  }

  body.plant-mobile-mode #customersView #customerRows tr {
    position: relative;
    margin: 0 !important;
    padding: 12px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #edf2f7 !important;
  }

  body.plant-mobile-mode #customersView #customerRows tr:last-child {
    border-bottom: 0 !important;
  }

  body.plant-mobile-mode #customersView #customerRows td {
    min-height: 0 !important;
    padding: 2px 0 !important;
    border: 0 !important;
    color: #607086;
    font-size: 10.5px !important;
    line-height: 1.3;
  }

  body.plant-mobile-mode #customersView #customerRows td:first-child {
    padding-right: 80px !important;
    color: var(--plant-ink) !important;
    font-size: 12.5px !important;
    font-weight: 800 !important;
  }

  body.plant-mobile-mode #customersView #customerRows td:nth-child(2),
  body.plant-mobile-mode #customersView #customerRows td:nth-child(3),
  body.plant-mobile-mode #customersView #customerRows td:nth-child(4),
  body.plant-mobile-mode #customersView #customerRows td:nth-child(5) {
    display: inline-block !important;
    width: auto !important;
    margin-right: 7px;
  }

  body.plant-mobile-mode #customersView #customerRows td:last-child {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
  }

  body.plant-mobile-mode #customersView #customerRows button {
    min-height: 36px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
  }

  body.plant-mobile-mode .plant-mobile-new-customer {
    display: grid;
    position: fixed;
    right: 16px;
    bottom: calc(var(--plant-nav-h) + 14px + env(safe-area-inset-bottom));
    z-index: 1170;
    place-items: center;
    min-width: 52px;
    min-height: 52px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 17px !important;
    color: #fff !important;
    background: var(--plant-blue) !important;
    box-shadow: 0 9px 22px rgba(10,103,209,.28) !important;
    font-size: 13px !important;
    font-weight: 900 !important;
  }

  body.plant-mobile-mode:not(.plant-mobile-customers-active) .plant-mobile-new-customer {
    display: none !important;
  }

  body.plant-mobile-mode #customersView .enterprise-customer-form {
    position: fixed !important;
    left: 8px;
    right: 8px;
    bottom: calc(var(--plant-nav-h) + 8px + env(safe-area-inset-bottom));
    z-index: 1225;
    display: none !important;
    width: auto !important;
    max-height: min(78dvh, 690px);
    margin: 0 !important;
    padding: 14px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-radius: 20px 20px 14px 14px !important;
    box-shadow: 0 -16px 40px rgba(15,37,63,.22) !important;
  }

  body.plant-mobile-mode.plant-mobile-customer-form-open #customersView .enterprise-customer-form {
    display: grid !important;
  }

  body.plant-mobile-mode .plant-mobile-customer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1220;
    background: rgba(8,27,44,.43);
  }

  body.plant-mobile-mode.plant-mobile-customer-form-open .plant-mobile-customer-backdrop {
    display: block;
  }

  body.plant-mobile-mode #customersView .customer-form-heading {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  body.plant-mobile-mode #customersView .customer-form-heading h4 {
    margin: 0 !important;
    font-size: 17px !important;
  }

  body.plant-mobile-mode #customersView .customer-form-heading p {
    display: none !important;
  }

  body.plant-mobile-mode #customersView .plant-mobile-customer-close {
    min-width: 38px;
    min-height: 38px !important;
    padding: 0 !important;
    border: 1px solid var(--plant-line) !important;
    border-radius: 50% !important;
    color: #385270 !important;
    background: #fff !important;
    font-size: 20px !important;
    line-height: 1 !important;
  }

  body.plant-mobile-mode #customersView .enterprise-customer-form label {
    display: grid !important;
    gap: 4px !important;
  }

  body.plant-mobile-mode #customersView .enterprise-customer-form input,
  body.plant-mobile-mode #customersView .enterprise-customer-form select {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  body.plant-mobile-mode #customersView .customer-submit {
    min-height: 48px !important;
    border-radius: 12px !important;
    font-weight: 900 !important;
  }

  /* Historial: cada venta se vuelve una tarjeta, sin tabla horizontal. */
  body.plant-mobile-mode #historyView .view-header > button,
  body.plant-mobile-mode #historyView #exportSalesBtn {
    display: none !important;
  }

  body.plant-mobile-mode #historyView .history-filters {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 7px !important;
    padding: 9px !important;
    margin-bottom: 10px !important;
  }

  body.plant-mobile-mode #historyView .history-filters input,
  body.plant-mobile-mode #historyView .history-filters select {
    min-height: 43px !important;
    font-size: 16px !important;
  }

  body.plant-mobile-mode #historyView > .table-panel {
    padding: 5px 10px !important;
    overflow: visible !important;
  }

  body.plant-mobile-mode #historyView table,
  body.plant-mobile-mode #historyView tbody,
  body.plant-mobile-mode #historyView tr,
  body.plant-mobile-mode #historyView td {
    display: block !important;
    width: 100% !important;
  }

  body.plant-mobile-mode #historyView thead {
    display: none !important;
  }

  body.plant-mobile-mode #salesRows tr {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 2px 8px;
    padding: 11px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #edf2f7 !important;
  }

  body.plant-mobile-mode #salesRows tr:last-child {
    border-bottom: 0 !important;
  }

  body.plant-mobile-mode #salesRows td {
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 1px 0 !important;
    border: 0 !important;
    color: #6f7d8f;
    font-size: 10.5px !important;
    line-height: 1.25;
  }

  body.plant-mobile-mode #salesRows td:nth-child(1) {
    grid-column: 1;
    color: var(--plant-ink) !important;
    font-size: 12.5px !important;
    font-weight: 900 !important;
  }

  body.plant-mobile-mode #salesRows td:nth-child(2),
  body.plant-mobile-mode #salesRows td:nth-child(3),
  body.plant-mobile-mode #salesRows td:nth-child(4) {
    grid-column: 1;
  }

  body.plant-mobile-mode #salesRows td:nth-child(5) {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    color: var(--plant-ink) !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    text-align: right;
  }

  body.plant-mobile-mode #salesRows td:nth-child(n+6) {
    grid-column: 1 / -1;
  }

  body.plant-mobile-mode #salesRows td:last-child {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
  }

  body.plant-mobile-mode #salesRows button {
    min-height: 35px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
  }

  /* Corte: resumen visual real del turno y acceso directo al cierre existente. */
  body.plant-mobile-mode #cashView .view-header {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  body.plant-mobile-mode #cashView #cashShiftInfo {
    display: block !important;
    margin: 4px 0 0 !important;
    color: var(--plant-muted) !important;
    font-size: 10.5px !important;
    line-height: 1.25;
  }

  body.plant-mobile-mode #cashView #startCashCutBtn {
    width: 100% !important;
    min-height: 48px !important;
    margin-top: 2px !important;
    border-radius: 13px !important;
    font-size: 14px !important;
    font-weight: 900 !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero {
    display: block;
    margin-bottom: 10px;
    padding: 14px;
    border-radius: 18px;
    color: #fff;
    background: #102f57;
    box-shadow: 0 8px 22px rgba(16,47,87,.18);
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-eyebrow {
    color: rgba(255,255,255,.72);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-total {
    margin: 3px 0 9px;
    font-size: 29px;
    font-weight: 900;
    line-height: 1;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-meta span {
    padding: 5px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.11);
    font-size: 9px;
    font-weight: 700;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-methods {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 11px;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-methods div {
    min-width: 0;
    padding: 8px 9px;
    border-radius: 12px;
    background: rgba(255,255,255,.09);
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-methods span {
    display: block;
    color: rgba(255,255,255,.68);
    font-size: 8.5px;
  }

  body.plant-mobile-mode .plant-mobile-cut-hero .pm-methods strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.plant-mobile-mode #cashView .module-workspace-tabs {
    display: flex !important;
    gap: 6px !important;
    margin: 0 0 10px !important;
    padding: 0 0 4px !important;
    overflow-x: auto !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.plant-mobile-mode #cashView .module-workspace-tab {
    flex: 0 0 auto !important;
    min-height: 38px !important;
    padding: 7px 10px !important;
    border: 1px solid var(--plant-line) !important;
    border-radius: 999px !important;
    background: #fff !important;
    font-size: 10px !important;
  }

  body.plant-mobile-mode #cashView .module-workspace-tab.active {
    color: #fff !important;
    border-color: var(--plant-blue) !important;
    background: var(--plant-blue) !important;
  }

  body.plant-mobile-mode #cashView .module-workspace-intro {
    display: none !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-card {
    min-width: 0 !important;
    min-height: 92px !important;
    padding: 11px !important;
    border: 1px solid var(--plant-line) !important;
    border-radius: 15px !important;
    text-align: left !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-card span {
    font-size: 9.5px !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-card strong {
    font-size: 20px !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-card small {
    font-size: 10px !important;
  }

  body.plant-mobile-mode #cashView .cash-kpi-card em {
    font-size: 8.5px !important;
  }

  body.plant-mobile-mode #cashView .cash-history-panel {
    padding: 9px !important;
  }

  body.plant-mobile-mode #cashView .cash-history-filters {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  body.plant-mobile-mode #cashView .cash-cut-history-table {
    overflow-x: auto !important;
  }

  /* El workspace de corte conserva toda la logica, pero se siente como app movil. */
  body.plant-mobile-mode .cash-cut-workspace-dialog {
    background: var(--plant-bg) !important;
  }

  body.plant-mobile-mode .cash-workspace-header {
    padding-top: max(10px, env(safe-area-inset-top)) !important;
  }

  body.plant-mobile-mode .cash-workspace-nav {
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.plant-mobile-mode .cash-workspace-stage {
    padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
  }

  /* Setup inicial del cajero: solo decisiones del operador; datos automaticos quedan ocultos. */
  body.plant-mobile-setup-mode #setupScreen {
    padding: max(18px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom)) !important;
    background: #eef3f8 !important;
  }

  body.plant-mobile-setup-mode #setupScreen .login-card.setup-card {
    width: min(100%, 430px) !important;
    margin: auto !important;
    padding: 18px !important;
    border: 1px solid var(--plant-line, #dce4ee) !important;
    border-radius: 22px !important;
    box-shadow: 0 16px 40px rgba(20,44,75,.13) !important;
  }

  body.plant-mobile-setup-mode #setupScreen h1 {
    margin-bottom: 4px !important;
    font-size: 22px !important;
  }

  body.plant-mobile-setup-mode #setupScreen .plant-auto-field,
  body.plant-mobile-setup-mode #setupBusinessDateHelp,
  body.plant-mobile-setup-mode #setupScreen .formula-box {
    display: none !important;
  }

  body.plant-mobile-setup-mode #setupScreen label {
    gap: 5px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  body.plant-mobile-setup-mode #setupScreen input,
  body.plant-mobile-setup-mode #setupScreen select {
    min-height: 46px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }

  body.plant-mobile-setup-mode #enterCajaBtn {
    min-height: 50px !important;
    border-radius: 13px !important;
    font-size: 14px !important;
    font-weight: 900 !important;
  }
}

@media (max-width: 380px) {
  body.plant-mobile-mode #historyView .history-filters {
    grid-template-columns: 1fr !important;
  }

  body.plant-mobile-mode #customersView .stat-strip {
    grid-template-columns: 1fr 1fr !important;
  }

  body.plant-mobile-mode #customersView .stat-strip > div:last-child {
    grid-column: 1 / -1;
  }
}

/* V79.17.22.13 - Corte movil enfocado.
   Reduce contexto fijo y entrega la mayor parte del viewport al paso activo. */
@media (max-width: 760px) {
  body.plant-mobile-mode .cash-cut-workspace-dialog {
    overflow: hidden !important;
  }

  body.plant-mobile-mode .cash-cut-workspace-shell {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* Encabezado operativo compacto: conserva contexto y acciones sin consumir media pantalla. */
  body.plant-mobile-mode .cash-workspace-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: max(7px, env(safe-area-inset-top)) 10px 7px !important;
  }

  body.plant-mobile-mode .cash-workspace-header > div:first-child {
    min-width: 0 !important;
  }

  body.plant-mobile-mode .cash-workspace-eyebrow {
    display: none !important;
  }

  body.plant-mobile-mode .cash-workspace-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1.1 !important;
  }

  body.plant-mobile-mode #cashWorkspaceSubtitle {
    margin-top: 2px !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
  }

  body.plant-mobile-mode .cash-workspace-header-actions {
    width: auto !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
  }

  body.plant-mobile-mode .cash-workspace-header-actions > button {
    min-height: 32px !important;
    padding: 5px 8px !important;
    border-radius: 9px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
  }

  /* Resumen compacto siempre visible; los KPIs completos quedan bajo demanda. */
  body.plant-mobile-mode .plant-mobile-cut-summarybar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    align-items: center !important;
    padding: 6px 10px !important;
    background: #f8fbfe !important;
    border-bottom: 1px solid #dfe6ef !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-summary-copy {
    min-width: 0 !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-summary-session {
    display: block !important;
    color: #536a82 !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-summary-metrics {
    display: flex !important;
    gap: 8px !important;
    margin-top: 2px !important;
    min-width: 0 !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-summary-metrics span {
    color: #173a61 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
  }

  body.plant-mobile-mode .plant-mobile-cut-summary-toggle {
    min-height: 32px !important;
    padding: 5px 9px !important;
    border: 1px solid #cbd8e6 !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #173a61 !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
  }

  body.plant-mobile-mode .cash-workspace-kpis {
    display: none !important;
    grid-template-columns: 1fr 1fr !important;
    max-height: min(42dvh, 330px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.plant-mobile-mode .cash-cut-workspace-dialog.plant-mobile-summary-open .cash-workspace-kpis {
    display: grid !important;
  }

  body.plant-mobile-mode .cash-workspace-kpis > div {
    padding: 7px 9px !important;
  }

  body.plant-mobile-mode .cash-workspace-kpis span {
    font-size: 9px !important;
  }

  body.plant-mobile-mode .cash-workspace-kpis strong {
    margin-top: 1px !important;
    font-size: 12px !important;
  }

  /* Los 11 pasos quedan como una linea de progreso de puntos; el titulo vive en la barra inferior. */
  body.plant-mobile-mode .cash-workspace-layout {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.plant-mobile-mode .cash-workspace-nav {
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 3px !important;
    padding: 5px 7px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  body.plant-mobile-mode .cash-workspace-nav::-webkit-scrollbar {
    display: none !important;
  }

  body.plant-mobile-mode .cash-workspace-nav button {
    flex: 1 0 27px !important;
    width: 27px !important;
    min-width: 27px !important;
    height: 30px !important;
    grid-template-columns: 1fr !important;
    padding: 1px !important;
    border-radius: 8px !important;
  }

  body.plant-mobile-mode .cash-workspace-nav button div {
    display: none !important;
  }

  body.plant-mobile-mode .cash-workspace-nav button > span {
    width: 25px !important;
    height: 25px !important;
    margin: auto !important;
    font-size: 9px !important;
  }

  body.plant-mobile-mode .cash-workspace-main {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.plant-mobile-mode .cash-workspace-stepbar {
    flex: 0 0 auto !important;
    min-height: 42px !important;
    padding: 5px 9px !important;
    gap: 7px !important;
  }

  body.plant-mobile-mode .cash-workspace-stepbar > div:first-child {
    min-width: 0 !important;
    gap: 6px !important;
  }

  body.plant-mobile-mode #cashWorkspaceStepBadge {
    padding: 4px 6px !important;
    font-size: 9px !important;
    white-space: nowrap !important;
  }

  body.plant-mobile-mode #cashWorkspaceStepTitle {
    min-width: 0 !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.plant-mobile-mode #cashWorkspaceStepState {
    display: none !important;
  }

  /* El paso activo recibe casi todo el espacio disponible. */
  body.plant-mobile-mode .cash-workspace-stage {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 8px 9px calc(64px + env(safe-area-inset-bottom)) !important;
    scroll-padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
  }

  body.plant-mobile-mode .cash-workspace-section {
    min-height: auto !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-title {
    margin-bottom: 8px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-title h3 {
    display: none !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-title p {
    font-size: 10.5px !important;
    line-height: 1.3 !important;
  }

  body.plant-mobile-mode .cash-workspace-form .panel,
  body.plant-mobile-mode .cash-workspace-form .summary-panel {
    padding: 9px !important;
    border-radius: 10px !important;
  }

  body.plant-mobile-mode .cash-workspace-form label {
    gap: 4px !important;
  }

  body.plant-mobile-mode .cash-workspace-form input,
  body.plant-mobile-mode .cash-workspace-form select,
  body.plant-mobile-mode .cash-workspace-form textarea {
    min-height: 42px !important;
  }

  /* Abono y salida ya estan en la cabecera: no duplicarlos en cada paso. */
  body.plant-mobile-mode .cash-workspace-form > .dialog-actions .cash-abono-wizard-btn,
  body.plant-mobile-mode .cash-workspace-form > .dialog-actions [id^="cancelCash"] {
    display: none !important;
  }

  /* Navegacion de paso estable y compacta al fondo. */
  body.plant-mobile-mode .cash-workspace-form > .dialog-actions {
    position: sticky !important;
    bottom: calc(-8px - env(safe-area-inset-bottom)) !important;
    z-index: 8 !important;
    display: flex !important;
    gap: 7px !important;
    align-items: center !important;
    margin: 12px -9px calc(-64px - env(safe-area-inset-bottom)) !important;
    padding: 8px 9px max(8px, env(safe-area-inset-bottom)) !important;
    background: rgba(255,255,255,.97) !important;
    border-top: 1px solid #dfe6ef !important;
    box-shadow: 0 -6px 18px rgba(16,47,80,.08) !important;
    backdrop-filter: blur(8px) !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-actions > button:not([style*="display: none"]) {
    min-height: 42px !important;
    border-radius: 10px !important;
    font-size: 11px !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-actions > .primary {
    flex: 1 1 auto !important;
    font-weight: 900 !important;
  }

  body.plant-mobile-mode .cash-workspace-form > .dialog-actions > .ghost {
    flex: 0 0 auto !important;
  }
}

/* V79.17.22.15 - iOS/PWA touch layer fix.
   Keep interactive sheets above their dimming backdrops. */
@media (max-width: 760px) {
  body.plant-mobile-mode #saleView .cart-panel {
    z-index: 1185 !important;
    pointer-events: auto;
  }

  body.plant-mobile-mode #saleView .mobile-cart-backdrop {
    z-index: 1180 !important;
  }

  body.plant-mobile-mode .plant-mobile-customer-backdrop {
    z-index: 1220 !important;
    pointer-events: none;
  }

  body.plant-mobile-mode.plant-mobile-customer-form-open .plant-mobile-customer-backdrop {
    pointer-events: auto;
  }

  body.plant-mobile-mode #customersView .enterprise-customer-form {
    z-index: 1225 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
}

/* V79.17.22.16 - Domicilio llenado visible en POS movil de planta.
   La logica ya existia; esta capa solo recupera la accion en movil para
   registrar garrafones de domicilio llenados en la planta y cuadrar litraje
   por planta + turno + sesion de caja. */
@media (max-width: 760px) {
  #saleView .sale-enterprise-header {
    grid-template-columns: 1fr !important;
  }

  #saleView .sale-header-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
    width: 100% !important;
    justify-content: stretch !important;
  }

  #saleView #homeDeliveryOutBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    width: 100% !important;
    padding: 9px 10px !important;
    font-size: .78rem !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
  }

  #saleView #homeDeliveryHistoryBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    padding: 9px 10px !important;
    font-size: .72rem !important;
    line-height: 1.1 !important;
  }

  #saleView #clearCartBtn {
    grid-column: 1 / -1 !important;
    justify-self: end !important;
    min-height: 32px !important;
    padding: 5px 9px !important;
    font-size: .7rem !important;
  }
}
