/* Espejo de OF — patrón SAP Fiori List Report.
   Capa exclusivamente visual; no modifica consultas, cálculos ni movimientos. */

#of-sap {
  --of-fiori-blue: #0a6ed1;
  --of-fiori-blue-dark: #0854a0;
  --of-fiori-blue-soft: #eaf3fc;
  --of-fiori-text: #1d2d3e;
  --of-fiori-muted: #556b82;
  --of-fiori-border: #d5dadd;
  --of-fiori-canvas: #f5f6f7;
  font-variant-numeric: tabular-nums;
}

#of-sap .of-sap-layout {
  gap: 16px;
  max-width: 1760px;
  margin: 0 auto;
}

#of-sap .of-sap-master-panel,
#of-sap .of-detail {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--of-fiori-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(34, 53, 72, 0.08);
}

#of-sap .of-sap-titlebar {
  min-height: 76px;
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e9eb;
  background: #fff;
}

#of-sap .of-sap-titlebar h3 {
  margin: 0;
  color: var(--of-fiori-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

#of-sap .of-sap-titlebar .muted {
  margin: 4px 0 0;
  color: var(--of-fiori-muted);
  font-size: 13px;
}

#of-sap .of-sap-titlebar .panel-actions {
  align-items: center;
  gap: 8px;
}

/* El estado global “En línea” ya está visible en el encabezado de la app. */
#of-sap .of-sap-titlebar #ofSapConnectionStatus {
  display: none;
}

#of-sap .of-sap-titlebar .small-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--of-fiori-blue);
  border-radius: 4px;
  background: #fff;
  color: var(--of-fiori-blue);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
  transform: none;
}

#of-sap .of-sap-titlebar .small-button:hover,
#of-sap .of-sap-titlebar .small-button:focus-visible {
  background: #edf5fc;
  color: var(--of-fiori-blue-dark);
  transform: none;
}

#of-sap .of-sap-titlebar #ofMirrorRefresh {
  border-color: var(--of-fiori-blue);
  background: var(--of-fiori-blue);
  color: #fff;
}

#of-sap .of-sap-titlebar #ofMirrorRefresh:hover,
#of-sap .of-sap-titlebar #ofMirrorRefresh:focus-visible {
  border-color: var(--of-fiori-blue-dark);
  background: var(--of-fiori-blue-dark);
  color: #fff;
}

#of-sap #ofSapLoadStatus,
#of-sap #ofSapRangeNotice {
  margin: 12px 20px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--of-fiori-blue);
  border-radius: 0 4px 4px 0;
  background: #f0f7ff;
  color: #354a5f;
}

#of-sap .of-sap-filterbar {
  margin: 16px 20px;
  padding: 14px 16px 16px;
  border: 1px solid var(--of-fiori-border);
  border-radius: 6px;
  background: #f7f7f7;
}

#of-sap .of-sap-filterbar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e9eb;
}

#of-sap .of-sap-filterbar-heading > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
}

#of-sap .of-sap-filterbar-heading strong {
  color: var(--of-fiori-text);
  font-size: 15px;
}

#of-sap .of-sap-filterbar-heading span {
  color: var(--of-fiori-muted);
  font-size: 12px;
}

#of-sap .of-date-range {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

#of-sap .of-search-filters {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
}

#of-sap .of-sap-filterbar label {
  gap: 6px;
  color: #354a5f;
  font-size: 12px;
  font-weight: 700;
}

#of-sap .of-sap-filterbar input,
#of-sap .of-sap-filterbar select {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #89919a;
  border-radius: 4px;
  background-color: #fff;
  color: var(--of-fiori-text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

#of-sap .of-sap-filterbar input:hover,
#of-sap .of-sap-filterbar select:hover {
  border-color: #5b738b;
}

#of-sap .of-sap-filterbar input:focus,
#of-sap .of-sap-filterbar select:focus {
  border-color: var(--of-fiori-blue);
  outline: 1px solid var(--of-fiori-blue);
  box-shadow: none;
}

