

/* VLM 2026-10-14 - Adaptación exclusiva para teléfonos, ancho CSS <= 740px.
   NO cambiar estilos de PC/iPad, HTML de vistas, JavaScript, lógica ni D1.
   'screen' impide que este bloque altere el ticket térmico impreso. */
@media screen and (max-width:740px) {
  /* Lienzo y navegación: seis accesos visibles, sin desplazamiento horizontal. */
  html,body{width:100%;max-width:100%;overflow-x:clip}
  .shell,.workspace,.content,.page-card,.panel{min-width:0;max-width:100%}
  .shell{display:grid;grid-template-columns:minmax(0,1fr)}
  .sidebar{
    position:relative;top:auto;height:auto;min-height:0;width:100%;
    display:flex!important;flex-direction:column!important;align-items:stretch;
    padding:7px 9px 10px;gap:5px;overflow:visible;box-shadow:none;
    border-right:0;border-bottom:1px solid var(--border);
  }
  .sidebar .brand{
    width:100%;max-width:none;height:53px;min-height:53px;margin:0;
    padding:0;display:flex;justify-content:center;align-items:center;
  }
  .sidebar .brand img{width:118px;max-width:100%;height:52px;transform:none;object-fit:contain}
  .sidebar .nav{
    width:100%;max-width:100%;display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;margin:0;overflow:visible;justify-content:stretch;
  }
  .sidebar .nav .nav-link{
    display:flex!important;flex-direction:column!important;
    align-items:center;justify-content:center;text-align:center;
    min-width:0;width:100%;height:auto;min-height:61px;
    padding:6px 3px;gap:3px;border-radius:11px;
    font-size:12px;font-weight:750;line-height:1.15;
    white-space:normal;overflow-wrap:anywhere;
  }
  .sidebar .nav .nav-link .nav-symbol{
    flex:0 0 28px;width:30px;height:28px;min-height:28px;
    border-radius:8px;display:grid;place-items:center;
  }
  .sidebar .nav .nav-symbol svg{width:19px;height:19px}
  .topbar{
    width:100%;height:76px;min-height:76px;padding:11px 14px;
    gap:5px;overflow:hidden;
  }
  .topbar h1{font-size:clamp(20px,5.1vw,25px);letter-spacing:-.7px;line-height:1.12}
  .topbar p{font-size:14px;line-height:1.2;margin-top:3px}
  .topbar::after{width:42%;height:76px;opacity:.20;background-size:contain}
  .content{width:100%;padding:10px 9px 22px;overflow:visible}
  .page-card{padding:14px 12px;border-radius:16px}
  .panel{padding:12px;border-radius:13px}
  .page-heading{
    min-width:0;display:flex;flex-wrap:wrap;gap:11px;
    align-items:center;margin-bottom:15px;
  }
  .page-heading .titleblock{flex:1 1 100%;min-width:0;gap:10px}
  .page-heading .titleblock>div{min-width:0}
  .page-heading .heading-icon{width:46px;height:46px;flex:0 0 46px;border-radius:12px}
  .page-heading .heading-icon svg{width:25px;height:25px}
  .page-heading h2{font-size:clamp(20px,5.2vw,24px);line-height:1.15;overflow-wrap:anywhere}
  .page-heading p{font-size:13px;line-height:1.35;margin-top:3px}
  .page-heading>.btn{width:100%;min-height:46px;justify-content:center}
  .page-heading .actions{width:100%;min-width:0;display:flex;gap:8px}
  .page-heading .actions .btn{flex:1 1 135px;min-width:0;min-height:44px;white-space:normal;padding:8px 9px;text-align:center}
  button.btn.large{min-height:45px;font-size:14px;padding:9px 12px}
  .field input,.field select,.field textarea,
  .selector-search input,.clients-search-input input,
  .new-order-page #orderProductSearch{font-size:16px;max-width:100%}
  .form-grid,.form-grid.two{grid-template-columns:minmax(0,1fr);gap:11px}
  .form-grid .full-mobile{grid-column:1}
  .customer-pick{width:100%;min-width:0;flex-wrap:wrap}
  .customer-pick select{flex:1 1 100%}
  .customer-pick .btn{width:100%;min-height:43px}
  .app-footer{padding:10px 14px 23px;font-size:11px}
  /* Pedidos: filtrado cómodo; tarjetas mantienen fecha, estado y 4 acciones. */
  .orders-page{min-height:0;padding:13px 11px 17px;border-radius:16px}
  .orders-page .page-heading{gap:10px;min-height:0;margin-bottom:13px}
  .orders-page .page-heading .titleblock{gap:10px}
  .orders-page .heading-icon{width:46px;height:46px;flex:0 0 46px}
  .orders-page .heading-icon svg{width:25px;height:25px}
  .orders-page .page-heading h2{font-size:22px}
  .orders-page .page-heading p{font-size:13px}
  .orders-page button.btn.primary.large{width:100%;min-height:46px;font-size:15px;padding:9px 12px}
  .orders-page .filters,.filters{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;padding:10px;margin-bottom:13px;min-width:0;
  }
  .orders-page .filters .field,.filters .field{min-width:0;width:100%;grid-column:auto}
  .orders-page .filters .field label,.filters .field label{font-size:12.5px;line-height:1.2}
  .orders-page .filters .searchfield,.filters .searchfield{grid-column:1/-1}
  .orders-page .filters .field:has(#ordersStatus){grid-column:1/-1}
  .orders-page .filters .orders-export-btn{
    grid-column:1/-1;width:100%;height:44px;min-height:44px;font-size:14px;
  }
  .orders-page .filters .field input,
  .orders-page .filters .field select,
  .orders-page .orders-date-field .date-control{
    width:100%;max-width:100%;min-width:0;min-height:44px;height:44px;
    font-size:16px;padding-inline:8px;
  }
  .orders-page .orders-date-field .date-visual{font-size:13px;left:8px}
  .orders-page .filters .orders-date-field .date-control{padding-right:25px}
  .orders-page .table-wrap{overflow:visible;border:0;max-width:100%}
  .orders-page .orders-table{display:block;min-width:0!important;width:100%;table-layout:auto}
  .orders-page .orders-table tbody{display:grid;gap:11px}
  .orders-page .orders-table tbody tr{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px 5px;min-width:0;padding:12px 10px;
    border-radius:13px;border:1px solid var(--border);background:var(--surface);
  }
  .orders-page .orders-table tbody tr td{min-width:0!important;overflow-wrap:anywhere}
  .orders-page .orders-table tbody tr td:nth-child(2){
    grid-column:1/3;grid-row:1;align-self:center;
  }
  .orders-page .orders-table tbody tr td:nth-child(1){
    grid-column:3/5;grid-row:1;text-align:right;align-self:center;
    font-size:12px;
  }
  .orders-page .orders-table tbody tr td:nth-child(3){grid-column:1/3;grid-row:2}
  .orders-page .orders-table tbody tr td:nth-child(5){grid-column:3/5;grid-row:2}
  .orders-page .orders-table tbody tr td:nth-child(4){grid-column:1/-1;grid-row:3}
  .orders-page .orders-table tbody tr td:nth-child(n+6){grid-row:4}
  .orders-page .orders-table tbody tr td:nth-child(n+6)::before{
    font-size:11px;font-weight:750;color:var(--muted);
  }
  .orders-page .orders-table .order-icon-button{
    width:44px;max-width:100%;height:44px;min-height:44px;
    display:inline-grid;place-items:center;
  }
  .orders-page .orders-table tbody tr:has(td[colspan]){display:block}
  .orders-page .orders-table tbody tr td[colspan]{display:block;text-align:center}
  .orders-page .orders-footer{padding:12px 0 2px;min-height:0}
  .orders-page .orders-load-more{width:100%;min-height:44px}
  /* Nuevo pedido / Editar: catálogo de dos columnas con controles utilizables. */
  .new-order-page{width:100%;min-width:0}
  .new-order-page .page-heading>.btn{width:100%}
  .new-order-page .new-order-data{padding:11px}
  .new-order-page .new-order-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .new-order-page .new-order-catalog-panel{padding:10px;min-width:0}
  .new-order-page .new-order-tabs{gap:6px;padding-bottom:8px}
  .new-order-page .new-order-tab{min-height:44px;font-size:12.5px;padding:7px 9px;gap:6px}
  .new-order-page .new-order-cat-image{width:30px;height:30px;flex-basis:30px}
  .new-order-page .new-order-catalog-head{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
  .new-order-page .new-order-catalog-head h3{font-size:17px;line-height:1.25}
  .new-order-page #orderProductSearch{width:100%;min-width:0;min-height:44px}
  .new-order-page .new-order-subtabs{gap:6px}
  .new-order-page .new-order-subtabs button{min-height:41px}
  .new-order-page .new-order-product-grid{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;
  }
  .new-order-page .new-order-tile{min-width:0;min-height:177px;padding:8px 6px 9px}
  .new-order-page .new-order-tile-image{width:70px;height:70px;max-width:100%;margin-bottom:4px}
  .new-order-page .new-order-tile-info{min-height:38px;margin-bottom:7px}
  .new-order-page .new-order-tile-info strong{font-size:12px;line-height:1.25}
  .new-order-page .new-order-tile-info small{font-size:12px}
  .new-order-page .new-order-tile .new-order-qty-controls{
    width:100%;max-width:100%;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;
  }
  .new-order-page .new-order-tile .new-order-qty-controls button{
    width:100%;height:41px;min-height:41px;min-width:0;font-size:21px;padding:0 1px;
  }
  .new-order-page .new-order-tile .new-order-qty-value{font-size:17px!important}
  .new-order-page .new-order-summary-panel{
    position:static;min-width:0;width:100%;padding:12px;max-height:none;
  }
  .new-order-page .new-order-summary-list{max-height:none;overflow:visible}
  .new-order-page .new-order-summary-detail .new-order-qty-controls button{
    min-height:36px;height:36px;
  }
  .new-order-page .new-order-summary-actions .btn{min-height:48px}
  /* Primera Hora: dos tarjetas por fila, cifras y unidades legibles. */
  .first-hour-page .ph-title-row{gap:6px 12px}
  .first-hour-page .ph-title-row .ph-today{font-size:18px}
  .first-hour-page .page-heading .actions{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;
  }
  .first-hour-page .page-heading .actions .btn{
    width:100%;min-width:0;min-height:44px;font-size:13px;padding:8px 5px;
    white-space:normal;
  }
  .first-hour-page .ph-section{margin:13px 0 17px}
  .first-hour-page .ph-section h3{font-size:19px}
  .first-hour-page .ph-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .first-hour-page .ph-card{min-width:0;min-height:140px;padding:10px 8px}
  .first-hour-page .ph-card-head{gap:6px}
  .first-hour-page .ph-image{width:43px;height:43px;flex-basis:43px}
  .first-hour-page .ph-product{font-size:12.5px;line-height:1.25}
  .first-hour-page .ph-value{font-size:clamp(18px,5.1vw,24px);gap:4px;letter-spacing:-.5px}
  .first-hour-page .ph-picker{padding:10px}
  .first-hour-page .ph-picker-row select{flex:1 1 100%;min-width:0;min-height:44px;font-size:16px}
  .first-hour-page .ph-picker-row .btn{width:100%;min-height:44px}
  .first-hour-page .ph-remove{width:34px;height:34px;top:2px;right:2px}
  /* Sumatorios: pasos y resultados utilizables sin zoom ni scroll global. */
  .sum-wizard{padding:13px 10px 18px}
  .sum-wizard .page-heading{margin-bottom:12px}
  .sum-progress{gap:2px;margin:9px 0 15px}
  .sum-progress-step{font-size:11px;gap:5px}
  .sum-step-number{width:34px;height:34px;font-size:14px}
  .sum-stage{padding:12px;border-radius:12px}
  .sum-date-fields{grid-template-columns:minmax(0,1fr);gap:11px}
  .sum-date-fields input[type=date]{width:100%;max-width:100%;font-size:16px;min-height:48px}
  .sum-manage-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .sum-manage-actions .btn{min-width:0;min-height:44px;white-space:normal}
  .sum-manage-row{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
  .sum-manage-row select,.sum-manage-row .btn{width:100%;min-width:0;min-height:44px}
  .sum-products{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .sum-group-card{min-height:133px;padding:9px 5px}
  .sum-group-img{width:64px;height:64px}
  .sum-types{grid-template-columns:minmax(0,1fr)}
  .sum-type-card{min-height:95px}
  .sum-overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .sum-upcoming{padding:11px;gap:6px;flex-wrap:wrap}
  .sum-footer .sum-next,.sum-generate-actions .sum-print-btn{width:100%;min-height:47px}
  .sum-result{padding:9px;min-width:0}
  .sum-result-table-wrap{overflow:visible;border:0}
  .sum-result-table{display:block;width:100%;min-width:0}
  .sum-result-table thead{display:none}
  .sum-result-table tbody{display:grid;gap:8px}
  .sum-result-table tbody tr{
    display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 8px;
    background:var(--surface);border:1px solid var(--border);
    border-radius:10px;padding:11px;min-width:0;
  }
  .sum-result-table tbody tr td{
    display:block;min-width:0;border:0;padding:0;font-size:13px;
    overflow-wrap:anywhere;
  }
  .sum-result-table tbody tr td.sum-client-cell{
    grid-column:1/-1;font-size:13px;
  }
  .sum-result-table tbody tr td.sum-client-cell:empty{display:none}
  .sum-result-table tbody tr td.sum-qty-cell{
    text-align:right;white-space:nowrap;align-self:center;
  }
  .sum-result-table tbody tr td.sum-qty-cell strong{font-size:18px}
  /* Catálogo, categorías, clientes e informes: tarjetas, conservando acciones. */
  .page-card:not(.orders-page)>.table-wrap{
    width:100%;min-width:0;max-width:100%;overflow:visible;border:0;background:transparent;
  }
  .page-card:not(.orders-page)>.table-wrap>.table{
    display:block;min-width:0!important;width:100%;table-layout:auto;
  }
  .page-card:not(.orders-page)>.table-wrap>.table thead{display:none}
  .page-card:not(.orders-page)>.table-wrap>.table tbody{display:grid;gap:10px}
  .page-card:not(.orders-page)>.table-wrap>.table tbody tr{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px 10px;min-width:0;padding:12px;
    border:1px solid var(--border);border-radius:12px;
    background:var(--surface);
  }
  .page-card:not(.orders-page)>.table-wrap>.table tbody td{
    display:block;min-width:0!important;width:auto!important;height:auto;
    padding:0!important;border:0!important;font-size:13px;line-height:1.35;
    overflow-wrap:anywhere;
  }
  .page-card:not(.orders-page)>.table-wrap>.table tbody td strong{font-size:14px}
  .page-card:not(.orders-page)>.table-wrap>.table tbody td:first-child{grid-column:1/-1}
  .page-card:not(.orders-page)>.table-wrap>.table tbody td[colspan]{
    grid-column:1/-1;text-align:center;
  }
  .page-card:not(.orders-page)>.table-wrap>.table tbody tr:has(td[colspan]){display:block}
  .page-card:not(.orders-page)>.table-wrap>.table tbody .actions{
    display:flex;flex-wrap:wrap;gap:7px;width:100%;
  }
  .page-card:not(.orders-page)>.table-wrap>.table tbody .actions .btn{
    flex:1 1 auto;min-width:0;min-height:42px;padding:8px 7px;
    white-space:normal;font-size:12px;
  }
  .page-card:not(.orders-page)>.table-wrap>.table tbody .mini-photo{
    width:44px;height:44px;object-fit:contain;
  }
  .products-page .clients-toolbar,.clients-page .clients-toolbar{
    padding:10px;gap:10px;margin-bottom:13px;
  }
  .products-page .clients-search,.clients-page .clients-search{
    min-width:0;width:100%;flex:1 1 100%;max-width:100%;
  }
  .products-page .clients-toolbar-actions,.clients-page .clients-toolbar-actions{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;gap:7px;
  }
  .products-page .clients-toolbar-actions .btn,.clients-page .clients-toolbar-actions .btn{
    min-width:0;min-height:45px;white-space:normal;font-size:12px;padding:7px;
  }
  .products-page .table td:nth-child(1){grid-column:1/-1}
  .products-page .table td:nth-child(2)::before{content:"Alias: ";font-weight:750;color:var(--muted)}
  .products-page .table td:nth-child(3)::before{content:"Formato: ";font-weight:750;color:var(--muted)}
  .products-page .table td:nth-child(5){grid-column:1/-1}
  .products-page .table td:nth-child(5)::before{content:"Categoría: ";font-weight:750;color:var(--muted)}
  .products-page .table td:nth-child(6){grid-column:1/-1}
  .clients-page .table td:nth-child(2)::before{content:"Pedidos: ";font-weight:750;color:var(--muted)}
  .clients-page .table td:nth-child(3){grid-column:1/-1}
  /* Categorías: cuatro columnas originales. */
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(4):last-child) td:nth-child(2){
    grid-column:1/-1;
  }
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(4):last-child) td:nth-child(2)::before{
    content:"Categoría padre: ";font-weight:750;color:var(--muted);
  }
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(4):last-child) td:nth-child(4){
    grid-column:1/-1;
  }
  /* Informes: seis columnas; todos los campos visibles en tarjeta. */
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(1)::before{content:"Fecha: ";font-weight:750;color:var(--muted)}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(2){grid-column:1/-1}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(2)::before{content:"Cliente: ";font-weight:750;color:var(--muted)}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(3){grid-column:1/-1}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(3)::before{content:"Producto: ";font-weight:750;color:var(--muted)}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(4)::before{content:"Cantidad: ";font-size:12px;font-weight:750;color:var(--muted)}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(5)::before{content:"Formato: ";font-weight:750;color:var(--muted)}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(6){grid-column:1/-1}
  .page-card:not(.orders-page):not(.clients-page):not(.products-page) .table:has(thead th:nth-child(6):last-child) td:nth-child(6) .btn{
    min-height:42px;width:100%;
  }
  /* Detalle y formularios: aprovechan la altura real del móvil. */
  .order-drawer.order-drawer--minimal.order-drawer--centered{
    width:calc(100vw - 16px);max-width:calc(100vw - 16px);
    max-height:calc(100dvh - 16px);border-radius:14px;
  }
  .order-drawer--centered .order-drawer-content{
    padding:11px 12px 8px;overflow-y:auto;overflow-x:hidden;
  }
  .order-drawer--centered .drawer-quick-products{
    grid-template-columns:minmax(0,1fr);gap:6px;
  }
  .order-drawer--centered .drawer-quick-facts{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .order-drawer--centered .drawer-quick-item{min-width:0;grid-template-columns:34px minmax(0,1fr) auto}
  dialog,dialog.dialog-confirm[open]{
    width:calc(100vw - 22px);max-width:calc(100vw - 22px);
    max-height:calc(100dvh - 20px);
  }
  dialog .dialog-head{padding:13px 14px 8px}
  dialog .dialog-body{padding:10px 14px;max-height:calc(100dvh - 180px);overflow:auto}
  dialog .dialog-actions{padding:11px 14px 14px}
  dialog .dialog-actions .btn{flex:1;min-width:0;min-height:44px}
  .toast{left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom));max-width:none}
}
/* Móviles muy estrechos: mantener todos los botones y el catálogo en 2 columnas. */
@media screen and (max-width:350px){
  .sidebar .nav .nav-link{font-size:11px;min-height:59px}
  .orders-page .orders-table tbody tr{padding:10px 7px;gap:7px 3px}
  .orders-page .orders-table .order-icon-button{width:40px;height:42px}
  .new-order-page .new-order-product-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .new-order-page .new-order-tile{padding:7px 4px;min-height:173px}
  .new-order-page .new-order-tile-image{width:60px;height:60px}
  .new-order-page .new-order-tile .new-order-qty-controls{gap:2px}
  .new-order-page .new-order-tile .new-order-qty-controls button{font-size:19px}
  .new-order-page .new-order-tile .new-order-qty-value{font-size:15px!important}
  .first-hour-page .ph-value{font-size:18px}
}


