/* UI compacta: selector de rango, filtros plegables, tablas configurables y modales responsivos */
.date-range-picker{position:relative;display:grid;gap:.45rem;align-self:end;min-width:260px;grid-column:span 2}.date-range-caption{font-size:.82rem;font-weight:700;color:#485267}.date-range-trigger{width:100%;height:44px;border:1px solid var(--line);border-radius:11px;background:var(--surface);display:grid;grid-template-columns:42px 1fr 26px;align-items:center;padding:0;text-align:left;color:var(--text);cursor:pointer;overflow:hidden}.date-range-trigger:hover,.date-range-trigger[aria-expanded="true"]{border-color:var(--primary);box-shadow:0 0 0 3px rgba(68,89,231,.10)}.date-range-icon{height:100%;display:grid;place-items:center;background:#2e9ea1;color:#fff;font-size:1rem}.date-range-value{padding:0 .9rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.date-range-caret{color:var(--muted);text-align:center}.date-range-popover{position:fixed;z-index:130;width:min(720px,calc(100vw - 24px));display:grid;grid-template-columns:142px minmax(0,1fr);background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 24px 70px rgba(24,35,65,.22);overflow:hidden}.date-range-popover[hidden]{display:none!important}.date-range-quick{display:grid;align-content:start;border-right:1px solid var(--line);background:var(--surface);padding:.45rem 0}.date-range-quick button{border:0;background:transparent;text-align:left;padding:.64rem .8rem;color:#586177;font-weight:650;cursor:pointer}.date-range-quick button:hover{background:var(--surface-2)}.date-range-quick button.active{background:#2f86cf;color:#fff}.date-range-main{min-width:0}.date-range-calendars{display:grid;grid-template-columns:1fr 1fr;gap:0;padding:.55rem}.range-calendar{padding:.2rem .55rem}.range-calendar+.range-calendar{border-left:1px solid var(--line)}.range-calendar-head{height:36px;display:grid;grid-template-columns:32px 1fr 32px;align-items:center;text-align:center}.range-calendar-head strong{font-size:.8rem}.range-nav{border:0;background:transparent;color:var(--text);font-size:1.55rem;line-height:1;cursor:pointer;border-radius:8px;height:30px}.range-nav:hover{background:var(--surface-2)}.range-weekdays,.range-days{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.range-weekdays span{height:25px;display:grid;place-items:center;color:#778197;font-size:.65rem;font-weight:800}.range-day{position:relative;height:29px;border:0;background:transparent;border-radius:0;color:var(--text);font-size:.69rem;cursor:pointer;z-index:0}.range-day.outside{color:#aeb6c5}.range-day:hover:before,.range-day.today:before,.range-day.selected:before{content:"";position:absolute;inset:2px;border-radius:6px;background:#e8efff;z-index:-1}.range-day.in-range:after{content:"";position:absolute;left:-2px;right:-2px;top:4px;bottom:4px;background:#e8f1fb;z-index:-2}.range-day.range-start:after{left:50%;border-radius:8px 0 0 8px}.range-day.range-end:after{right:50%;border-radius:0 8px 8px 0}.range-day.selected{color:#fff;font-weight:900}.range-day.selected:before{background:#377ec6}.range-day.today:not(.selected){font-weight:900;color:var(--primary)}.date-range-footer{border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.55rem .75rem}.date-range-summary{font-size:.68rem;color:var(--muted);font-weight:700}.date-range-actions{display:flex;gap:.45rem}.date-range-actions .button{padding:.55rem .78rem;border-radius:8px;font-size:.74rem}

.filter-collapsible{position:relative}.filter-collapse-button{position:absolute;right:1rem;top:.85rem;z-index:5;border:1px solid var(--line);background:var(--surface-2);color:var(--muted);border-radius:10px;padding:.48rem .7rem;font-size:.72rem;font-weight:800;display:flex;align-items:center;gap:.45rem;cursor:pointer}.filter-collapse-button:hover{color:var(--primary);border-color:#cfd6f0}.filter-collapse-button b{font-size:.9rem}.filter-collapsible>.panel-head{padding-right:118px}.filter-collapsible.filters-collapsed{padding-bottom:.85rem}.filter-collapsible.filters-collapsed .sales-source-row{margin-top:.55rem}.dashboard-date-panel.filter-collapsible,.recommendation-hero.filter-collapsible{padding-top:1.25rem}.dashboard-date-panel.filter-collapsible>div:first-child,.recommendation-hero.filter-collapsible>div:first-child{padding-right:125px}.quick-periods{display:none!important}

.smart-column-disclosure,.table-column-disclosure{margin:.1rem 0 .75rem}.smart-column-disclosure summary,.table-column-disclosure summary{min-height:39px}.table-column-picker{max-height:min(280px,42vh);overflow:auto}.smart-responsive-table td,.smart-responsive-table th{overflow-wrap:anywhere}.smart-responsive-table[style*="min-width: 100%"]{min-width:100%!important}.system-column-disclosure+.table-wrap{border-radius:12px}.table-wrap{max-width:100%}

/* Los modales informativos se mantienen dentro del viewport y distribuyen la información en columnas. */
.smart-modal-open{overflow:hidden}.modal.open{padding:clamp(8px,2vh,18px);overflow:hidden}.modal.open>.order-detail-card,.modal.open>.scanner-card,.modal.open>.export-preview-card{max-height:calc(100dvh - 24px);margin:auto}.order-detail-card,.sales-stat-card{width:min(920px,calc(100vw - 24px));padding:clamp(.85rem,1.8vw,1.35rem);overflow:hidden;display:flex;flex-direction:column;gap:.7rem}.order-detail-heading h2{margin:.3rem 0 .1rem}.order-detail-heading p{margin:.15rem 0;font-size:.75rem}.order-detail-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem;min-height:0}.order-detail-section{margin:0!important;padding:.7rem!important;border-radius:12px}.order-detail-section h3{margin:0 0 .48rem;font-size:.82rem}.order-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.42rem}.order-detail-field{padding:.46rem .55rem!important;min-width:0}.order-detail-field small{font-size:.62rem}.order-detail-field strong{font-size:.75rem;overflow-wrap:anywhere}.order-detail-card>.form-actions{margin-top:0;justify-content:flex-end}.order-receipt>div{padding:.48rem .6rem}.order-receipt .receipt-total{padding:.62rem .72rem;font-size:.95rem}.sales-stat-card .order-detail-content{grid-template-columns:1fr 1fr}.export-preview-card{width:min(1200px,calc(100vw - 24px));padding:1rem;overflow:hidden;display:flex;flex-direction:column}.export-preview-table{min-height:0;overflow:auto;flex:1}.scanner-card{max-height:calc(100dvh - 24px);overflow:hidden;padding:clamp(1rem,3vh,1.6rem)}