#of-sap .of-selected-summary {
  margin: 0 20px 12px;
  border: 1px solid #91c8f6;
  border-radius: 4px;
  background: var(--of-fiori-blue-soft);
  color: #074b78;
}

#of-sap .of-selected-summary .small-button {
  min-height: 34px;
  border: 1px solid var(--of-fiori-blue);
  border-radius: 4px;
  background: #fff;
  color: var(--of-fiori-blue);
  box-shadow: none;
}

#of-sap .of-sap-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 20px;
  border-top: 1px solid #e5e9eb;
  border-bottom: 1px solid var(--of-fiori-border);
  background: #fff;
}

#of-sap .of-sap-table-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 190px;
}

#of-sap .of-sap-table-title strong {
  color: var(--of-fiori-text);
  font-size: 16px;
  font-weight: 700;
}

#of-sap .of-sap-table-title span {
  color: var(--of-fiori-muted);
  font-size: 12px;
  font-weight: 600;
}

#of-sap .of-sap-table-toolbar .pagination-bar {
  margin: 0;
}

#of-sap .of-sap-pagination button,
#of-sap .of-sap-pagination select {
  min-height: 36px;
  border: 1px solid #89919a;
  border-radius: 4px;
  background: #fff;
  color: var(--of-fiori-blue);
  box-shadow: none;
}

#of-sap .of-sap-pagination button:disabled {
  border-color: #d5dadd;
  color: #89919a;
  background: #f7f7f7;
}

#of-sap .of-sap-table-wrap {
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fff;
}

#of-sap .of-sap-table {
  min-width: 1500px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

#of-sap .of-sap-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 44px;
  padding: 9px 12px;
  border-bottom: 1px solid #89919a;
  background: #f7f7f7;
  color: #354a5f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
  vertical-align: middle;
  white-space: nowrap;
}

#of-sap .of-sap-table td {
  min-height: 52px;
  padding: 11px 12px;
  border-bottom: 1px solid #e5e9eb;
  background: #fff;
  color: var(--of-fiori-text);
  font-size: 13px;
  line-height: 1.35;
  vertical-align: middle;
}

#of-sap .of-sap-table td small,
#of-sap .of-sap-table td .muted {
  color: var(--of-fiori-muted);
  font-size: 11px;
}

#of-sap .of-sap-table tbody tr.clickable-row:hover td {
  background: #edf5fc;
}

#of-sap .of-sap-table tbody tr.selected-row td {
  background: var(--of-fiori-blue-soft);
}

#of-sap .of-sap-table tbody tr.selected-row td:first-child {
  box-shadow: inset 3px 0 0 var(--of-fiori-blue);
}

#of-sap .of-sap-table th:nth-child(n + 10),
#of-sap .of-sap-table td:nth-child(n + 10) {
  text-align: right;
}

#of-sap .of-sap-table td:nth-child(2) strong {
  color: #074b78;
  font-size: 14px;
}

#of-sap .of-origin-badge,
#of-sap .order-type-badge,
#of-sap .app-status-badge,
#of-sap .yield-badge,
#of-sap .of-sap-state {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: none;
}

#of-sap .of-sap-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

#of-sap .of-sap-state::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

#of-sap .of-sap-state-success { color: #256f3a; }
#of-sap .of-sap-state-error { color: #aa0808; }
#of-sap .of-sap-state-info { color: #0a6ed1; }
#of-sap .of-sap-state-warning { color: #8d2a00; }
#of-sap .of-sap-state-neutral { color: #556b82; }

#of-sap > .of-sap-layout > .of-sap-master-panel > #ofSapPager {
  min-height: 52px;
  margin: 0;
  padding: 8px 20px;
  border-top: 1px solid var(--of-fiori-border);
  background: #fff;
}

#of-sap .of-detail {
  padding: 18px 20px 20px;
}