/* Móvil exclusivamente: Primera Hora fija y retoques de cabecera/navegación.
   Sin cambios en las reglas anteriores, tablet (>=741px), PC ni impresión. */
@media screen and (max-width:740px){
  /* Ajustes ligeros solicitados en la vista móvil habitual. */
  .sidebar .brand{
    height:65px;min-height:65px;
  }
  .sidebar .brand img{
    width:146px;max-width:100%;height:64px;object-fit:contain;
  }
  .sidebar .nav .nav-link{
    min-height:70px;padding:8px 4px 7px;gap:5px;
    font-size:13px;line-height:1.15;
  }
  .sidebar .nav .nav-link .nav-symbol{
    width:35px;height:34px;min-height:34px;flex:0 0 34px;
  }
  .sidebar .nav .nav-symbol svg{width:22px;height:22px}

  /* Opciones discretas junto al título de Primera Hora (modo normal y fijo). */
  .first-hour-page .page-heading .titleblock>div{flex:1 1 0;min-width:0}
  .first-hour-page .ph-title-row{
    display:flex;flex-wrap:wrap;align-items:center;gap:5px 10px;
    width:100%;min-width:0;
  }
  .first-hour-page .ph-title-row h2{margin:0}
  .first-hour-page .ph-title-row .ph-today{font-size:18px}
  .first-hour-page .ph-mobile-options{
    position:relative;z-index:15;flex:0 0 auto;
    margin-left:auto;align-self:center;
  }
  .first-hour-page .ph-mobile-options>summary{
    list-style:none;display:grid;place-items:center;
    width:40px;height:40px;border:1px solid var(--border);
    border-radius:11px;background:#fff;color:#234c36;
    cursor:pointer;user-select:none;
  }
  .first-hour-page .ph-mobile-options>summary::-webkit-details-marker{display:none}
  .first-hour-page .ph-mobile-options>summary:focus-visible{
    outline:3px solid #79ad8c;outline-offset:2px;
  }
  .first-hour-page .ph-mobile-options[open]>summary{
    border-color:var(--primary);background:var(--soft);
  }
  .first-hour-page .ph-mobile-options-panel{
    position:absolute;top:calc(100% + 6px);right:0;
    width:min(275px,calc(100vw - 25px));
    display:grid;gap:8px;padding:9px;z-index:50;
    background:var(--surface);color:var(--text);
    border:1px solid var(--border);border-radius:12px;
    box-shadow:0 9px 32px #17332129;text-align:left;
  }
  .first-hour-page .ph-mobile-options-panel button{
    text-align:left;display:block;width:100%;min-height:45px;
    padding:10px 12px;border:0;border-radius:9px;
    background:var(--soft);color:#175d35;
    font-size:13px;font-weight:800;line-height:1.3;
    white-space:normal;
  }
  .first-hour-page .ph-mobile-options-panel p{
    margin:0;padding:0 5px 4px;color:var(--muted);
    font-size:12px;line-height:1.35;
  }

  /* Modo lectura completa: cabeceras normales y navegación ocultas SOLO
     en este móvil, cuando la preferencia local está activada. */
  body.ph-fixed-mobile{background:#fff;min-height:100dvh}
  body.ph-fixed-mobile .shell{
    display:block;width:100%;max-width:100%;min-height:100dvh;
  }
  body.ph-fixed-mobile .shell>.sidebar,
  body.ph-fixed-mobile .workspace>.topbar,
  body.ph-fixed-mobile .workspace>.app-footer{display:none!important}
  body.ph-fixed-mobile .workspace{width:100%;min-width:0;background:#fff}
  body.ph-fixed-mobile .workspace>.content{
    width:100%;max-width:100%;min-height:100dvh;
    margin:0;padding:0!important;background:#fff;
  }
  body.ph-fixed-mobile .first-hour-page{
    width:100%;min-height:100dvh;margin:0;
    padding:calc(9px + env(safe-area-inset-top)) 9px
      calc(10px + env(safe-area-inset-bottom));
    border:0;border-radius:0;box-shadow:none;background:#fff;
  }
  body.ph-fixed-mobile .first-hour-page .page-heading{
    display:flex;align-items:center;flex-wrap:nowrap;
    min-height:40px;margin:0 0 8px;gap:0;
  }
  body.ph-fixed-mobile .first-hour-page .page-heading .titleblock{
    width:100%;flex:1 1 100%;gap:0;align-items:center;
  }
  body.ph-fixed-mobile .first-hour-page .page-heading .heading-icon,
  body.ph-fixed-mobile .first-hour-page .page-heading .actions,
  body.ph-fixed-mobile .first-hour-page .page-heading .titleblock p,
  body.ph-fixed-mobile .first-hour-page .ph-picker,
  body.ph-fixed-mobile .first-hour-page .ph-remove{display:none!important}
  body.ph-fixed-mobile .first-hour-page .ph-title-row{
    width:100%;display:flex;flex-wrap:wrap;
    align-items:center;column-gap:10px;row-gap:2px;
  }
  body.ph-fixed-mobile .first-hour-page .ph-title-row h2{
    font-size:21px;font-weight:900;letter-spacing:-.5px;color:#103f2e;
  }
  body.ph-fixed-mobile .first-hour-page .ph-title-row .ph-today{
    font-size:14px;font-weight:750;color:#476558;white-space:nowrap;
  }
  body.ph-fixed-mobile .first-hour-page .ph-mobile-options>summary{
    width:38px;height:38px;border-radius:10px;
  }
  body.ph-fixed-mobile .first-hour-page .ph-section{
    margin:7px 0 9px;min-width:0;
  }
  body.ph-fixed-mobile .first-hour-page .ph-section h3{
    font-size:15px;font-weight:850;line-height:1.15;
    margin:0 0 5px;color:#103a38;
  }
  body.ph-fixed-mobile .first-hour-page .ph-grid{
    display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;min-width:0;
  }
  body.ph-fixed-mobile .first-hour-page .ph-card{
    display:flex;flex-direction:column;align-items:center;
    justify-content:center;gap:4px;min-width:0;min-height:99px;
    padding:7px 4px 6px;border-radius:10px;
    text-align:center;
  }
  body.ph-fixed-mobile .first-hour-page .ph-card-head{
    display:flex;flex-direction:column;align-items:center;
    justify-content:center;gap:2px;width:100%;min-width:0;
  }
  body.ph-fixed-mobile .first-hour-page .ph-image{
    display:block;width:39px;height:39px;flex:0 0 39px;
    max-width:100%;object-fit:contain;
  }
  body.ph-fixed-mobile .first-hour-page .ph-product{
    font-size:11.5px;font-weight:800;line-height:1.15;
    overflow-wrap:anywhere;padding:0;
  }
  body.ph-fixed-mobile .first-hour-page .ph-card .ph-value{
    display:flex;flex-wrap:wrap;align-items:baseline;
    justify-content:center;gap:2px 4px;
    margin-top:0;font-size:16px;line-height:1.1;
    white-space:normal;font-weight:900;
    letter-spacing:-.3px;
  }
  body.ph-fixed-mobile .first-hour-page .ph-card .ph-value>span{
    font:inherit;white-space:nowrap;color:inherit;
  }
  body.ph-fixed-mobile .first-hour-page .ph-card .ph-missing{
    font-size:10px;margin:0;line-height:1.2;
  }
  /* Si hay muchas referencias, densificar sin omitir ni falsificar ninguna.
     Con cargas extremas se permite scroll vertical para conservar la lectura. */
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-section{margin:5px 0 7px}
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-section h3{
    font-size:14px;margin-bottom:4px;
  }
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-grid{gap:4px}
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-card{
    min-height:82px;gap:2px;padding:4px 3px;
  }
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-image{
    width:30px;height:30px;flex-basis:30px;
  }
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-product{font-size:10.5px}
  body.ph-fixed-mobile.ph-fixed-dense .first-hour-page .ph-card .ph-value{font-size:14px}

  /* Mantener la información visible incluso en móviles de poca altura. */
}
@media screen and (max-width:740px) and (max-height:710px){
    body.ph-fixed-mobile .first-hour-page{padding-top:5px;padding-bottom:5px}
    body.ph-fixed-mobile .first-hour-page .page-heading{margin-bottom:4px}
    body.ph-fixed-mobile .first-hour-page .ph-section{margin:4px 0 6px}
    body.ph-fixed-mobile .first-hour-page .ph-card{
      min-height:80px;padding:4px 3px;gap:2px;
    }
    body.ph-fixed-mobile .first-hour-page .ph-image{
      width:30px;height:30px;flex-basis:30px;
    }
    body.ph-fixed-mobile .first-hour-page .ph-product{font-size:10.5px}
    body.ph-fixed-mobile .first-hour-page .ph-card .ph-value{font-size:14px}
}
@media screen and (max-width:350px){
  .sidebar .brand img{width:136px}
  .sidebar .nav .nav-link{font-size:12px;padding-inline:2px}
  body.ph-fixed-mobile .first-hour-page .ph-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}


/* VLM 15-10-2026: nuevo mosaico de Primera Hora FIJA, SOLO TELEFONOS.
   Nunca se aplica a la interfaz móvil normal ni a PC/tablet/iPad.
   Los iconos de cada producto son los originales: ningún asset sustituido. */
@media screen and (max-width:740px){
  html.vlm-phone body.ph-fixed-mobile .first-hour-page{
    box-sizing:border-box;
    display:grid;
    grid-template-columns:repeat(12,minmax(0,1fr));
    /* Cabecera, título Lechugas, primera fila, título Hortícolas, 2 filas */
    grid-template-rows:max-content max-content minmax(90px,1fr) max-content minmax(90px,1fr) minmax(90px,1fr);
    grid-auto-rows:minmax(90px,1fr);
    column-gap:5px;row-gap:5px;
    height:100dvh;min-height:0;max-height:100dvh;
    padding:calc(5px + env(safe-area-inset-top)) 7px calc(5px + env(safe-area-inset-bottom))!important;
    margin:0;
    overflow-x:hidden;overflow-y:auto;
    align-content:stretch;
    background:#fff;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.page-heading{
    grid-column:1/-1;
    display:block;
    width:100%;min-width:0;min-height:0;
    padding:0;margin:0 0 1px;
    align-self:center;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-title-row{
    width:100%;min-width:0;
    display:grid;grid-template-columns:minmax(0,1fr) 40px;
    grid-template-rows:auto auto;
    gap:0 6px;align-items:center;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-title-row h2{
    grid-column:1;grid-row:1;
    font-size:clamp(21px,6.3vw,28px);line-height:1.06;
    font-weight:900;margin:0;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-title-row .ph-today{
    grid-column:1;grid-row:2;font-size:13px;font-weight:750;
    line-height:1.2;margin-top:2px;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-mobile-options{
    grid-column:2;grid-row:1/3;
    margin:0;justify-self:end;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-mobile-options>summary{
    width:36px;height:36px;
  }

  /* display:contents coloca las tarjetas de todas las secciones en la misma
     rejilla sin alterar ni un nombre, una cantidad, un icono o los pedidos. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section,
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section>.ph-grid{
    display:contents!important;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section>h3{
    grid-column:1/-1;
    display:flex;align-items:center;
    min-height:0;height:auto;
    padding:4px 9px;
    border-radius:10px;
    margin:0;
    font-size:clamp(15px,4.2vw,19px);
    line-height:1.1;font-weight:900;
    background:#eaf6ed;color:#124d31;
  }
  /* Cabeceras sin dibujos, símbolos ni elementos adicionales. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section>h3::before{content:none!important}
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--pepper>h3,
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--pepper))>.ph-section--other>h3{
    font-size:0!important;background:#fff0f2;color:#5a1731;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--pepper>h3::after,
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--pepper))>.ph-section--other>h3::after{
    content:"Hortícolas";font-size:clamp(15px,4.2vw,19px);
    line-height:1.1;font-weight:900;display:block;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other>h3{
    display:none!important;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--pepper))>.ph-section--other>h3{
    display:flex!important;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card{
    box-sizing:border-box;
    grid-column:span 4;
    min-width:0;min-height:90px;height:100%;
    margin:0;padding:6px 3px 5px;
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:3px;
    border-radius:11px;
    box-shadow:none;text-align:center;
    overflow:hidden;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card--lettuce{
    background:#f4fbf5;border-color:#cde9d4;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card--pepper,
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card--other{
    background:#fff7f8;border-color:#fad8de;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card-head{
    display:flex;flex:0 1 auto;flex-direction:column;
    justify-content:center;align-items:center;gap:2px;
    min-width:0;min-height:0;width:100%;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-image{
    display:block;
    width:clamp(28px,min(14vw,9dvh),66px);
    height:clamp(28px,min(14vw,9dvh),66px);
    flex:0 1 auto;min-width:0;max-width:100%;
    object-fit:contain;
    margin:0;border:0;border-radius:0;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-product{
    display:block;width:100%;min-width:0;
    font-size:clamp(10.5px,3vw,13.5px);
    line-height:1.1;letter-spacing:-.14px;
    font-weight:850;color:#142f40;
    padding:0!important;margin:0;
    overflow-wrap:anywhere;white-space:normal;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card .ph-value{
    margin:0;min-width:0;width:100%;
    display:flex;align-items:baseline;justify-content:center;
    flex-wrap:wrap;gap:0 3px;
    line-height:1.03;letter-spacing:-.25px;
    font-variant-numeric:tabular-nums;
    white-space:normal;
    color:#075936;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card .ph-value>span:first-child{
    font-size:clamp(18px,5.8vw,29px);
    font-weight:900;line-height:1;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card .ph-value>span:last-child{
    font-size:clamp(9px,2.6vw,12px);
    font-weight:850;line-height:1.1;
    letter-spacing:-.25px;white-space:nowrap;
  }

  /* Distribución de referencia: 3 lechugas / 3 hortícolas / 4 hortícolas.
     Las tarjetas de varios siguen a las de pimiento, sin saltos ni cambios
     en los grupos de la versión móvil normal. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other .ph-card{
    grid-column:span 3;
  }
  /* 2 pimientos + 5 varios => primero de varios completa el trío superior. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:has(.ph-section--pepper .ph-card:nth-child(2):last-child)
    >.ph-section--other .ph-card:first-child{
    grid-column:span 4;
  }
  /* 1 pimiento + varios => completar el trío superior con 2 referencias. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:has(.ph-section--pepper .ph-card:first-child:last-child)
    >.ph-section--other .ph-card:nth-child(-n+2){
    grid-column:span 4;
  }
  /* Sin pimientos, la cuadrícula comienza con 3 hortícolas. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--pepper))
    >.ph-section--other .ph-card:nth-child(-n+3){
    grid-column:span 4;
  }

  /* En la segunda fila de cuatro, mantener las unidades completas y legibles. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other .ph-card{
    gap:2px;padding-inline:2px;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other .ph-product{
    font-size:clamp(9.5px,2.75vw,12px);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other .ph-card .ph-value>span:first-child{
    font-size:clamp(17px,5.2vw,26px);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section--other .ph-card .ph-value>span:last-child{
    font-size:clamp(8.5px,2.45vw,11px);
  }

  /* Con muy pocos artículos, no reservar una fila completa vacía. */
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--other)){
    grid-template-rows:max-content max-content minmax(90px,1fr) max-content minmax(90px,1fr);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--other)):not(:has(.ph-section--pepper)){
    grid-template-rows:max-content max-content minmax(90px,1fr);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page:not(:has(.ph-section--lettuce)){
    grid-template-rows:max-content max-content minmax(90px,1fr) minmax(90px,1fr);
  }
}
/* Pantallas cortas: se compactan imágenes y márgenes, nunca las cantidades. */
@media screen and (max-width:740px) and (max-height:690px){
  html.vlm-phone body.ph-fixed-mobile .first-hour-page{
    padding-top:3px!important;padding-bottom:3px!important;
    gap:3px;
    grid-template-rows:max-content max-content minmax(85px,1fr) max-content minmax(85px,1fr) minmax(85px,1fr);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-image{
    width:clamp(24px,min(12vw,6.5dvh),48px);
    height:clamp(24px,min(12vw,6.5dvh),48px);
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page .ph-card{
    min-height:85px;padding-block:3px;gap:2px;
  }
  html.vlm-phone body.ph-fixed-mobile .first-hour-page>.ph-section>h3{
    padding-block:2px;
  }
}