@media(max-width:980px){.date-range-picker{grid-column:1/-1}.filter-collapse-button{top:.7rem}.order-detail-content{grid-template-columns:1fr}.order-detail-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.sales-stat-card .order-detail-content{grid-template-columns:1fr 1fr}}
@media(max-width:760px){
  .content{padding-left:.8rem!important;padding-right:.8rem!important}.panel{padding:.9rem;border-radius:14px}.date-range-picker{grid-column:1/-1!important;min-width:0;width:100%}.date-range-popover{inset:8px!important;width:auto;height:auto;max-height:calc(100dvh - 16px);grid-template-columns:1fr;grid-template-rows:auto 1fr;border-radius:14px}.date-range-quick{grid-template-columns:repeat(3,1fr);border-right:0;border-bottom:1px solid var(--line);padding:.35rem}.date-range-quick button{text-align:center;padding:.52rem .25rem;border-radius:8px;font-size:.68rem}.date-range-main{display:grid;grid-template-rows:1fr auto;min-height:0}.date-range-calendars{grid-template-columns:1fr;padding:.35rem;min-height:0}.range-calendar{padding:.25rem .4rem}.range-calendar[data-side="right"]{display:none}.range-calendar+.range-calendar{border-left:0}.range-day{height:min(6.2vh,40px);font-size:.76rem}.range-weekdays span{height:26px}.date-range-footer{padding:.5rem;display:grid;grid-template-columns:1fr auto}.date-range-summary{font-size:.65rem}.date-range-actions .button{padding:.52rem .65rem}.filter-collapse-button{position:relative;right:auto;top:auto;margin:0 0 .65rem auto;width:max-content}.filter-collapsible>.panel-head{padding-right:0}.dashboard-date-panel.filter-collapsible>div:first-child,.recommendation-hero.filter-collapsible>div:first-child{padding-right:0}.filter-collapsible.filters-collapsed{padding-bottom:.75rem}

  .table-wrap:has(.smart-responsive-table){overflow:visible}.smart-responsive-table{display:block!important;min-width:0!important;width:100%!important;table-layout:auto!important}.smart-responsive-table thead{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.smart-responsive-table tbody,.smart-responsive-table tfoot{display:grid;gap:.65rem}.smart-responsive-table tbody tr,.smart-responsive-table tfoot tr{display:grid!important;gap:0;padding:.7rem .75rem;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 18px rgba(25,37,68,.04)}.smart-responsive-table tbody tr:hover{background:var(--surface)}.smart-responsive-table td:not([hidden]),.smart-responsive-table tfoot th:not([hidden]){display:flex!important;align-items:flex-start;justify-content:space-between;gap:.85rem;width:100%!important;padding:.38rem 0!important;border:0!important;text-align:right!important;min-width:0}.smart-responsive-table td:not([hidden])::before,.smart-responsive-table tfoot th:not([hidden])::before{content:attr(data-label);font-weight:800;color:var(--muted);font-size:.68rem;text-transform:none;letter-spacing:0;text-align:left;flex:0 0 42%}.smart-responsive-table td:first-child:not([hidden]){padding-top:.12rem!important;font-weight:800}.smart-responsive-table .item-cell{min-width:0;width:100%;text-align:left}.smart-responsive-table .empty{display:block!important;text-align:center!important;padding:1.3rem!important}.smart-responsive-table .empty::before{display:none}.smart-responsive-table tfoot th:not([hidden]){font-size:.75rem}.smart-responsive-table tfoot th:not([hidden])::before{content:attr(data-label)}.table-column-picker{grid-template-columns:1fr 1fr!important;max-height:42vh}

  .modal.open{padding:4px}.order-detail-card,.sales-stat-card,.scanner-card,.export-preview-card{width:100%!important;max-height:calc(100dvh - 8px)!important;border-radius:14px!important;padding:.75rem!important}.order-detail-content,.sales-stat-card .order-detail-content{grid-template-columns:1fr 1fr;gap:.4rem}.order-detail-section{padding:.55rem!important}.order-detail-grid{grid-template-columns:1fr 1fr;gap:.3rem}.order-detail-field{padding:.38rem .42rem!important}.order-detail-card>.form-actions{display:grid;grid-template-columns:1fr 1fr;gap:.4rem}.order-detail-card>.form-actions .button{width:100%;padding:.55rem}.export-preview-card>.panel-head{margin-bottom:.45rem}.export-preview-actions{display:grid;grid-template-columns:1fr 1fr}.export-preview-actions>*:last-child{grid-column:1/-1}.product-analysis-modal{padding:4px!important}.product-analysis-modal-card{width:100%!important;max-width:none!important;border-radius:14px!important;padding:.45rem!important}
}
@media(max-width:480px){.date-range-quick{grid-template-columns:repeat(2,1fr)}.range-day{height:min(5.4vh,36px)}.date-range-footer{grid-template-columns:1fr}.date-range-actions{justify-content:flex-end}.table-column-picker{grid-template-columns:1fr!important}.order-detail-content,.sales-stat-card .order-detail-content{grid-template-columns:1fr 1fr}.order-detail-grid{grid-template-columns:1fr}.order-detail-heading p{font-size:.68rem}.order-detail-card>.form-actions{grid-template-columns:1fr 1fr}.date-range-value{font-size:.78rem;padding:0 .65rem}}
.mobile-next{display:none}@media(max-width:760px){.mobile-next{display:block}}
[hidden]{display:none!important}

/* Ajuste v3: tablas legibles, scroll horizontal controlado y cabecera sticky sin solapamientos. */
@media(min-width:761px){
  .table-wrap{overflow-x:auto!important;overflow-y:visible;max-width:100%;scrollbar-gutter:stable;overscroll-behavior-inline:contain}
  .table-wrap.has-horizontal-table-scroll{padding-bottom:.2rem}
  .smart-responsive-table{max-width:none!important}
  .smart-responsive-table th,.smart-responsive-table td{min-width:0;vertical-align:middle}
  .sticky-table-clone{overflow:hidden!important;contain:paint;isolation:isolate;border-left:1px solid var(--line);border-right:1px solid var(--line)}
  .sticky-table-clone table{max-width:none!important}
}

/* Deducibles: tarjetas editables y resumen de utilidad neta. */
.deduction-card{display:grid;gap:.8rem;padding:1rem;border:1px solid var(--line);border-radius:14px;background:var(--surface-2);margin-bottom:.8rem}.deduction-card.inactive{opacity:.55}.deduction-card-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:.65rem;align-items:end}.deduction-card-fields label{min-width:0}.deduction-card-fields small,.deduction-card-meta small{color:var(--muted);font-weight:700;font-size:.68rem}.deduction-card-meta{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap}.deduction-card-actions{display:flex;gap:.5rem;flex-wrap:wrap}.deduction-card-side{display:grid;gap:.2rem;justify-items:start}.deduction-card-side strong{font-size:1.05rem}.deduction-check{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}.deduction-check input{width:auto}.net-panel-actions{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}.profit-deduction-strip{display:flex;justify-content:space-between;gap:.6rem;flex-wrap:wrap;margin-top:.7rem;padding-top:.7rem;border-top:1px solid var(--line)}.profit-deduction-strip b{font-size:.95rem}.row-off{opacity:.55}