#of-sap .of-detail > .panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e9eb;
}

#of-sap .of-detail > .panel-head h3 {
  color: var(--of-fiori-text);
}

/* En PC se muestran las 16 columnas completas dentro del ancho disponible.
   Las vistas táctiles conservan el desplazamiento horizontal para mantener
   objetivos cómodos y texto legible. */
@media (min-width: 1201px) {
  #of-sap .of-sap-table-wrap {
    overflow-x: hidden;
  }

  #of-sap .of-sap-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  #of-sap .of-sap-table th,
  #of-sap .of-sap-table td {
    padding-right: 5px;
    padding-left: 5px;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
  }

  #of-sap .of-sap-table th {
    font-size: clamp(9px, 0.62vw, 11px);
  }

  #of-sap .of-sap-table td {
    font-size: clamp(10px, 0.68vw, 12px);
    line-height: 1.28;
  }

  #of-sap .of-sap-table td small,
  #of-sap .of-sap-table td .muted {
    font-size: clamp(9px, 0.6vw, 10px);
  }

  #of-sap .of-sap-table .of-origin-badge,
  #of-sap .of-sap-table .order-type-badge,
  #of-sap .of-sap-table .app-status-badge,
  #of-sap .of-sap-table .yield-badge,
  #of-sap .of-sap-table .of-sap-state {
    max-width: 100%;
    min-height: 20px;
    padding: 2px 4px;
    justify-content: center;
    font-size: clamp(8px, 0.58vw, 10px);
    text-align: center;
    white-space: normal;
  }

  #of-sap .of-sap-table th:nth-child(1) { width: 9%; }
  #of-sap .of-sap-table th:nth-child(2) { width: 5%; }
  #of-sap .of-sap-table th:nth-child(3) { width: 5%; }
  #of-sap .of-sap-table th:nth-child(4) { width: 13%; }
  #of-sap .of-sap-table th:nth-child(5) { width: 7%; }
  #of-sap .of-sap-table th:nth-child(6) { width: 6%; }
  #of-sap .of-sap-table th:nth-child(7) { width: 6%; }
  #of-sap .of-sap-table th:nth-child(8) { width: 8%; }
  #of-sap .of-sap-table th:nth-child(9) { width: 8%; }
  #of-sap .of-sap-table th:nth-child(10) { width: 8%; }
  #of-sap .of-sap-table th:nth-child(11) { width: 8%; }
  #of-sap .of-sap-table th:nth-child(12) { width: 8%; }
  #of-sap .of-sap-table th:nth-child(13) { width: 4.5%; }
  #of-sap .of-sap-table th:nth-child(14) { width: 4.5%; }
}

@media (max-width: 1200px) {
  #of-sap .of-date-range {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  #of-sap .of-sap-titlebar {
    align-items: flex-start;
  }

  #of-sap .of-sap-titlebar .panel-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  #of-sap .of-sap-master-panel,
  #of-sap .of-detail {
    border-radius: 6px;
  }

  #of-sap .of-sap-titlebar {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
  }

  #of-sap .of-sap-titlebar .panel-actions {
    justify-content: flex-start;
    width: 100%;
  }

  #of-sap .of-sap-filterbar {
    margin: 12px 16px;
  }

  #of-sap .of-sap-table-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 16px;
  }

  #of-sap .of-sap-table-toolbar .pagination-bar {
    justify-content: flex-start;
    width: 100%;
  }

  #of-sap .of-sap-table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 700px) {
  #of-sap .of-date-range,
  #of-sap .of-search-filters {
    grid-template-columns: 1fr;
  }

  #of-sap .of-sap-titlebar .panel-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #of-sap .of-sap-titlebar .small-button {
    width: 100%;
    padding-inline: 10px;
  }

  #of-sap .of-sap-titlebar #ofMirrorRefresh {
    grid-column: 1 / -1;
  }

  #of-sap .of-sap-filterbar-heading span {
    display: none;
  }
}

