/* Aplicaciones > Programa vs real: una fila por fito / una fila por orden. */
#applicationComparison{color:#18372a;min-width:0}
.main:has(#applicationComparison.active-view) .topbar-title{display:none}
.apr-shell{display:grid;gap:7px;min-width:0}
.apr-filters{display:grid;grid-template-columns:repeat(5,minmax(0,1fr)) auto;align-items:end;gap:6px;background:#fff;border:1px solid #dce7df;border-radius:7px;padding:7px}
.apr-filters label{display:grid;gap:3px;font-size:10.5px;font-weight:700;min-width:0}
.apr-filters select{width:100%;min-width:0;min-height:32px;background:#fff;color:#18372a;border:1px solid #bccfc2;border-radius:5px;padding:3px 6px;font-size:11.5px}
.apr-program-filter,.apr-program-filter select{text-align:center}
.apr-refresh{min-height:32px!important;padding:4px 9px!important;font-size:11px!important}
/* Ambos módulos ocupan todo el ancho; las filas nunca se separan por producto. */
.apr-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;align-items:start}
.apr-panel{display:flex;flex-direction:column;background:#fff;border:1px solid #d8e4dc;border-radius:7px;overflow:hidden;min-width:0}
.apr-panel header{display:flex;align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:5px 14px;padding:7px 9px;background:#edf5ef;border-bottom:1px solid #d8e4dc;flex:none}
.apr-panel h3{margin:0;font-size:13px}
.apr-panel header .apr-count{font-size:10px;color:#51695b;white-space:nowrap}
.apr-panel .apr-overall{margin-left:auto;font-size:10.5px;color:#355741}
.apr-panel .apr-overall strong{font-size:12px;color:#185434;font-variant-numeric:tabular-nums}
.apr-table-wrap{overflow-y:auto;overflow-x:hidden;max-height:min(57dvh,600px);min-height:0}
#applicationComparison .apr-panel table{width:100%;min-width:0!important;border-collapse:separate;border-spacing:0;font-size:11px;table-layout:fixed}
#applicationComparison .apr-panel th{position:sticky;top:0;background:#21513a;color:#fff;z-index:3;font-size:10px;text-align:left;padding:6px 5px;vertical-align:middle;overflow-wrap:anywhere;box-shadow:0 1px 0 #173c29}
#applicationComparison .apr-panel td{padding:5px 5px;border-bottom:1px solid #e3ece5;vertical-align:middle;overflow-wrap:anywhere;color:#18372a;line-height:1.2}
#applicationComparison .apr-panel tbody tr:nth-child(even){background:#f6f9f6}
#applicationComparison .apr-panel td:first-child{color:#647b6c}
.apr-panel small{display:block;color:#627369;font-size:9px;margin-top:2px;line-height:1.1}
.apr-index{font-variant-numeric:tabular-nums;text-align:center}
.apr-fito-code,.apr-order-number{font-weight:750}
.apr-date{white-space:normal;font-variant-numeric:tabular-nums}
.apr-rate{text-align:right;white-space:normal;font-variant-numeric:tabular-nums}
.apr-rate strong{font-size:11px;color:#17563a}
.apr-product-pills{display:flex;align-items:center;flex-wrap:wrap;gap:2px 5px;min-width:0}
.apr-product-pills span{display:inline-flex;align-items:center;max-width:100%;padding:2px 5px;border:1px solid #d7e3d8;border-radius:4px;background:#edf5ee;color:#234c30;font-size:10px;font-weight:650;line-height:1.15;overflow-wrap:anywhere}
.apr-product-pills .apr-no-products{background:#f4f5f3;color:#6e7770;border-color:#e1e5e1;font-weight:500}
#applicationComparison .apr-plan th:nth-child(1){width:4%}
#applicationComparison .apr-plan th:nth-child(2){width:11%}
#applicationComparison .apr-plan th:nth-child(3){width:15%}
#applicationComparison .apr-plan th:nth-child(4){width:55%}
#applicationComparison .apr-plan th:nth-child(5){width:15%;text-align:right}
#applicationComparison .apr-real th:nth-child(1){width:4%}
#applicationComparison .apr-real th:nth-child(2){width:10%}
#applicationComparison .apr-real th:nth-child(3){width:11%}
#applicationComparison .apr-real th:nth-child(4){width:15%}
#applicationComparison .apr-real th:nth-child(5){width:45%}
#applicationComparison .apr-real th:nth-child(6){width:15%;text-align:right}
.apr-status,.apr-error{padding:7px;border-radius:6px;margin:0;background:#edf5ef;font-size:11px}
.apr-error{background:#fff0eb;color:#9e3022}
.apr-empty{padding:14px!important;color:#68776b!important;text-align:center}
.apr-pagination{display:flex;align-items:center;justify-content:center;gap:8px;padding:5px;font-size:10px}
.apr-pagination button{min-height:30px;padding:3px 8px;border:1px solid #bdcfc3;border-radius:5px;background:#fff;color:#21513a}
.apr-pagination button:disabled{opacity:.5}
.apr-help{font-size:10.5px;color:#597060}
.apr-help summary{cursor:pointer;padding:4px 0;min-height:22px;box-sizing:border-box}
.apr-note{margin:2px 0;color:#597060;font-size:10.5px;line-height:1.35}
@media(max-width:900px){
 .apr-filters{grid-template-columns:repeat(3,minmax(0,1fr))}
 #applicationComparison .apr-panel th{font-size:9px;padding:5px 3px}
 #applicationComparison .apr-panel td{font-size:10px;padding:4px 3px}
 .apr-product-pills span{font-size:9px;padding:2px 3px}
}
@media(max-width:580px){
 .apr-filters{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding:5px}
 .apr-refresh{align-self:end}
 .apr-panel header{padding:6px}
 .apr-panel h3{font-size:12px}
 .apr-panel .apr-overall{margin-left:0;width:100%;font-size:10px}
 .apr-table-wrap{max-height:55dvh}
 #applicationComparison .apr-panel th{font-size:8.4px;padding:4px 2px}
 #applicationComparison .apr-panel td{font-size:9px;padding:4px 2px}
 #applicationComparison .apr-panel small{font-size:8px}
 .apr-product-pills{gap:2px}
 .apr-product-pills span{font-size:8.2px;padding:1px 3px}
 #applicationComparison .apr-real th:nth-child(1){width:5%}
 #applicationComparison .apr-real th:nth-child(2){width:10%}
 #applicationComparison .apr-real th:nth-child(3){width:11%}
 #applicationComparison .apr-real th:nth-child(4){width:18%}
 #applicationComparison .apr-real th:nth-child(5){width:42%}
 #applicationComparison .apr-real th:nth-child(6){width:14%}
}

/* Comparación alineada: una sola tabla y desplazamiento común para ambos lados. */
.apr-comparison .apr-paired-wrap{overflow:auto;max-height:72dvh;}
#applicationComparison .apr-comparison table.apr-paired-table{min-width:1160px!important;}
.apr-paired-table .apr-col-fito{width:7%}
.apr-paired-table .apr-col-date{width:8%}
.apr-paired-table .apr-col-product{width:19%}
.apr-paired-table .apr-col-rate{width:8%}
.apr-paired-table .apr-col-real-fito{width:8%}
.apr-paired-table .apr-col-order{width:10%}
.apr-paired-table .apr-col-real-product{width:18%}
.apr-paired-table .apr-col-action{width:6%}
#applicationComparison .apr-paired-table .apr-side-head th{top:0;height:28px;box-sizing:border-box;padding:4px 6px;font-size:11px;text-align:center;background:#21513a;z-index:5;}
#applicationComparison .apr-paired-table .apr-side-head th:last-child{background:#284f69;}
#applicationComparison .apr-paired-table .apr-column-head th{top:28px;height:27px;box-sizing:border-box;padding:4px 5px;font-size:10px;z-index:4;}
#applicationComparison .apr-paired-table .apr-column-head th:nth-child(n+4){background:#284f69;}
#applicationComparison .apr-paired-table .apr-side-head th:first-child{left:0;z-index:7;}
#applicationComparison .apr-paired-table tbody th.apr-pair-fito{position:sticky;top:auto;left:0;z-index:3;vertical-align:middle;text-align:center;background:#f0f5f1;color:#18372a;box-shadow:1px 0 #c4d6ca;font-size:11px;border-bottom:1px solid #d3e0d7;border-left:3px solid #d49c39;padding:5px 3px;}
.apr-pair-fito button{border:0;background:transparent;color:inherit;width:100%;padding:4px 2px;min-height:30px;cursor:pointer;font-size:14px;font-weight:800;}
.apr-pair-fito button:focus-visible{outline:2px solid #356c9b;outline-offset:-2px;border-radius:4px;}
#applicationComparison .apr-paired-table [data-apr-match="matched"] .apr-pair-fito{border-left-color:#2b8a56;}
#applicationComparison .apr-paired-table [data-apr-match="unplanned"] .apr-pair-fito{border-left-color:#926cb3;}
#applicationComparison .apr-paired-table .apr-real-start{border-left:2px solid #8aa6b4;}
#applicationComparison .apr-paired-table td.apr-plan-missing{color:#768377;text-align:center;background:#f8faf8;font-size:10px;}
#applicationComparison .apr-paired-table .apr-match-label{font-size:9px;font-weight:600;}
#applicationComparison .apr-paired-table .apr-paired-row.apr-selected :is(td,th){background:#e5f2fc!important;box-shadow:inset 0 1px #9ebdd5,inset 0 -1px #9ebdd5;}
.apr-comparison .apr-product-pills{gap:2px 3px;}
.apr-comparison .apr-product-pills span{padding:2px 3px;font-size:9.5px;}
@media(max-width:580px){.apr-comparison .apr-paired-wrap{max-height:67dvh;}}


/* Resumen del Fito cerrado y detalle de órdenes bajo demanda. */
#applicationComparison .apr-paired-table .apr-summary-row > :is(td,th){border-top:1px solid #cadbd1;}
#applicationComparison .apr-paired-table .apr-summary-row[data-apr-match="matched"] > :is(td,th){
  border-top:2px solid #4a9e82; /* Línea horizontal que enlaza programa con real. */
}
#applicationComparison .apr-paired-table .apr-summary-row[data-apr-match="matched"]{
  background:#f0f8f4;
}
#applicationComparison .apr-paired-table .apr-summary-row .apr-real-start{background:#eef6fa;}
#applicationComparison .apr-paired-table .apr-expand{
  display:inline-flex;align-items:center;gap:5px;min-height:27px;max-width:100%;padding:2px 5px;
  border:1px solid #b8d1e0;border-radius:5px;background:#fff;color:#20516d;
  font:inherit;cursor:pointer;text-align:left;
}
#applicationComparison .apr-paired-table .apr-expand:focus-visible{outline:2px solid #286eaa;outline-offset:2px;}
#applicationComparison .apr-paired-table .apr-expand-icon{
  display:inline-grid;place-items:center;flex:none;width:20px;height:20px;
  border-radius:4px;background:#d9eaf4;color:#194e6d;font-size:16px;font-weight:750;line-height:1;
}
#applicationComparison .apr-paired-table .apr-order-detail{background:#f6fafc;}
#applicationComparison .apr-paired-table .apr-order-detail > td{border-bottom:1px solid #e1ecf3;color:#294a60;}
#applicationComparison .apr-paired-table .apr-order-detail .apr-detail-indicator{
  text-align:right;color:#54829e;font-weight:700;padding-right:9px;
}
#applicationComparison .apr-paired-table .apr-order-detail .apr-detail-empty{background:#f7faf8;}
#applicationComparison .apr-paired-table .apr-order-detail .apr-order-number{padding-left:11px;border-left:2px solid #92bed5;}
@media(max-width:900px){
  #applicationComparison .apr-paired-table .apr-expand{gap:3px;padding:2px;}
  #applicationComparison .apr-paired-table .apr-expand-icon{width:18px;height:18px;}
}

/* Programa vs real: columnas centradas, código fito repetido y mojamiento protagonista. */
#applicationComparison .apr-paired-table .apr-column-head th{text-align:center;vertical-align:middle;}
#applicationComparison .apr-paired-table tbody td{text-align:center;vertical-align:middle;}
#applicationComparison .apr-paired-table tbody td.apr-rate{text-align:center;}
#applicationComparison .apr-paired-table .apr-order-number,
#applicationComparison .apr-paired-table .apr-date,
#applicationComparison .apr-paired-table .apr-real-fito{text-align:center;}
#applicationComparison .apr-paired-table .apr-expand{justify-content:center;margin:0 auto;white-space:normal;}
#applicationComparison .apr-paired-table .apr-product-pills{justify-content:center;text-align:center;gap:4px;}
#applicationComparison .apr-paired-table .apr-product-pills span{justify-content:center;text-align:center;max-width:100%;}
#applicationComparison .apr-paired-table .apr-real-fito{background:#eef5fa;}
#applicationComparison .apr-paired-table .apr-fito-chip{
  display:inline-flex;align-items:center;justify-content:center;max-width:100%;
  padding:4px 6px;border:1px solid #abcadd;border-radius:6px;
  background:#e3f0f9;color:#164766;font-size:11px;font-weight:800;line-height:1.2;
  text-align:center;overflow-wrap:anywhere;
}
#applicationComparison .apr-paired-table .apr-rate .apr-water-value{
  display:inline-flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1px;max-width:100%;min-width:68px;padding:5px 6px;
  border-radius:7px;border:1px solid #b8dcca;background:#e9f7ef;
  font-variant-numeric:tabular-nums;box-sizing:border-box;
}
#applicationComparison .apr-paired-table .apr-rate-real .apr-water-value{
  border-color:#a8cadd;background:#e2f2fb;box-shadow:inset 0 0 0 1px #d5e8f6;
}
#applicationComparison .apr-paired-table .apr-rate strong{
  display:block;font-size:14px;line-height:1.15;letter-spacing:-.2px;
  font-weight:850;color:#165735;
}
#applicationComparison .apr-paired-table .apr-rate-real strong{color:#164d73;}
#applicationComparison .apr-paired-table .apr-rate-unit{
  font-size:9px;font-weight:750;line-height:1;color:#587365;
}
#applicationComparison .apr-paired-table .apr-rate-real .apr-rate-unit{color:#3d6580;}
#applicationComparison .apr-paired-table .apr-rate small{text-align:center;font-size:9px;line-height:1.15;}
#applicationComparison .apr-paired-table .apr-preview-cell,
#applicationComparison .apr-paired-table .apr-preview-space{text-align:center;}
#applicationComparison .apr-paired-table .apr-preview-order{
  display:inline-flex;align-items:center;justify-content:center;
  width:auto;max-width:100%;min-height:29px;padding:5px 7px!important;
  margin:0 auto;border:1px solid #347da6!important;border-radius:6px;
  background:#e9f5ff!important;color:#165174!important;
  font-size:10px!important;line-height:1.15;font-weight:800!important;
  white-space:normal;cursor:pointer;
}
#applicationComparison .apr-paired-table .apr-preview-order:hover{
  background:#d6eefe!important;border-color:#195f8c!important;
}
#applicationComparison .apr-paired-table .apr-preview-order:focus-visible{
  outline:2px solid #287ab0;outline-offset:2px;
}
#applicationComparison .apr-paired-table .apr-preview-order:disabled{opacity:.55;cursor:wait;}
#applicationComparison .apr-paired-table .apr-order-detail .apr-order-number{
  border-left:0;padding-left:5px;
}
@media(max-width:900px){
 #applicationComparison .apr-paired-table .apr-rate strong{font-size:12px;}
 #applicationComparison .apr-paired-table .apr-preview-order{padding:4px!important;font-size:9px!important;}
 #applicationComparison .apr-paired-table .apr-fito-chip{font-size:10px;padding:3px 4px;}
}