/* Ajuste v3: los popups normales se distribuyen para caber; scroll solo queda como respaldo extremo. */
.smart-modal-open{overflow:hidden}
.modal.open:not(.product-analysis-modal){padding:clamp(8px,1.5vh,16px)!important;overflow:auto!important;align-items:center;justify-items:center}
.modal.open:not(.product-analysis-modal)>.order-detail-card,
.modal.open:not(.product-analysis-modal)>.scanner-card,
.modal.open:not(.product-analysis-modal)>.export-preview-card{margin:auto;max-height:calc(100dvh - 20px);overflow:auto}
.order-detail-card{width:min(1180px,calc(100vw - 28px));padding:clamp(.75rem,1.3vw,1rem);gap:.55rem}
.order-detail-heading h2{font-size:clamp(1.2rem,2vw,1.55rem);margin:.2rem 0 .08rem}
.order-detail-heading p{font-size:.69rem}
.order-detail-content{gap:.5rem;margin:.55rem 0!important}
.order-detail-section{padding:.58rem!important;border-radius:11px}
.order-detail-section h3{margin:0 0 .38rem;font-size:.75rem}
.order-detail-grid{gap:.32rem}
.order-detail-field{padding:.38rem .45rem!important;border-radius:8px}
.order-detail-field small{font-size:.58rem;margin-bottom:.12rem}
.order-detail-field strong{font-size:.71rem;line-height:1.25}
.order-receipt>div{padding:.38rem .48rem!important;font-size:.72rem}
.order-receipt .receipt-total{padding:.48rem .55rem!important;font-size:.86rem!important}
.sales-stat-card{width:min(940px,calc(100vw - 28px))}
.sales-stat-card .order-detail-content{grid-template-columns:repeat(2,minmax(0,1fr))}
.scanner-card{overflow:visible!important}
.recent-scans>div.recent-scan{align-items:center;gap:.75rem}
.recent-scans>div.recent-scan>div{display:grid;min-width:0}
.recent-scans>div.recent-scan small{color:var(--muted);font-size:.68rem;overflow-wrap:anywhere}
.recent-scans>div.recent-scan>span{font-weight:900;color:var(--primary);white-space:nowrap}
.recent-scans>div.variation-scan{border-color:rgba(68,89,231,.28);background:#f6f7ff}

@media(min-width:1000px){
  #generalOrderDetailModal .order-detail-content{grid-template-columns:minmax(0,.9fr) minmax(0,1.15fr) minmax(0,1.2fr) minmax(210px,.82fr)}
  #generalOrderDetailModal .order-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  #generalOrderDetailModal .receipt-section{height:100%}
  #salesStatModal .order-detail-content{grid-template-columns:repeat(2,minmax(0,1fr))}
  #salesStatModal .order-detail-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* El análisis de producto es un dashboard grande: nunca se bloquea. Se compacta y, solo si físicamente no cabe, el modal puede desplazarse. */
.product-analysis-modal{overflow:auto!important;align-items:start!important;place-items:start center!important;padding:clamp(5px,1vh,10px)!important}
.product-analysis-modal-card{width:min(1480px,calc(100vw - 12px))!important;max-height:none!important;overflow:visible!important;padding:.65rem!important;border-radius:17px!important}
.product-analysis-modal .panel{padding:.72rem!important;margin-bottom:.65rem!important;border-radius:13px;box-shadow:0 6px 20px rgba(25,37,68,.05)}
.product-analysis-modal .panel-head{margin-bottom:.5rem}
.product-analysis-modal .panel-head h3{font-size:.88rem}
.product-analysis-modal .panel-head p{font-size:.68rem}
.product-analysis-modal .product-profile-main{gap:.75rem}
.product-analysis-modal .product-profile-main>img,.product-analysis-modal .product-profile-placeholder{width:78px;height:78px;flex-basis:78px;border-radius:12px}
.product-analysis-modal .product-profile-main h2{font-size:clamp(1.1rem,1.8vw,1.5rem);margin:.25rem 0 .2rem}
.product-analysis-modal .product-profile-main p{font-size:.72rem;line-height:1.3;max-width:820px}
.product-analysis-modal .product-identifiers{margin-top:.38rem;gap:.3rem}
.product-analysis-modal .product-identifiers>*{padding:.25rem .4rem;font-size:.65rem}
.product-analysis-modal .product-tag-list{margin-top:.35rem;gap:.28rem}
.product-analysis-modal .product-tag-list span{padding:.22rem .4rem;font-size:.62rem}
.product-analysis-modal .product-analysis-kpis{gap:.5rem;margin-bottom:.65rem}
.product-analysis-modal .product-analysis-kpis article{padding:.55rem .62rem;border-radius:11px;box-shadow:none;gap:.14rem}
.product-analysis-modal .product-analysis-kpis small,.product-analysis-modal .product-analysis-kpis span{font-size:.61rem}
.product-analysis-modal .product-analysis-kpis strong{font-size:.92rem}
.product-analysis-modal .product-analysis-grid{gap:.65rem}
.product-analysis-modal .product-monthly-chart{min-height:170px;gap:.35rem;padding:.35rem .1rem 0}
.product-analysis-modal .product-month-column{min-width:58px;grid-template-rows:minmax(108px,1fr) auto auto;gap:.18rem}
.product-analysis-modal .product-month-column>strong{font-size:.62rem}
.product-analysis-modal .product-month-column>small{font-size:.58rem}
.product-analysis-modal .stock-gauge{width:122px;height:122px;margin:.2rem auto .45rem}
.product-analysis-modal .stock-gauge strong{font-size:1.25rem}
.product-analysis-modal .stock-gauge span{font-size:.61rem}
.product-analysis-modal .analysis-definition-list{gap:.28rem}
.product-analysis-modal .analysis-definition-list>div{padding:.38rem .45rem;border-radius:7px}
.product-analysis-modal .analysis-definition-list dt{font-size:.62rem}
.product-analysis-modal .analysis-definition-list dd{font-size:.67rem}
.product-analysis-modal .bar-chart{gap:.38rem}
.product-analysis-modal .bar-row{grid-template-columns:minmax(95px,1.2fr) minmax(90px,2fr) auto;gap:.45rem;font-size:.66rem}
.product-analysis-modal .bar-row i{height:7px}
.product-analysis-modal .inline-legend{font-size:.62rem}

@media(max-width:999px){
  .order-detail-content{grid-template-columns:1fr 1fr!important}
  .order-detail-grid{grid-template-columns:1fr 1fr!important}
  .product-analysis-modal .product-analysis-kpis{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:760px){
  .table-wrap:has(.smart-responsive-table){overflow:visible!important}
  .modal.open:not(.product-analysis-modal){padding:4px!important;overflow:auto!important}
  .order-detail-card,.sales-stat-card,.scanner-card,.export-preview-card{max-height:none!important;overflow:visible!important}
  .order-detail-content,.sales-stat-card .order-detail-content{grid-template-columns:1fr!important}
  .order-detail-grid{grid-template-columns:1fr 1fr!important}
  .product-analysis-modal-card{width:100%!important;padding:.4rem!important;border-radius:12px!important}
  .product-analysis-modal .product-analysis-kpis{grid-template-columns:1fr 1fr!important}
  .product-analysis-modal .product-analysis-grid,.product-analysis-modal .product-analysis-grid.three{grid-template-columns:1fr!important}
  .product-analysis-modal .product-monthly-chart{min-height:150px}
}
@media(max-width:480px){
  .order-detail-grid{grid-template-columns:1fr!important}
  .product-analysis-modal .product-analysis-kpis{grid-template-columns:1fr 1fr!important}
}

/* =========================================================
   Ajuste v4 - filtros por superficie, tablas y modal análisis
   ========================================================= */

/* El panel/div de filtros es el disparador; no existe botón X adicional. */
.filter-collapse-button{display:none!important}
.filter-collapsible{cursor:default}
.filter-toggle-surface{position:relative;cursor:pointer;user-select:none;outline:none;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding-right:1rem!important;min-height:72px;border-radius:1rem;transition:background .16s ease,box-shadow .16s ease,border-color .16s ease}
.filter-toggle-surface:hover,.filter-toggle-surface:focus-visible{background:rgba(79,70,229,.03)}
.filter-toggle-surface::after{content:"";position:absolute;right:.85rem;top:.65rem;width:24px;height:24px;border-top:3px solid rgba(79,70,229,.42);border-right:3px solid rgba(79,70,229,.42);border-top-right-radius:12px;opacity:.95;transition:border-color .16s ease,transform .16s ease,opacity .16s ease}
.filter-toggle-surface:hover::after,.filter-toggle-surface:focus-visible::after{border-top-color:rgba(79,70,229,.75);border-right-color:rgba(79,70,229,.75);transform:translate(-1px,1px)}
.filter-collapsible.filters-collapsed .filter-toggle-surface{margin-bottom:0!important}
.filter-collapsible.filters-collapsed{padding-bottom:1rem}
.filter-collapsible.filters-collapsed .panel-head p{margin-bottom:0}
.filter-toggle-heading{display:flex;flex-direction:column;gap:.18rem;min-width:0}
.filter-toggle-heading h1,.filter-toggle-heading h2,.filter-toggle-heading h3,.filter-toggle-heading h4,.filter-toggle-heading h5,.filter-toggle-heading h6{margin:0;font-size:1.02rem;line-height:1.2;color:var(--text)}
.filter-toggle-heading p,.filter-toggle-surface p{margin:.05rem 0 0;font-size:.84rem;color:var(--muted)}
.filter-toggle-status{margin-left:auto;display:inline-flex;align-items:center;justify-content:center;padding:.38rem .72rem;border-radius:999px;background:#eef2ff;color:#3f51b5;border:1px solid #dfe3fb;font-size:.78rem;font-weight:800;white-space:nowrap;max-width:48%;text-align:center}
.filter-generated-head{margin-bottom:.2rem}
.filter-generated-head + .filter-collapsible-body{margin-top:.4rem}

/* Acciones = columna estructural, nunca opción removible. */
.required-column-option{opacity:1!important;background:#f4f6ff!important;border-color:#dfe3fb!important}
.required-column-option input{accent-color:var(--primary)}
.required-column-option span{font-weight:850;color:var(--primary)}
.smart-action-column{white-space:nowrap}

/* La vista recomendada cabe sin superponer columnas. Si el usuario habilita más,
   aparece scroll horizontal real en vez de comprimir/solapar contenido. */
@media(min-width:761px){
  .table-wrap.has-horizontal-table-scroll{overflow-x:auto!important;overflow-y:visible!important}
  .smart-responsive-table{border-spacing:0;max-width:none!important}
  .smart-responsive-table th:not([hidden]),.smart-responsive-table td:not([hidden]){position:relative;overflow:visible;text-overflow:clip}
  .smart-responsive-table td:not([hidden]){white-space:normal}
  .smart-responsive-table .smart-action-column{white-space:nowrap}
}

/* ---------- Restauración visual del popup de análisis de producto ---------- */
.product-analysis-modal.open{
  display:grid!important;
  place-items:center!important;
  padding:16px!important;
  overflow:hidden!important;
}
.product-analysis-modal>.modal-backdrop{
  z-index:0;
  cursor:pointer;
}
.product-analysis-modal-card{
  z-index:1;
  position:relative;
  width:min(1180px,calc(100vw - 32px))!important;
  height:min(720px,calc(100dvh - 32px));
  max-height:calc(100dvh - 32px)!important;
  margin:0!important;
  padding:0!important;
  overflow:hidden!important;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  border:1px solid rgba(226,232,242,.96);
  border-radius:20px!important;
  background:var(--surface)!important;
  box-shadow:0 28px 85px rgba(7,13,30,.34)!important;
}
.pa-modal-header{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:1rem;
  padding:.82rem 1rem;
  border-bottom:1px solid var(--line);
  background:linear-gradient(135deg,var(--surface) 68%,#f1f3ff);
}
.pa-product-summary{display:grid;grid-template-columns:68px minmax(0,1fr);align-items:center;gap:.82rem;min-width:0}
.pa-product-summary>img,.pa-product-summary>.product-profile-placeholder{width:68px;height:68px;border-radius:13px;object-fit:cover;border:1px solid var(--line);background:var(--surface-2)}
.pa-product-summary>.product-profile-placeholder{display:grid;place-items:center;font-size:1.6rem;color:var(--primary)}
.pa-product-copy{min-width:0}
.pa-title-row{display:flex;align-items:center;gap:.45rem;flex-wrap:wrap;margin-bottom:.2rem}
.pa-period-badge{display:inline-flex;align-items:center;padding:.25rem .48rem;border-radius:999px;background:#eef7f7;color:#277e81;font-size:.63rem;font-weight:850}
.pa-product-copy h2{margin:.08rem 0 .16rem;font-size:clamp(1.12rem,1.7vw,1.42rem);line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pa-product-copy>p{margin:0;color:var(--muted);font-size:.7rem;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-width:760px}
.pa-product-copy .product-identifiers{margin-top:.34rem;gap:.28rem}
.pa-product-copy .product-identifiers>*{padding:.22rem .38rem;font-size:.61rem;border-radius:7px}
.pa-header-actions{display:flex;align-items:center;gap:.45rem;flex-wrap:nowrap}
.pa-header-actions .button{padding:.58rem .72rem;font-size:.7rem;white-space:nowrap}

.pa-modal-tabs{
  display:flex;
  align-items:center;
  gap:.3rem;
  padding:.38rem .7rem;
  border-bottom:1px solid var(--line);
  background:var(--surface-2);
}
.pa-modal-tabs button{border:0;background:transparent;color:var(--muted);padding:.48rem .72rem;border-radius:9px;font-size:.69rem;font-weight:850;cursor:pointer;transition:.15s}
.pa-modal-tabs button:hover{background:var(--surface);color:var(--primary)}
.pa-modal-tabs button.active{background:var(--surface);color:var(--primary);box-shadow:0 2px 10px rgba(29,42,82,.08)}

.pa-modal-body{min-height:0;overflow:hidden;padding:.72rem;background:var(--bg)}
.pa-tab-panel{height:100%;min-height:0}
.pa-tab-panel[hidden]{display:none!important}
.pa-tab-panel.active{display:block}

.pa-kpi-strip{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:.46rem;margin-bottom:.58rem}
.pa-kpi-strip article{min-width:0;padding:.56rem .62rem;border:1px solid var(--line);border-radius:11px;background:var(--surface);box-shadow:0 5px 16px rgba(25,37,68,.035)}
.pa-kpi-strip small,.pa-kpi-strip span{display:block;color:var(--muted);font-size:.59rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pa-kpi-strip strong{display:block;margin:.08rem 0;font-size:.9rem;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.pa-summary-grid{display:grid;grid-template-columns:minmax(0,1.9fr) minmax(250px,.72fr);gap:.58rem;height:calc(100% - 77px);min-height:0}
.pa-commercial-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.58rem;height:100%;min-height:0}
.pa-detail-grid{display:grid;grid-template-columns:minmax(280px,.78fr) minmax(0,1.7fr);gap:.58rem;height:100%;min-height:0}
.pa-card{min-width:0;min-height:0;padding:.68rem;border:1px solid var(--line);border-radius:13px;background:var(--surface);box-shadow:0 6px 20px rgba(25,37,68,.04);overflow:hidden}
.pa-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:.55rem;margin-bottom:.38rem}
.pa-card-head h3{margin:0;font-size:.79rem;line-height:1.2}
.pa-card-head p{margin:.12rem 0 0;color:var(--muted);font-size:.61rem;line-height:1.3}
.pa-monthly-card,.pa-stock-card,.pa-bar-card,.pa-commercial-summary,.pa-source-card,.pa-variations-card{display:flex;flex-direction:column}

.pa-monthly-chart{
  position:relative;
  flex:1;
  min-height:0!important;
  height:auto!important;
  margin-top:.15rem;
  padding:.48rem .18rem .05rem!important;
  gap:.35rem!important;
  overflow-x:auto;
  overflow-y:hidden;
  background:repeating-linear-gradient(to bottom,transparent 0,transparent calc(25% - 1px),rgba(228,233,241,.7) 25%);
  border-radius:8px;
}
.pa-monthly-chart .product-month-column{min-width:54px!important;grid-template-rows:minmax(112px,1fr) auto auto!important;gap:.18rem!important}
.pa-monthly-chart .product-month-bars{border-bottom-color:#dfe4ed}
.pa-monthly-chart .product-month-bars i,.pa-monthly-chart .product-month-bars b{width:31%;border-radius:5px 5px 1px 1px;box-shadow:0 2px 6px rgba(25,37,68,.08)}
.pa-monthly-chart .product-month-column>strong{font-size:.6rem!important}
.pa-monthly-chart .product-month-column>small{font-size:.54rem!important;white-space:nowrap}
.pa-monthly-card .inline-legend{margin:.25rem 0 0;font-size:.59rem;justify-content:flex-end}

.pa-stock-card{justify-content:flex-start}
.pa-stock-status{padding:.22rem .42rem;border-radius:999px;font-size:.58rem;font-weight:900;white-space:nowrap}
.pa-stock-status.ok{background:#e7f8f1;color:#117650}.pa-stock-status.warning{background:#fff3df;color:#9a570a}
.pa-stock-values{display:grid;grid-template-columns:1fr auto 1fr;align-items:end;gap:.55rem;padding:.36rem .1rem .32rem;text-align:center}
.pa-stock-values>div{display:grid;gap:.05rem}.pa-stock-values small{color:var(--muted);font-size:.58rem}.pa-stock-values strong{font-size:1.25rem}.pa-stock-values>span{color:var(--muted);padding-bottom:.14rem;font-weight:900}
.pa-stock-track{height:9px;border-radius:999px;background:var(--surface-2);overflow:hidden;margin-bottom:.42rem}.pa-stock-track i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--primary-2))}
.pa-compact-definitions{display:grid;grid-template-columns:1fr 1fr;gap:.28rem;margin:0;min-height:0}
.pa-compact-definitions>div{min-width:0;padding:.34rem .4rem;border-radius:7px;background:var(--surface-2)}
.pa-compact-definitions dt{color:var(--muted);font-size:.56rem}.pa-compact-definitions dd{margin:.08rem 0 0;font-size:.64rem;font-weight:800;overflow-wrap:anywhere}
.pa-commercial-summary .pa-compact-definitions,.pa-source-definitions{grid-template-columns:1fr!important}
.pa-source-card .product-tag-list{margin:.12rem 0 .38rem;gap:.24rem}.pa-source-card .product-tag-list span{padding:.2rem .36rem;font-size:.57rem}
.pa-source-card .cabys-analysis-check{margin-top:.42rem;padding:.5rem .65rem;font-size:.67rem}
.pa-source-card .cabys-analysis-result{margin:.3rem 0 0;font-size:.62rem;min-height:1em}

.pa-bar-chart{min-height:0;overflow:auto;padding-right:.15rem}
.pa-bar-chart .bar-row{grid-template-columns:minmax(78px,1fr) minmax(72px,1.3fr) auto!important;gap:.35rem!important;min-height:30px;font-size:.61rem!important}
.pa-bar-chart .bar-row i{height:7px!important}.pa-bar-chart .bar-row strong{font-size:.59rem;white-space:nowrap}
.pa-variations-table-wrap{min-height:0;overflow:auto!important;border:1px solid var(--line);border-radius:10px}
.pa-variations-table{min-width:680px!important}.pa-variations-table th{position:sticky;top:0;z-index:2;background:var(--surface);font-size:.61rem;padding:.48rem .55rem}.pa-variations-table td{padding:.48rem .55rem;font-size:.68rem}.pa-variations-table .item-cell{min-width:180px}.pa-variations-table .item-cell img{width:32px;height:32px}

@media(max-width:1050px){
  .product-analysis-modal.open{padding:8px!important}
  .product-analysis-modal-card{width:calc(100vw - 16px)!important;height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)!important;border-radius:16px!important}
  .pa-modal-header{padding:.68rem .75rem}.pa-product-summary{grid-template-columns:58px minmax(0,1fr)}.pa-product-summary>img,.pa-product-summary>.product-profile-placeholder{width:58px;height:58px}
  .pa-kpi-strip{grid-template-columns:repeat(3,minmax(0,1fr))}.pa-summary-grid{height:calc(100% - 132px)}
  .pa-commercial-grid{grid-template-columns:1fr 1fr}.pa-commercial-summary{grid-column:1/-1}.pa-commercial-summary .pa-compact-definitions{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}

@media(max-width:760px){
  .filter-toggle-surface{padding-right:.9rem!important;min-height:68px;gap:.75rem}
  .filter-toggle-surface::after{right:.7rem;top:.55rem;width:20px;height:20px}
  .product-analysis-modal.open{padding:0!important;place-items:stretch!important}
  .product-analysis-modal-card{width:100vw!important;height:100dvh!important;max-height:100dvh!important;border-radius:0!important;border:0!important}
  .pa-modal-header{grid-template-columns:1fr;gap:.5rem;padding:.62rem .7rem}.pa-product-summary{grid-template-columns:52px minmax(0,1fr);gap:.58rem}.pa-product-summary>img,.pa-product-summary>.product-profile-placeholder{width:52px;height:52px;border-radius:10px}.pa-product-copy h2{font-size:1rem}.pa-product-copy>p{font-size:.65rem;-webkit-line-clamp:1}.pa-header-actions{display:grid;grid-template-columns:1fr 1fr}.pa-header-actions .button{width:100%;padding:.5rem}
  .pa-modal-tabs{overflow-x:auto;justify-content:flex-start;padding:.32rem .48rem}.pa-modal-tabs button{flex:0 0 auto;padding:.46rem .62rem}
  .pa-modal-body{overflow:auto;padding:.52rem}
  .pa-tab-panel{height:auto;min-height:100%}
  .pa-kpi-strip{grid-template-columns:1fr 1fr;gap:.38rem;margin-bottom:.45rem}.pa-kpi-strip article{padding:.48rem .52rem}
  .pa-summary-grid,.pa-commercial-grid,.pa-detail-grid{display:grid;grid-template-columns:1fr;height:auto;gap:.48rem}.pa-commercial-summary{grid-column:auto}
  .pa-commercial-summary .pa-compact-definitions{grid-template-columns:1fr 1fr!important}
  .pa-monthly-card{min-height:280px}.pa-stock-card{min-height:auto}.pa-monthly-chart{min-height:190px!important}.pa-bar-card{max-height:none}.pa-bar-chart{overflow:visible}
  .pa-variations-table-wrap{max-height:none;overflow-x:auto!important;overflow-y:visible!important}
}

@media(max-width:430px){
  .pa-product-copy .product-identifiers>*:nth-child(2){display:none}
  .pa-kpi-strip{grid-template-columns:1fr 1fr}.pa-kpi-strip strong{font-size:.82rem}
  .pa-compact-definitions,.pa-commercial-summary .pa-compact-definitions{grid-template-columns:1fr!important}
}
.product-analysis-modal>.modal-backdrop{border:0;padding:0;width:auto;height:auto}

/* =========================================================
   Ajuste v5 - legibilidad de popups + detalle Nidux
   ========================================================= */

/* Conserva la distribución compacta, pero devuelve una escala tipográfica cómoda. */
.order-detail-heading p{font-size:.8rem!important;line-height:1.4}
.order-detail-section h3{font-size:.88rem!important}
.order-detail-field small{font-size:.68rem!important;line-height:1.25}
.order-detail-field strong{font-size:.84rem!important;line-height:1.35}
.order-receipt>div{font-size:.8rem!important}
.order-receipt .receipt-total{font-size:1rem!important}

/* La información viva de Nidux ocupa una franja completa para no estrechar los otros bloques. */
#generalOrderDetailModal .nidux-live-section{grid-column:1/-1}
#generalOrderDetailModal .nidux-live-section .order-detail-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
.nidux-live-status{margin:.48rem 0 0;padding:.48rem .58rem;border-radius:9px;background:var(--surface);color:var(--muted);font-size:.74rem;line-height:1.35}
.nidux-live-status.success{background:#e8f8f1;color:#117650}
.nidux-live-status.warning{background:#fff3df;color:#9a570a}
.nidux-response-details{margin-top:.45rem;border-top:1px dashed var(--line);padding-top:.42rem}
.nidux-response-details summary{cursor:pointer;color:var(--primary);font-size:.72rem;font-weight:800}
.nidux-extra-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.35rem;margin-top:.42rem}

/* Popup de análisis: misma estructura visual, tipografía más legible. */
.pa-period-badge{font-size:.7rem!important}
.pa-product-copy h2{font-size:clamp(1.28rem,1.9vw,1.65rem)!important}
.pa-product-copy>p{font-size:.8rem!important;line-height:1.42!important}
.pa-product-copy .product-identifiers>*{font-size:.69rem!important}
.pa-header-actions .button{font-size:.76rem!important}
.pa-modal-tabs button{font-size:.76rem!important}
.pa-kpi-strip small,.pa-kpi-strip span{font-size:.68rem!important}
.pa-kpi-strip strong{font-size:1.03rem!important}
.pa-card-head h3{font-size:.88rem!important}
.pa-card-head p{font-size:.69rem!important;line-height:1.35}
.pa-monthly-chart .product-month-column>strong{font-size:.67rem!important}
.pa-monthly-chart .product-month-column>small{font-size:.61rem!important}
.pa-monthly-card .inline-legend{font-size:.66rem!important}
.pa-stock-status{font-size:.65rem!important}
.pa-stock-values small{font-size:.65rem!important}
.pa-stock-values strong{font-size:1.38rem!important}
.pa-compact-definitions dt{font-size:.64rem!important}
.pa-compact-definitions dd{font-size:.73rem!important;line-height:1.3}
.pa-source-card .product-tag-list span{font-size:.64rem!important}
.pa-source-card .cabys-analysis-check{font-size:.73rem!important}
.pa-source-card .cabys-analysis-result{font-size:.69rem!important}
.pa-bar-chart .bar-row{font-size:.69rem!important}
.pa-bar-chart .bar-row strong{font-size:.67rem!important}
.pa-variations-table th{font-size:.68rem!important}
.pa-variations-table td{font-size:.75rem!important}
.pa-modal-body{overflow:auto!important}

/* La columna de acciones conserva el extremo derecho visual. */
.smart-action-column,[data-actions]{white-space:nowrap;text-align:right}
.smart-responsive-table th.smart-action-column{white-space:nowrap}

@media(max-width:1050px){
  #generalOrderDetailModal .nidux-live-section .order-detail-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .nidux-extra-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  .order-detail-field small{font-size:.72rem!important}.order-detail-field strong{font-size:.86rem!important}
  #generalOrderDetailModal .nidux-live-section .order-detail-grid,.nidux-extra-grid{grid-template-columns:1fr 1fr}
  .pa-product-copy h2{font-size:1.12rem!important}.pa-product-copy>p{font-size:.72rem!important}
  .pa-modal-tabs button{font-size:.74rem!important}.pa-kpi-strip small,.pa-kpi-strip span{font-size:.66rem!important}.pa-kpi-strip strong{font-size:.98rem!important}
  .pa-card-head h3{font-size:.84rem!important}.pa-card-head p{font-size:.67rem!important}.pa-compact-definitions dt{font-size:.65rem!important}.pa-compact-definitions dd{font-size:.74rem!important}
}
@media(max-width:430px){
  #generalOrderDetailModal .nidux-live-section .order-detail-grid,.nidux-extra-grid{grid-template-columns:1fr}
}

/* =========================================================
   Ajuste v6 - apertura segura de órdenes Nidux sin CORS
   ========================================================= */
#generalOrderDetailModal .order-detail-content{align-items:start}
#generalOrderDetailModal .receipt-section{min-width:0}
.nidux-open-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.8rem;margin:.05rem 0;padding:.72rem .8rem;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.nidux-open-panel>div:first-child{min-width:0}
.nidux-open-panel strong{display:block;font-size:.88rem;line-height:1.25}
.nidux-open-panel p{margin:.2rem 0 .28rem;color:var(--muted);font-size:.75rem;line-height:1.42}
.nidux-open-actions{display:flex;gap:.45rem;align-items:center;justify-content:flex-end;flex-wrap:wrap}
.nidux-open-status{display:block;min-height:1.1rem;color:var(--muted);font-size:.71rem;line-height:1.35}
.nidux-open-status.success{color:#117650;font-weight:700}
.nidux-open-status.warning{color:#9a570a;font-weight:700}
@media(max-width:760px){.nidux-open-panel{grid-template-columns:1fr}.nidux-open-actions{display:grid;grid-template-columns:1fr 1fr}.nidux-open-actions .button{width:100%}}
@media(max-width:430px){.nidux-open-actions{grid-template-columns:1fr}}

/* v9 · Detalle de orden: tarjetas estables, alineadas y sin wrap extraño */
#generalOrderDetailModal .order-detail-card{width:min(1180px,calc(100vw - 28px))!important}
#generalOrderDetailModal .order-detail-content{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;align-items:stretch!important;gap:.7rem!important}
#generalOrderDetailModal .order-detail-section{height:100%!important;min-width:0!important;display:flex!important;flex-direction:column!important;padding:.72rem!important}
#generalOrderDetailModal .order-detail-section h3{min-height:1.2rem;margin-bottom:.55rem!important}
#generalOrderDetailModal .order-detail-section .order-detail-grid{grid-template-columns:1fr!important;align-content:start!important;flex:1!important;gap:.42rem!important}
#generalOrderDetailModal .order-detail-field{min-height:54px;display:flex;flex-direction:column;justify-content:center}
#generalOrderDetailModal .receipt-section{grid-column:1/-1!important;height:auto!important}
#generalOrderDetailModal .receipt-section .order-receipt{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:.45rem .8rem!important}
#generalOrderDetailModal .receipt-section .order-receipt>div{margin:0!important;border-radius:.65rem;background:#fff;border:1px solid rgba(15,23,42,.06)}
#generalOrderDetailModal .receipt-section .order-receipt .receipt-total{grid-column:1/-1!important;background:#eef2ff}
@media(max-width:1250px){#generalOrderDetailModal .order-detail-content{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:760px){#generalOrderDetailModal .order-detail-content{grid-template-columns:1fr!important}#generalOrderDetailModal .receipt-section .order-receipt{grid-template-columns:1fr!important}}

/* v10 · General Sales: layout final del detalle de factura / orden */
#generalOrderDetailModal .order-detail-card{width:min(1220px,calc(100vw - 28px))!important;max-height:calc(100dvh - 24px)!important;overflow:auto!important}
#generalOrderDetailModal .order-detail-content{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;align-items:start!important;gap:.72rem!important}
#generalOrderDetailModal .order-detail-section{height:auto!important;min-width:0!important;align-self:start!important;display:flex!important;flex-direction:column!important;padding:.78rem!important;border:1px solid #d9e0ec!important;background:#f7f9fc!important;border-radius:12px!important}
#generalOrderDetailModal .order-detail-section h3{min-height:auto!important;margin:0 0 .55rem!important;font-size:.85rem!important}
#generalOrderDetailModal .order-detail-section .order-detail-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:.42rem!important;align-content:start!important;flex:none!important}
#generalOrderDetailModal .order-card-client .order-detail-grid{grid-template-columns:1fr!important}
#generalOrderDetailModal .order-detail-field{min-height:54px!important;padding:.48rem .55rem!important;background:#fff!important;border:1px solid rgba(15,23,42,.045)!important;border-radius:9px!important;justify-content:center!important}
#generalOrderDetailModal .receipt-section{grid-column:1/-1!important;width:100%!important;height:auto!important;background:#fff!important}
#generalOrderDetailModal .receipt-section .order-receipt{display:flex!important;flex-direction:column!important;gap:0!important;width:min(100%,620px)!important;margin-left:auto!important;border:1px solid #d9e0ec!important;border-radius:12px!important;overflow:hidden!important;background:#fff!important}
#generalOrderDetailModal .receipt-section .receipt-row{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(150px,auto)!important;gap:1rem!important;align-items:center!important;min-height:42px!important;margin:0!important;padding:.58rem .78rem!important;background:#fff!important;border:0!important;border-bottom:1px solid #e6eaf0!important;border-radius:0!important}
#generalOrderDetailModal .receipt-section .receipt-row span{text-align:left!important;color:#667085!important;font-size:.82rem!important}
#generalOrderDetailModal .receipt-section .receipt-row strong{text-align:right!important;justify-self:end!important;color:#0f172a!important;font-size:.9rem!important;white-space:nowrap!important}
#generalOrderDetailModal .receipt-section .receipt-total{grid-column:auto!important;background:#0f172a!important;color:#fff!important;border-bottom:0!important;min-height:50px!important}
#generalOrderDetailModal .receipt-section .receipt-total span,#generalOrderDetailModal .receipt-section .receipt-total strong{color:#fff!important;font-weight:900!important;font-size:1rem!important}
@media(max-width:1250px){#generalOrderDetailModal .order-detail-content{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:760px){#generalOrderDetailModal .order-detail-content{grid-template-columns:1fr!important}#generalOrderDetailModal .order-detail-section .order-detail-grid,#generalOrderDetailModal .order-card-client .order-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}#generalOrderDetailModal .receipt-section .order-receipt{width:100%!important}}
@media(max-width:520px){#generalOrderDetailModal .order-detail-section .order-detail-grid,#generalOrderDetailModal .order-card-client .order-detail-grid{grid-template-columns:1fr!important}}

/* v11 · General Sales mantiene estructura de factura y sticky nativo */
#generalOrderDetailModal .order-detail-content{display:block!important;grid-template-columns:none!important;margin:.85rem 0!important}
#generalOrderDetailModal .order-detail-card{width:min(1120px,calc(100vw - 28px))!important;}
#generalOrderDetailModal .order-invoice-sheet{display:block!important}
.general-sales-table-wrap{overflow:auto!important;max-height:min(68dvh,760px)!important;position:relative!important}
.general-sales-table thead th{position:sticky!important;top:0!important;z-index:12!important;background:var(--surface)!important}
@media(max-width:760px){.general-sales-table thead th{position:sticky!important;top:0!important}}

/* v33: el análisis usa prácticamente todo el ancho disponible en escritorio. */
@media(min-width:901px){
  .product-analysis-modal.open{padding:10px!important;place-items:start center!important}
  .product-analysis-modal-card{width:calc(100vw - 20px)!important;max-width:none!important;min-width:0!important;max-height:calc(100dvh - 20px)!important;overflow:auto!important;margin:0 auto!important}
}

/* Standalone product analysis route */
.product-analysis-page .pa-modal-body{overflow:visible!important;max-height:none!important}
.product-analysis-page .pa-modal-header{position:relative!important}
