/* =========================================================
   WIRTZ HUB · PEDIDOS MAYORISTAS · HISTORIAL
   CSS limpio · Historial + Diferencias integradas
   ========================================================= */

/* =========================================================
   PAGE
   ========================================================= */

.pm-page.pm-hist-page {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;

  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - var(--topbar-height, 72px) - 44px);

  color: #111827;
  overflow-x: hidden;
}

html[data-theme="dark"] .pm-page.pm-hist-page {
  color: #f9fafb;
}

/* =========================================================
   HEADER
   ========================================================= */

.pm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  width: 100%;
  padding: 14px 16px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
}

html[data-theme="dark"] .pm-head {
  background: #111827;
  border-color: #273244;
}

.pm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pm-brand__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  flex: 0 0 42px;

  color: #111827;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

html[data-theme="dark"] .pm-brand__icon {
  color: #f9fafb;
  background: #1f2937;
  border-color: #374151;
}

.pm-brand h2 {
  margin: 0;
  color: inherit;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.pm-brand p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

html[data-theme="dark"] .pm-brand p {
  color: #9ca3af;
}

.pm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.pm-btn,
.pm-icon-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.pm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 36px;
  padding: 0 13px;

  color: #111827;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;

  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.pm-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.pm-btn--dark {
  color: #ffffff;
  background: #111827;
  border-color: #111827;
}

.pm-btn--dark:hover {
  background: #030712;
  border-color: #030712;
}

html[data-theme="dark"] .pm-btn {
  color: #f9fafb;
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-btn:hover {
  background: #273244;
  border-color: #4b5563;
}

html[data-theme="dark"] .pm-btn--dark {
  color: #111827;
  background: #f9fafb;
  border-color: #f9fafb;
}

html[data-theme="dark"] .pm-btn--dark:hover {
  background: #e5e7eb;
  border-color: #e5e7eb;
}

.pm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;
  min-width: 34px;

  color: #111827;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 11px;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.pm-icon-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.pm-icon-btn.is-danger {
  color: #991b1b;
  background: #fff7f7;
  border-color: #fecaca;
}

html[data-theme="dark"] .pm-icon-btn {
  color: #f9fafb;
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-icon-btn:hover {
  background: #273244;
  border-color: #4b5563;
}

html[data-theme="dark"] .pm-icon-btn.is-danger {
  color: #fecaca;
  background: #331313;
  border-color: #7f1d1d;
}

.icon {
  width: 17px;
  height: 17px;
  display: block;
  stroke-width: 2.2;
  flex: 0 0 auto;
}

/* =========================================================
   METRICS
   ========================================================= */

.pm-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.pm-card-metric {
  min-width: 0;
  padding: 14px 14px 13px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
}

html[data-theme="dark"] .pm-card-metric {
  background: #111827;
  border-color: #273244;
}

.pm-card-metric span {
  display: block;
  margin-bottom: 7px;

  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pm-card-metric strong {
  display: block;

  color: #111827;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
}

.pm-card-metric small {
  display: block;
  margin-top: 7px;

  color: #6b7280;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

html[data-theme="dark"] .pm-card-metric span,
html[data-theme="dark"] .pm-card-metric small {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-card-metric strong {
  color: #f9fafb;
}

/* =========================================================
   PANELS
   ========================================================= */

.pm-panel {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
}

html[data-theme="dark"] .pm-panel {
  background: #111827;
  border-color: #273244;
}

.pm-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  min-height: 58px;
  padding: 13px 15px;

  border-bottom: 1px solid #e5e7eb;
}

html[data-theme="dark"] .pm-panel__head {
  border-color: #273244;
}

.pm-panel__head--toolbar {
  align-items: flex-start;
}

.pm-panel__head span {
  display: block;
  margin-bottom: 4px;

  color: #6b7280;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pm-panel__head strong {
  display: block;

  color: #111827;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.15;
}

.pm-panel__head small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

html[data-theme="dark"] .pm-panel__head span,
html[data-theme="dark"] .pm-panel__head small {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-panel__head strong {
  color: #f9fafb;
}

/* =========================================================
   FILTERS / TOOLBAR
   ========================================================= */

.pm-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: min(100%, 720px);
}

.pm-search {
  display: flex;
  align-items: center;
  gap: 8px;

  min-width: 280px;
  height: 38px;
  padding: 0 11px;

  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 12px;
}

.pm-search input {
  width: 100%;
  min-width: 0;
  height: 100%;

  color: #111827;
  background: transparent;
  border: 0;
  outline: 0;

  font-size: 13px;
  font-weight: 650;
}

.pm-search input::placeholder {
  color: #9ca3af;
}

.pm-toolbar select,
.pm-toolbar input[type="date"] {
  height: 38px;
  min-width: 132px;
  padding: 0 10px;

  color: #111827;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  outline: 0;

  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
}

html[data-theme="dark"] .pm-search {
  color: #9ca3af;
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-search input,
html[data-theme="dark"] .pm-toolbar select,
html[data-theme="dark"] .pm-toolbar input[type="date"] {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-toolbar select,
html[data-theme="dark"] .pm-toolbar input[type="date"] {
  background: #1f2937;
  border-color: #374151;
}

/* =========================================================
   TABS
   ========================================================= */

.pm-hist-tabs-panel {
  padding: 8px;
}

.pm-hist-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.pm-hist-tab {
  appearance: none;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 38px;
  padding: 0 14px;

  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 13px;

  font-family: inherit;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;

  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.pm-hist-tab:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.pm-hist-tab.is-active {
  color: #ffffff;
  background: #111827;
  border-color: #111827;
}

html[data-theme="dark"] .pm-hist-tab {
  color: #d1d5db;
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-hist-tab:hover {
  background: #273244;
}

html[data-theme="dark"] .pm-hist-tab.is-active {
  color: #111827;
  background: #f9fafb;
  border-color: #f9fafb;
}

.pm-hist-section {
  display: none;
}

.pm-hist-section.is-active {
  display: block;
}

/* =========================================================
   TABLES
   ========================================================= */

.pm-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.pm-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.pm-table th,
.pm-table td {
  padding: 11px 10px;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  text-align: left;
}

.pm-table th {
  color: #6b7280;
  background: #f9fafb;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pm-table td {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.pm-table td strong {
  display: block;
  color: #111827;
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.2;
}

.pm-table td small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.pm-table tbody tr:hover {
  background: #f9fafb;
}

.pm-table tbody tr:last-child td {
  border-bottom: 0;
}

html[data-theme="dark"] .pm-table th {
  color: #9ca3af;
  background: #1f2937;
  border-color: #273244;
}

html[data-theme="dark"] .pm-table td {
  color: #f9fafb;
  border-color: #273244;
}

html[data-theme="dark"] .pm-table td strong {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-table td small {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-table tbody tr:hover {
  background: #162032;
}

/* Columnas historial */
.pm-hist-table th:nth-child(1),
.pm-hist-table td:nth-child(1) {
  width: 140px;
}

.pm-hist-table th:nth-child(2),
.pm-hist-table td:nth-child(2) {
  width: 190px;
}

.pm-hist-table th:nth-child(3),
.pm-hist-table td:nth-child(3) {
  width: 120px;
}

.pm-hist-table th:nth-child(4),
.pm-hist-table td:nth-child(4) {
  width: 150px;
}

.pm-hist-table th:nth-child(5),
.pm-hist-table td:nth-child(5),
.pm-hist-table th:nth-child(6),
.pm-hist-table td:nth-child(6),
.pm-hist-table th:nth-child(7),
.pm-hist-table td:nth-child(7),
.pm-hist-table th:nth-child(8),
.pm-hist-table td:nth-child(8),
.pm-hist-table th:nth-child(9),
.pm-hist-table td:nth-child(9),
.pm-hist-table th:nth-child(10),
.pm-hist-table td:nth-child(10) {
  width: 92px;
  text-align: center;
}

.pm-hist-table th:nth-child(11),
.pm-hist-table td:nth-child(11) {
  width: 92px;
  text-align: center;
}

/* Columnas diferencias */
.pm-hist-diff-table {
  min-width: 1120px;
}

.pm-hist-diff-table th:nth-child(1),
.pm-hist-diff-table td:nth-child(1) {
  width: 140px;
}

.pm-hist-diff-table th:nth-child(2),
.pm-hist-diff-table td:nth-child(2) {
  width: 175px;
}

.pm-hist-diff-table th:nth-child(3),
.pm-hist-diff-table td:nth-child(3) {
  width: 250px;
}

.pm-hist-diff-table th:nth-child(4),
.pm-hist-diff-table td:nth-child(4) {
  width: 130px;
}

.pm-hist-diff-table th:nth-child(5),
.pm-hist-diff-table td:nth-child(5),
.pm-hist-diff-table th:nth-child(6),
.pm-hist-diff-table td:nth-child(6),
.pm-hist-diff-table th:nth-child(7),
.pm-hist-diff-table td:nth-child(7),
.pm-hist-diff-table th:nth-child(8),
.pm-hist-diff-table td:nth-child(8),
.pm-hist-diff-table th:nth-child(9),
.pm-hist-diff-table td:nth-child(9) {
  width: 88px;
  text-align: center;
}

.pm-hist-diff-table th:nth-child(10),
.pm-hist-diff-table td:nth-child(10) {
  width: 88px;
  text-align: center;
}

.pm-table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pm-hist-main {
  display: block;
  overflow: hidden;
  color: #111827;
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .pm-hist-main {
  color: #f9fafb;
}

.pm-hist-diff-product {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pm-hist-diff-product strong,
.pm-hist-diff-product small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-hist-diff-stock {
  color: #111827;
  font-weight: 900;
}

.pm-hist-diff-stock.is-low,
.pm-hist-diff-faltante {
  color: #b91c1c !important;
}

html[data-theme="dark"] .pm-hist-diff-stock {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-hist-diff-stock.is-low,
html[data-theme="dark"] .pm-hist-diff-faltante {
  color: #fca5a5 !important;
}

.pm-table tr.has-diff {
  background: #fff7ed;
}

.pm-table tr.is-ok {
  background: #f0fdf4;
}

html[data-theme="dark"] .pm-table tr.has-diff {
  background: #2a1b0f;
}

html[data-theme="dark"] .pm-table tr.is-ok {
  background: #102316;
}

/* =========================================================
   BADGES
   ========================================================= */

.pm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 24px;
  max-width: 100%;
  padding: 0 9px;

  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;

  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pm-badge.is-ok {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}

.pm-badge.is-warning {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.pm-badge.is-danger {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.pm-badge.is-info {
  color: #1f3a8a;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.pm-badge.is-muted {
  color: #4b5563;
  background: #f3f4f6;
  border-color: #e5e7eb;
}

html[data-theme="dark"] .pm-badge {
  color: #d1d5db;
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-badge.is-ok {
  color: #bbf7d0;
  background: #12301d;
  border-color: #166534;
}

html[data-theme="dark"] .pm-badge.is-warning {
  color: #fde68a;
  background: #332509;
  border-color: #92400e;
}

html[data-theme="dark"] .pm-badge.is-danger {
  color: #fecaca;
  background: #331313;
  border-color: #991b1b;
}

html[data-theme="dark"] .pm-badge.is-info {
  color: #bfdbfe;
  background: #13233f;
  border-color: #1d4ed8;
}

html[data-theme="dark"] .pm-badge.is-muted {
  color: #9ca3af;
  background: #1f2937;
  border-color: #374151;
}

/* =========================================================
   EVENT TIMELINE
   ========================================================= */

.pm-hist-events-panel {
  min-height: 420px;
}

.pm-hist-timeline {
  display: grid;
  gap: 10px;
  max-height: 620px;
  padding: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.pm-hist-event {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;

  padding: 11px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 15px;
}

html[data-theme="dark"] .pm-hist-event {
  background: #111827;
  border-color: #273244;
}

.pm-hist-event__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;

  color: #111827;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.pm-hist-event.is-ok .pm-hist-event__icon {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}

.pm-hist-event.is-warning .pm-hist-event__icon {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.pm-hist-event.is-danger .pm-hist-event__icon {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.pm-hist-event.is-info .pm-hist-event__icon {
  color: #1f3a8a;
  background: #dbeafe;
  border-color: #bfdbfe;
}

html[data-theme="dark"] .pm-hist-event__icon {
  color: #f9fafb;
  background: #1f2937;
  border-color: #374151;
}

.pm-hist-event__body {
  min-width: 0;
}

.pm-hist-event__body header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pm-hist-event__body header span {
  display: block;
  margin-bottom: 3px;

  color: #6b7280;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pm-hist-event__body header strong {
  display: block;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
}

.pm-hist-event__body header small {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.pm-hist-event__body time {
  color: #6b7280;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.pm-hist-event__body p {
  margin: 8px 0 0;
  color: #374151;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.pm-hist-event__body footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pm-hist-event__body footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 8px;

  font-size: 10.5px;
  font-weight: 750;
}

.pm-hist-event__body footer .pm-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.pm-hist-event__body footer .icon {
  width: 14px;
  height: 14px;
}

html[data-theme="dark"] .pm-hist-event__body header span,
html[data-theme="dark"] .pm-hist-event__body header small,
html[data-theme="dark"] .pm-hist-event__body time,
html[data-theme="dark"] .pm-hist-event__body footer span {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-hist-event__body header strong {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-hist-event__body p {
  color: #d1d5db;
}

html[data-theme="dark"] .pm-hist-event__body footer span {
  background: #1f2937;
  border-color: #374151;
}

/* =========================================================
   EMPTY STATES
   ========================================================= */

.pm-hist-empty,
.pm-hist-diff-empty {
  display: grid;
  place-items: center;
  gap: 7px;

  min-height: 180px;
  padding: 22px;

  color: #6b7280;
  text-align: center;
}

.pm-hist-empty .icon {
  width: 28px;
  height: 28px;
}

.pm-hist-empty strong,
.pm-hist-diff-empty strong {
  color: #111827;
  font-size: 14px;
  font-weight: 850;
}

.pm-hist-empty span,
.pm-hist-diff-empty span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 650;
}

.pm-hist-empty.is-error strong {
  color: #991b1b;
}

html[data-theme="dark"] .pm-hist-empty,
html[data-theme="dark"] .pm-hist-diff-empty,
html[data-theme="dark"] .pm-hist-empty span,
html[data-theme="dark"] .pm-hist-diff-empty span {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-hist-empty strong,
html[data-theme="dark"] .pm-hist-diff-empty strong {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-hist-empty.is-error strong {
  color: #fecaca;
}

/* =========================================================
   MOBILE DIFFERENCE CARDS
   ========================================================= */

.pm-hist-diff-mobile {
  display: none;
  padding: 12px;
}

.pm-hist-diff-card {
  display: grid;
  gap: 11px;

  padding: 13px;
  margin-bottom: 10px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

.pm-hist-diff-card:last-child {
  margin-bottom: 0;
}

html[data-theme="dark"] .pm-hist-diff-card {
  background: #111827;
  border-color: #273244;
}

.pm-hist-diff-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pm-hist-diff-card header span,
.pm-hist-diff-card header small {
  display: block;
  color: #6b7280;
  font-size: 11px;
  font-weight: 750;
}

.pm-hist-diff-card header strong {
  display: block;
  margin: 3px 0;
  color: #111827;
  font-size: 14px;
  font-weight: 850;
}

.pm-hist-diff-card__product {
  display: grid;
  gap: 4px;
}

.pm-hist-diff-card__product strong {
  color: #111827;
  font-size: 13px;
  font-weight: 850;
}

.pm-hist-diff-card__product span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 650;
}

.pm-hist-diff-card__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pm-hist-diff-card__grid div {
  padding: 9px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.pm-hist-diff-card__grid span {
  display: block;
  margin-bottom: 4px;
  color: #6b7280;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.pm-hist-diff-card__grid strong {
  color: #111827;
  font-size: 14px;
  font-weight: 900;
}

html[data-theme="dark"] .pm-hist-diff-card header span,
html[data-theme="dark"] .pm-hist-diff-card header small,
html[data-theme="dark"] .pm-hist-diff-card__product span,
html[data-theme="dark"] .pm-hist-diff-card__grid span {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-hist-diff-card header strong,
html[data-theme="dark"] .pm-hist-diff-card__product strong,
html[data-theme="dark"] .pm-hist-diff-card__grid strong {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-hist-diff-card__grid div {
  background: #1f2937;
  border-color: #374151;
}

/* =========================================================
   MODAL
   ========================================================= */

.pm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.pm-modal.is-open {
  display: flex;
}

.pm-modal__card {
  display: flex;
  flex-direction: column;

  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);

  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  overflow: hidden;
}

html[data-theme="dark"] .pm-modal__card {
  background: #111827;
  border-color: #374151;
}

.pm-hist-detail-modal {
  width: min(1280px, calc(100vw - 28px));
}

.pm-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  padding: 15px 16px;
  border-bottom: 1px solid #e5e7eb;
}

html[data-theme="dark"] .pm-modal__head {
  border-color: #273244;
}

.pm-modal__head span {
  display: block;
  margin-bottom: 4px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.pm-modal__head strong {
  display: block;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
}

.pm-modal__head small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 650;
}

html[data-theme="dark"] .pm-modal__head span,
html[data-theme="dark"] .pm-modal__head small {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-modal__head strong {
  color: #f9fafb;
}

.pm-modal__body {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* =========================================================
   DETAIL MODAL CONTENT
   ========================================================= */

.pm-hist-detail-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.pm-hist-detail-grid article {
  min-width: 0;
  padding: 11px;

  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.pm-hist-detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: #6b7280;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pm-hist-detail-grid strong {
  display: block;
  overflow: hidden;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .pm-hist-detail-grid article {
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-hist-detail-grid span {
  color: #9ca3af;
}

html[data-theme="dark"] .pm-hist-detail-grid strong {
  color: #f9fafb;
}

.pm-hist-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pm-hist-mini-table-wrap,
.pm-hist-detail-table-wrap {
  max-height: 360px;
  overflow: auto;
  scrollbar-width: thin;
}

.pm-hist-mini-table {
  min-width: 520px;
}

.pm-hist-detail-table {
  min-width: 980px;
}

.pm-hist-mini-table th:nth-child(1),
.pm-hist-mini-table td:nth-child(1) {
  width: 130px;
}

.pm-hist-mini-table th:nth-child(2),
.pm-hist-mini-table td:nth-child(2) {
  width: auto;
}

.pm-hist-mini-table th:nth-child(3),
.pm-hist-mini-table td:nth-child(3) {
  width: 90px;
  text-align: center;
}

.pm-hist-detail-table th:nth-child(1),
.pm-hist-detail-table td:nth-child(1) {
  width: 130px;
}

.pm-hist-detail-table th:nth-child(2),
.pm-hist-detail-table td:nth-child(2) {
  width: 280px;
}

.pm-hist-detail-table th:nth-child(3),
.pm-hist-detail-table td:nth-child(3),
.pm-hist-detail-table th:nth-child(4),
.pm-hist-detail-table td:nth-child(4),
.pm-hist-detail-table th:nth-child(5),
.pm-hist-detail-table td:nth-child(5),
.pm-hist-detail-table th:nth-child(6),
.pm-hist-detail-table td:nth-child(6) {
  width: 92px;
  text-align: center;
}

.pm-hist-detail-table th:nth-child(7),
.pm-hist-detail-table td:nth-child(7) {
  width: 115px;
  text-align: center;
}

.pm-hist-detail-table th:nth-child(8),
.pm-hist-detail-table td:nth-child(8) {
  width: 190px;
}

.pm-hist-detail-events {
  display: grid;
  gap: 9px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
}

.pm-hist-detail-events article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;

  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.pm-hist-detail-events strong {
  display: block;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
}

.pm-hist-detail-events span,
.pm-hist-detail-events small {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 650;
}

html[data-theme="dark"] .pm-hist-detail-events article {
  background: #1f2937;
  border-color: #374151;
}

html[data-theme="dark"] .pm-hist-detail-events strong {
  color: #f9fafb;
}

html[data-theme="dark"] .pm-hist-detail-events span,
html[data-theme="dark"] .pm-hist-detail-events small {
  color: #9ca3af;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .pm-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pm-hist-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pm-hist-compare-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .pm-head,
  .pm-panel__head,
  .pm-panel__head--toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pm-actions,
  .pm-toolbar {
    justify-content: flex-start;
    width: 100%;
  }

  .pm-search {
    width: 100%;
    min-width: 0;
  }

  .pm-toolbar select,
  .pm-toolbar input[type="date"] {
    flex: 1 1 160px;
    min-width: 0;
  }

  .pm-table {
    min-width: 980px;
  }
}

@media (max-width: 760px) {
  .pm-page.pm-hist-page {
    gap: 10px;
  }

  .pm-head,
  .pm-panel,
  .pm-card-metric {
    border-radius: 16px;
  }

  .pm-brand {
    align-items: flex-start;
  }

  .pm-brand__icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .pm-brand h2 {
    font-size: 19px;
  }

  .pm-brand p {
    font-size: 12px;
  }

  .pm-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pm-card-metric strong {
    font-size: 22px;
  }

  .pm-hist-diff-table-wrap {
    display: none;
  }

  .pm-hist-diff-mobile {
    display: grid;
  }

  .pm-hist-diff-card__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pm-hist-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pm-modal {
    padding: 10px;
  }

  .pm-modal__card,
  .pm-hist-detail-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .pm-modal__head {
    align-items: stretch;
    flex-direction: column;
  }

  .pm-modal__body {
    padding: 10px;
  }
}

@media (max-width: 520px) {
  .pm-metrics,
  .pm-hist-detail-grid {
    grid-template-columns: 1fr;
  }

  .pm-actions,
  .pm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pm-btn {
    width: 100%;
  }

  .pm-toolbar select,
  .pm-toolbar input[type="date"] {
    width: 100%;
  }

  .pm-hist-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pm-hist-tab {
    width: 100%;
  }

  .pm-hist-event {
    grid-template-columns: 1fr;
  }

  .pm-hist-event__body header {
    flex-direction: column;
  }

  .pm-hist-event__body time {
    white-space: normal;
  }
}/* =========================================================
   HISTORIAL · SIN AZUL OSCURO
   Paleta neutra: negro / blanco / grises
   ========================================================= */

/* Botones principales activos */
.pm-btn--dark,
.pm-hist-tab.is-active {
  color: #ffffff !important;
  background: #111111 !important;
  border-color: #111111 !important;
}

.pm-btn--dark:hover,
.pm-hist-tab.is-active:hover {
  color: #ffffff !important;
  background: #000000 !important;
  border-color: #000000 !important;
}

/* Modo oscuro: botón activo sigue neutro, no azul */
html[data-theme="dark"] .pm-btn--dark,
html[data-theme="dark"] .pm-hist-tab.is-active {
  color: #111111 !important;
  background: #ffffff !important;
  border-color: #ffffff !important;
}

html[data-theme="dark"] .pm-btn--dark:hover,
html[data-theme="dark"] .pm-hist-tab.is-active:hover {
  color: #111111 !important;
  background: #e5e7eb !important;
  border-color: #e5e7eb !important;
}

/* Badges info: antes azul, ahora gris */
.pm-badge.is-info {
  color: #374151 !important;
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
}

html[data-theme="dark"] .pm-badge.is-info {
  color: #f3f4f6 !important;
  background: #1f2937 !important;
  border-color: #4b5563 !important;
}

/* Eventos info: antes azul, ahora gris */
.pm-hist-event.is-info .pm-hist-event__icon {
  color: #374151 !important;
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
}

html[data-theme="dark"] .pm-hist-event.is-info .pm-hist-event__icon {
  color: #f3f4f6 !important;
  background: #1f2937 !important;
  border-color: #4b5563 !important;
}

/* Iconos / fondos que podían verse azulados */
.pm-brand__icon,
.pm-hist-event__icon {
  color: #111111 !important;
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
}

html[data-theme="dark"] .pm-brand__icon,
html[data-theme="dark"] .pm-hist-event__icon {
  color: #ffffff !important;
  background: #1f2937 !important;
  border-color: #4b5563 !important;
}

/* Hover de filas sin tinte azul */
.pm-table tbody tr:hover {
  background: #f9fafb !important;
}

html[data-theme="dark"] .pm-table tbody tr:hover {
  background: #1f2937 !important;
}

/* Inputs / selects sin azul */
.pm-search,
.pm-toolbar select,
.pm-toolbar input[type="date"] {
  accent-color: #111111;
}

html[data-theme="dark"] .pm-search,
html[data-theme="dark"] .pm-toolbar select,
html[data-theme="dark"] .pm-toolbar input[type="date"] {
  accent-color: #ffffff;
}/* =========================================================
   HISTORIAL · LIMPIEZA TOTAL AZUL
   Negro / gris neutro real
   Pegar al final del CSS
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page,
html[data-theme="dark"] .pm-page.pm-hist-page * {
  scrollbar-color: #525252 #0a0a0a;
}

/* =========================================================
   FONDOS PRINCIPALES
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-head,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-panel,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-card-metric,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-modal__card,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-event,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-diff-card {
  background: #0f0f0f !important;
  border-color: #2a2a2a !important;
  color: #f5f5f5 !important;
}

/* Fondo de cabeceras internas */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-panel__head,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-modal__head {
  background: #0f0f0f !important;
  border-color: #2a2a2a !important;
}

/* Bloque tabs que se veía azul */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tabs-panel {
  background: #0f0f0f !important;
  border-color: #2a2a2a !important;
}

/* =========================================================
   TABLAS · SACAR AZUL DE FILAS Y CABECERA
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table th {
  background: #181818 !important;
  color: #a3a3a3 !important;
  border-color: #2a2a2a !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table td {
  background: #101010 !important;
  color: #f5f5f5 !important;
  border-color: #2a2a2a !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table tbody tr:hover td {
  background: #1a1a1a !important;
}

/* Filas OK / diferencia sin azul */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-table tr.has-diff td {
  background: #1c1410 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table tr.is-ok td {
  background: #101810 !important;
}

/* =========================================================
   INPUTS / FILTROS
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-search,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-toolbar select,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-toolbar input[type="date"] {
  background: #181818 !important;
  border-color: #333333 !important;
  color: #f5f5f5 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-search input {
  color: #f5f5f5 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-search input::placeholder {
  color: #a3a3a3 !important;
}

/* =========================================================
   BOTONES
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-btn,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-icon-btn,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab {
  background: #181818 !important;
  border-color: #333333 !important;
  color: #f5f5f5 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-btn:hover,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-icon-btn:hover,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab:hover {
  background: #222222 !important;
  border-color: #4a4a4a !important;
  color: #ffffff !important;
}

/* Activos blancos como en tu screenshot */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-btn--dark,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #111111 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-btn--dark:hover,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active:hover {
  background: #e5e5e5 !important;
  border-color: #e5e5e5 !important;
  color: #111111 !important;
}

/* =========================================================
   ICONOS / CONTENEDORES DE ICONOS
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-brand__icon,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-event__icon {
  background: #181818 !important;
  border-color: #333333 !important;
  color: #f5f5f5 !important;
}

/* =========================================================
   BADGES · SIN AZUL
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge.is-info,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge.is-muted {
  background: #222222 !important;
  border-color: #3a3a3a !important;
  color: #d4d4d4 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge.is-ok {
  background: #102015 !important;
  border-color: #245c36 !important;
  color: #86efac !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge.is-warning {
  background: #241a0b !important;
  border-color: #7c4a03 !important;
  color: #facc15 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-badge.is-danger {
  background: #2a1111 !important;
  border-color: #7f1d1d !important;
  color: #fca5a5 !important;
}

/* Evento info antes azul */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-event.is-info .pm-hist-event__icon {
  background: #222222 !important;
  border-color: #3a3a3a !important;
  color: #e5e5e5 !important;
}

/* =========================================================
   TARJETAS / DETALLE MODAL
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-detail-grid article,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-diff-card__grid div,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-detail-events article {
  background: #181818 !important;
  border-color: #333333 !important;
}

/* =========================================================
   TEXTOS
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page strong,
html[data-theme="dark"] .pm-page.pm-hist-page h2,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-main,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-table td strong {
  color: #f5f5f5 !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page span,
html[data-theme="dark"] .pm-page.pm-hist-page small,
html[data-theme="dark"] .pm-page.pm-hist-page p,
html[data-theme="dark"] .pm-page.pm-hist-page time {
  color: #a3a3a3 !important;
}

/* Respetar faltantes en rojo */
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-diff-faltante,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-diff-stock.is-low {
  color: #f87171 !important;
}

/* =========================================================
   MODAL OVERLAY
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-modal {
  background: rgba(0, 0, 0, 0.72) !important;
}/* =========================================================
   PEDIDOS MAYORISTAS · HISTORIAL
   TAMAÑO IGUAL A LAS DEMÁS PÁGINAS
   ========================================================= */

.pm-page.pm-hist-page {
  gap: 9px !important;
}

/* Header */
.pm-page.pm-hist-page .pm-head {
  min-height: 60px !important;
  padding: 10px !important;
  gap: 10px !important;
  border-radius: 16px !important;
}

.pm-page.pm-hist-page .pm-brand {
  gap: 9px !important;
}

.pm-page.pm-hist-page .pm-brand__icon {
  width: 32px !important;
  height: 32px !important;
  flex: 0 0 32px !important;
  border-radius: 11px !important;
}

.pm-page.pm-hist-page .pm-brand__icon .icon,
.pm-page.pm-hist-page .pm-brand__icon svg {
  width: 15.5px !important;
  height: 15.5px !important;
}

.pm-page.pm-hist-page .pm-brand h2 {
  font-size: 15px !important;
  line-height: 1 !important;
}

.pm-page.pm-hist-page .pm-brand p {
  margin-top: 3px !important;
  font-size: 9.8px !important;
  line-height: 1.36 !important;
}

/* Iconos generales */
.pm-page.pm-hist-page .icon,
.pm-page.pm-hist-page svg,
.pm-modal .icon,
.pm-modal svg {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
}

/* Botones */
.pm-page.pm-hist-page .pm-btn,
.pm-page.pm-hist-page .pm-hist-tab,
.pm-modal .pm-btn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  gap: 5px !important;
  border-radius: 10px !important;
  font-size: 9.4px !important;
}

.pm-page.pm-hist-page .pm-icon-btn,
.pm-modal .pm-icon-btn {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  border-radius: 10px !important;
}

/* Métricas */
.pm-page.pm-hist-page .pm-metrics {
  gap: 9px !important;
}

.pm-page.pm-hist-page .pm-card-metric {
  min-height: 48px !important;
  padding: 9px 10px !important;
  border-radius: 16px !important;
}

.pm-page.pm-hist-page .pm-card-metric span {
  margin-bottom: 4px !important;
  font-size: 7.8px !important;
  line-height: 1 !important;
}

.pm-page.pm-hist-page .pm-card-metric strong {
  font-size: 16px !important;
  line-height: 1 !important;
}

.pm-page.pm-hist-page .pm-card-metric small {
  margin-top: 4px !important;
  font-size: 7.8px !important;
  line-height: 1.1 !important;
}

/* Paneles */
.pm-page.pm-hist-page .pm-panel {
  border-radius: 16px !important;
}

.pm-page.pm-hist-page .pm-panel__head,
.pm-modal .pm-panel__head {
  min-height: 46px !important;
  padding: 10px 11px !important;
  gap: 10px !important;
}

.pm-page.pm-hist-page .pm-panel__head span,
.pm-modal .pm-panel__head span {
  margin-bottom: 3px !important;
  font-size: 7.8px !important;
}

.pm-page.pm-hist-page .pm-panel__head strong,
.pm-modal .pm-panel__head strong {
  font-size: 12px !important;
}

.pm-page.pm-hist-page .pm-panel__head small {
  margin-top: 3px !important;
  font-size: 8.8px !important;
}

/* Toolbar / filtros */
.pm-page.pm-hist-page .pm-toolbar {
  gap: 7px !important;
  min-width: min(100%, 650px) !important;
}

.pm-page.pm-hist-page .pm-search {
  min-width: 240px !important;
  height: 30px !important;
  padding: 0 9px !important;
  gap: 6px !important;
  border-radius: 10px !important;
}

.pm-page.pm-hist-page .pm-search input {
  font-size: 9.6px !important;
}

.pm-page.pm-hist-page .pm-toolbar select,
.pm-page.pm-hist-page .pm-toolbar input[type="date"] {
  height: 30px !important;
  min-width: 118px !important;
  padding: 0 9px !important;
  border-radius: 10px !important;
  font-size: 9.4px !important;
}

/* Tabs */
.pm-page.pm-hist-page .pm-hist-tabs-panel {
  padding: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-tabs {
  gap: 7px !important;
}

.pm-page.pm-hist-page .pm-hist-tab {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  font-size: 9.4px !important;
}

/* Tablas */
.pm-page.pm-hist-page .pm-table {
  min-width: 920px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table {
  min-width: 1040px !important;
}

.pm-page.pm-hist-page .pm-table th {
  padding: 8px !important;
  font-size: 7.8px !important;
  line-height: 1.1 !important;
}

.pm-page.pm-hist-page .pm-table td {
  padding: 8px !important;
  font-size: 9.6px !important;
  line-height: 1.2 !important;
}

.pm-page.pm-hist-page .pm-table td strong,
.pm-page.pm-hist-page .pm-hist-main {
  font-size: 10px !important;
  line-height: 1.15 !important;
}

.pm-page.pm-hist-page .pm-table td small {
  margin-top: 3px !important;
  font-size: 8px !important;
}

.pm-page.pm-hist-page .pm-table-actions {
  gap: 5px !important;
}

/* Badges */
.pm-page.pm-hist-page .pm-badge,
.pm-modal .pm-badge {
  min-height: 20px !important;
  padding: 0 8px !important;
  font-size: 8px !important;
}

/* Línea de tiempo */
.pm-page.pm-hist-page .pm-hist-events-panel {
  min-height: 360px !important;
}

.pm-page.pm-hist-page .pm-hist-timeline {
  gap: 8px !important;
  max-height: 560px !important;
  padding: 10px !important;
}

.pm-page.pm-hist-page .pm-hist-event {
  grid-template-columns: 32px minmax(0, 1fr) !important;
  gap: 9px !important;
  padding: 10px !important;
  border-radius: 14px !important;
}

.pm-page.pm-hist-page .pm-hist-event__icon {
  width: 32px !important;
  height: 32px !important;
  border-radius: 11px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header {
  gap: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header span {
  margin-bottom: 3px !important;
  font-size: 7.8px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header strong {
  font-size: 10.8px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header small {
  margin-top: 3px !important;
  font-size: 8.4px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body time {
  font-size: 8.4px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body p {
  margin-top: 7px !important;
  font-size: 9px !important;
  line-height: 1.35 !important;
}

.pm-page.pm-hist-page .pm-hist-event__body footer {
  gap: 6px !important;
  margin-top: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body footer span {
  padding: 4px 7px !important;
  font-size: 8.4px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body footer .pm-btn {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 9px !important;
  font-size: 8.8px !important;
}

/* Empty states */
.pm-page.pm-hist-page .pm-hist-empty,
.pm-page.pm-hist-page .pm-hist-diff-empty {
  min-height: 180px !important;
  padding: 20px !important;
  gap: 7px !important;
}

.pm-page.pm-hist-page .pm-hist-empty .icon {
  width: 30px !important;
  height: 30px !important;
}

.pm-page.pm-hist-page .pm-hist-empty strong,
.pm-page.pm-hist-page .pm-hist-diff-empty strong {
  font-size: 13px !important;
}

.pm-page.pm-hist-page .pm-hist-empty span,
.pm-page.pm-hist-page .pm-hist-diff-empty span {
  font-size: 9.4px !important;
}

/* Mobile diferencias */
.pm-page.pm-hist-page .pm-hist-diff-mobile {
  padding: 10px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card {
  gap: 9px !important;
  padding: 10px !important;
  margin-bottom: 9px !important;
  border-radius: 14px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card header {
  gap: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card header span,
.pm-page.pm-hist-page .pm-hist-diff-card header small {
  font-size: 8.4px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card header strong {
  margin: 3px 0 !important;
  font-size: 10.8px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__product {
  gap: 3px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__product strong {
  font-size: 10.4px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__product span {
  font-size: 8.8px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid {
  gap: 7px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid div {
  padding: 8px !important;
  border-radius: 11px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid span {
  margin-bottom: 3px !important;
  font-size: 7.6px !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid strong {
  font-size: 11px !important;
}

/* Modal */
.pm-page.pm-hist-page .pm-modal,
.pm-modal {
  padding: 14px !important;
}

.pm-page.pm-hist-page .pm-modal__card,
.pm-modal__card {
  width: min(980px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - 32px) !important;
  border-radius: 16px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-modal,
.pm-hist-detail-modal {
  width: min(1040px, calc(100vw - 32px)) !important;
}

.pm-page.pm-hist-page .pm-modal__head,
.pm-modal__head {
  min-height: 54px !important;
  padding: 10px 12px !important;
  gap: 10px !important;
}

.pm-page.pm-hist-page .pm-modal__head span,
.pm-modal__head span {
  margin-bottom: 3px !important;
  font-size: 8px !important;
}

.pm-page.pm-hist-page .pm-modal__head strong,
.pm-modal__head strong {
  font-size: 14px !important;
}

.pm-page.pm-hist-page .pm-modal__head small,
.pm-modal__head small {
  margin-top: 3px !important;
  font-size: 8.8px !important;
}

.pm-page.pm-hist-page .pm-modal__body,
.pm-modal__body {
  gap: 10px !important;
  padding: 10px !important;
}

/* Detalle modal */
.pm-page.pm-hist-page .pm-hist-detail-grid {
  gap: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-grid article {
  min-height: 48px !important;
  padding: 9px 10px !important;
  border-radius: 13px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-grid span {
  margin-bottom: 4px !important;
  font-size: 7.8px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-grid strong {
  font-size: 10.4px !important;
}

.pm-page.pm-hist-page .pm-hist-compare-grid {
  gap: 10px !important;
}

.pm-page.pm-hist-page .pm-hist-mini-table-wrap,
.pm-page.pm-hist-page .pm-hist-detail-table-wrap {
  max-height: 320px !important;
}

.pm-page.pm-hist-page .pm-hist-mini-table {
  min-width: 500px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-table {
  min-width: 920px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events {
  gap: 8px !important;
  max-height: 280px !important;
  padding: 10px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events article {
  grid-template-columns: 32px minmax(0, 1fr) !important;
  gap: 8px !important;
  padding: 9px !important;
  border-radius: 13px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events strong {
  font-size: 10.4px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events span,
.pm-page.pm-hist-page .pm-hist-detail-events small {
  margin-top: 3px !important;
  font-size: 8.4px !important;
}

/* Responsive */
@media (max-width: 760px) {
  .pm-page.pm-hist-page {
    gap: 9px !important;
  }

  .pm-page.pm-hist-page .pm-head,
  .pm-page.pm-hist-page .pm-panel,
  .pm-page.pm-hist-page .pm-card-metric {
    border-radius: 14px !important;
  }

  .pm-page.pm-hist-page .pm-brand__icon {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }

  .pm-page.pm-hist-page .pm-brand h2 {
    font-size: 15px !important;
  }

  .pm-page.pm-hist-page .pm-brand p {
    font-size: 9.4px !important;
  }

  .pm-page.pm-hist-page .pm-card-metric strong {
    font-size: 16px !important;
  }

  .pm-page.pm-hist-page .pm-modal {
    padding: 8px !important;
  }

  .pm-page.pm-hist-page .pm-modal__card,
  .pm-page.pm-hist-page .pm-hist-detail-modal,
  .pm-modal__card,
  .pm-hist-detail-modal {
    width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    border-radius: 16px !important;
  }

  .pm-page.pm-hist-page .pm-modal__body {
    padding: 9px !important;
  }
}

@media (max-width: 520px) {
  .pm-page.pm-hist-page .pm-actions,
  .pm-page.pm-hist-page .pm-toolbar {
    align-items: stretch !important;
  }

  .pm-page.pm-hist-page .pm-btn {
    width: 100% !important;
  }

  .pm-page.pm-hist-page .pm-hist-tabs {
    grid-template-columns: 1fr !important;
  }

  .pm-page.pm-hist-page .pm-hist-tab {
    width: 100% !important;
  }

  .pm-page.pm-hist-page .pm-hist-event {
    grid-template-columns: 1fr !important;
  }

  .pm-page.pm-hist-page .pm-hist-event__body header {
    flex-direction: column !important;
  }
}/* =========================================================
   HISTORIAL · BOTONES E ICONOS VENTANA
   - Exportar CSV / Pedidos con letra negra
   - Iconos eventos centrados
   ========================================================= */

/* Botones activos en modo oscuro: fondo blanco + texto negro */
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-pm-hist],
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-detail-csv],
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #111111 !important;
}

/* Texto e iconos internos negros */
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-pm-hist] *,
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-detail-csv] *,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active *,
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-pm-hist] svg,
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-detail-csv] svg,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active svg {
  color: #111111 !important;
  stroke: #111111 !important;
}

/* Hover modo oscuro */
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-pm-hist]:hover,
html[data-theme="dark"] .pm-page.pm-hist-page [data-export-detail-csv]:hover,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab.is-active:hover {
  background: #e5e5e5 !important;
  border-color: #e5e5e5 !important;
  color: #111111 !important;
}

/* Modo claro: activo negro + letra blanca */
html[data-theme="light"] .pm-page.pm-hist-page [data-export-pm-hist],
html[data-theme="light"] .pm-page.pm-hist-page [data-export-detail-csv],
html[data-theme="light"] .pm-page.pm-hist-page .pm-hist-tab.is-active {
  background: #111111 !important;
  border-color: #111111 !important;
  color: #ffffff !important;
}

html[data-theme="light"] .pm-page.pm-hist-page [data-export-pm-hist] *,
html[data-theme="light"] .pm-page.pm-hist-page [data-export-detail-csv] *,
html[data-theme="light"] .pm-page.pm-hist-page .pm-hist-tab.is-active *,
html[data-theme="light"] .pm-page.pm-hist-page [data-export-pm-hist] svg,
html[data-theme="light"] .pm-page.pm-hist-page [data-export-detail-csv] svg,
html[data-theme="light"] .pm-page.pm-hist-page .pm-hist-tab.is-active svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* =========================================================
   EVENTOS · ICONOS CENTRADOS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-event__icon,
.pm-page.pm-hist-page .pm-hist-detail-events .pm-hist-event__icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;

  padding: 0 !important;
  line-height: 1 !important;
}

.pm-page.pm-hist-page .pm-hist-event__icon .icon,
.pm-page.pm-hist-page .pm-hist-event__icon svg,
.pm-page.pm-hist-page .pm-hist-detail-events .pm-hist-event__icon .icon,
.pm-page.pm-hist-page .pm-hist-detail-events .pm-hist-event__icon svg {
  display: block !important;

  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;

  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
}/* =========================================================
   HISTORIAL · MODAL NO CORTADO POR TOPBAR / FOOTER
   ========================================================= */

/* Overlay por encima de topbar/footer */
.pm-page.pm-hist-page .pm-modal,
.pm-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;

  display: none !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 64px 16px 28px !important;
  background: rgba(0, 0, 0, 0.72) !important;

  overflow: hidden !important;
}

.pm-page.pm-hist-page .pm-modal.is-open,
.pm-modal.is-open {
  display: flex !important;
}

/* Card más baja y centrada */
.pm-page.pm-hist-page .pm-modal__card,
.pm-modal__card,
.pm-page.pm-hist-page .pm-hist-detail-modal,
.pm-hist-detail-modal {
  width: min(1040px, calc(100vw - 32px)) !important;
  height: min(760px, calc(100vh - 108px)) !important;
  max-height: calc(100vh - 108px) !important;

  display: flex !important;
  flex-direction: column !important;

  border-radius: 16px !important;
  overflow: hidden !important;
}

/* Header fijo dentro de la ventana */
.pm-page.pm-hist-page .pm-modal__head,
.pm-modal__head {
  flex: 0 0 auto !important;
  min-height: 54px !important;
  padding: 10px 12px !important;
}

/* Body scrolleable */
.pm-page.pm-hist-page .pm-modal__body,
.pm-modal__body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;

  overflow-y: auto !important;
  overflow-x: hidden !important;

  padding: 10px !important;
  scrollbar-width: thin !important;
}

/* Tablas internas con altura menor para que no empujen el modal */
.pm-page.pm-hist-page .pm-hist-mini-table-wrap,
.pm-page.pm-hist-page .pm-hist-detail-table-wrap {
  max-height: 220px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events {
  max-height: 260px !important;
  overflow-y: auto !important;
}

/* Eventos más compactos dentro del modal */
.pm-page.pm-hist-page .pm-hist-detail-events article {
  min-height: 48px !important;
  padding: 8px 9px !important;
}

.pm-page.pm-hist-page .pm-hist-detail-events .pm-hist-event__icon {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
}

/* Mobile */
@media (max-width: 760px) {
  .pm-page.pm-hist-page .pm-modal,
  .pm-modal {
    padding: 56px 8px 14px !important;
  }

  .pm-page.pm-hist-page .pm-modal__card,
  .pm-modal__card,
  .pm-page.pm-hist-page .pm-hist-detail-modal,
  .pm-hist-detail-modal {
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 70px) !important;
    max-height: calc(100vh - 70px) !important;
  }

  .pm-page.pm-hist-page .pm-modal__body,
  .pm-modal__body {
    padding: 9px !important;
  }
}/* =========================================================
   PEDIDOS MAYORISTAS · HISTORIAL
   MISMA ESCALA + TODO EL ANCHO + MODAL CORREGIDO
   Agregar al FINAL de historial.css
   ========================================================= */

/* =========================================================
   CONTENEDOR GENERAL · TODO EL ANCHO
   ========================================================= */

.app-content:has(.pm-hist-page) {
  width: 100% !important;
  max-width: none !important;

  padding-left: 10px !important;
  padding-right: 10px !important;
}

.pm-page.pm-hist-page,
.pm-page.pm-hist-page .pm-head,
.pm-page.pm-hist-page .pm-metrics,
.pm-page.pm-hist-page .pm-panel,
.pm-page.pm-hist-page .pm-table-wrap,
.pm-page.pm-hist-page .pm-hist-section {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.pm-page.pm-hist-page {
  gap: 12px !important;
}

/* =========================================================
   CABECERA PRINCIPAL
   ========================================================= */

.pm-page.pm-hist-page .pm-head {
  min-height: 92px !important;

  padding:
    15px
    17px !important;

  gap: 16px !important;

  border-radius: 13px !important;
}

.pm-page.pm-hist-page .pm-brand {
  gap: 13px !important;
}

.pm-page.pm-hist-page .pm-brand__icon {
  display: grid !important;
  place-items: center !important;

  width: 46px !important;
  height: 46px !important;
  flex: 0 0 46px !important;

  padding: 0 !important;

  border-radius: 11px !important;
}

.pm-page.pm-hist-page .pm-brand__icon .icon,
.pm-page.pm-hist-page .pm-brand__icon svg {
  width: 21px !important;
  height: 21px !important;
  min-width: 21px !important;
  min-height: 21px !important;

  margin: 0 !important;
}

.pm-page.pm-hist-page .pm-brand h2 {
  font-size:
    clamp(
      24px,
      2.1vw,
      30px
    ) !important;

  font-weight: 950 !important;
  line-height: 1 !important;
}

.pm-page.pm-hist-page .pm-brand p {
  margin-top: 6px !important;

  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1.45 !important;
}

/* =========================================================
   BOTONES
   ========================================================= */

.pm-page.pm-hist-page .pm-btn,
.pm-page.pm-hist-page .pm-hist-tab,
#pmHistorialModal .pm-btn {
  min-height: 36px !important;
  height: 36px !important;

  padding:
    0
    12px !important;

  gap: 7px !important;

  border-radius: 9px !important;

  font-size: 11px !important;
  font-weight: 900 !important;
}

.pm-page.pm-hist-page .pm-icon-btn,
#pmHistorialModal .pm-icon-btn {
  display: grid !important;
  place-items: center !important;

  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;

  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;

  padding: 0 !important;

  border-radius: 9px !important;
}

.pm-page.pm-hist-page .pm-btn .icon,
.pm-page.pm-hist-page .pm-btn svg,
.pm-page.pm-hist-page .pm-icon-btn .icon,
.pm-page.pm-hist-page .pm-icon-btn svg,
.pm-page.pm-hist-page .pm-hist-tab .icon,
.pm-page.pm-hist-page .pm-hist-tab svg,
#pmHistorialModal .icon,
#pmHistorialModal svg {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;

  margin: 0 !important;
}

/* =========================================================
   MÉTRICAS
   ========================================================= */

.pm-page.pm-hist-page .pm-metrics {
  grid-template-columns:
    repeat(
      6,
      minmax(0, 1fr)
    ) !important;

  gap: 1px !important;

  overflow: hidden !important;

  background: #e5e5e5 !important;
  border: 1px solid #dedede !important;
  border-radius: 13px !important;
}

.pm-page.pm-hist-page .pm-card-metric {
  min-height: 72px !important;

  padding:
    11px
    12px !important;

  border: 0 !important;
  border-radius: 0 !important;
}

.pm-page.pm-hist-page .pm-card-metric span {
  margin-bottom: 5px !important;

  font-size: 9px !important;
  font-weight: 900 !important;
}

.pm-page.pm-hist-page .pm-card-metric strong {
  font-size: 19px !important;
  font-weight: 950 !important;
}

.pm-page.pm-hist-page .pm-card-metric small {
  margin-top: 5px !important;

  font-size: 9.5px !important;
  font-weight: 700 !important;
}

html[data-theme="dark"]
.pm-page.pm-hist-page
.pm-metrics {
  background: #282828 !important;
  border-color: #282828 !important;
}

/* =========================================================
   PANELES
   ========================================================= */

.pm-page.pm-hist-page .pm-panel {
  border-radius: 13px !important;
}

.pm-page.pm-hist-page .pm-panel__head {
  min-height: 60px !important;

  padding:
    10px
    13px !important;

  gap: 12px !important;
}

.pm-page.pm-hist-page .pm-panel__head span {
  margin-bottom: 4px !important;

  font-size: 9px !important;
  font-weight: 900 !important;
}

.pm-page.pm-hist-page .pm-panel__head strong {
  font-size: 14px !important;
  font-weight: 950 !important;
}

.pm-page.pm-hist-page .pm-panel__head small {
  font-size: 9.5px !important;
}

/* =========================================================
   FILTROS
   ========================================================= */

.pm-page.pm-hist-page .pm-panel__head--toolbar {
  align-items: center !important;
}

.pm-page.pm-hist-page .pm-toolbar {
  display: grid !important;

  grid-template-columns:
    minmax(300px, 1fr)
    150px
    170px
    140px
    140px !important;

  gap: 8px !important;

  width: min(100%, 1050px) !important;
  min-width: 0 !important;
}

.pm-page.pm-hist-page .pm-search,
.pm-page.pm-hist-page .pm-toolbar select,
.pm-page.pm-hist-page .pm-toolbar input[type="date"] {
  width: 100% !important;
  min-width: 0 !important;

  height: 38px !important;
  min-height: 38px !important;

  border-radius: 9px !important;

  font-size: 10.8px !important;
  font-weight: 800 !important;
}

.pm-page.pm-hist-page .pm-search {
  padding:
    0
    11px !important;
}

.pm-page.pm-hist-page .pm-search input {
  font-size: 10.8px !important;
}

/* =========================================================
   PESTAÑAS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-tabs-panel {
  padding: 8px !important;
}

.pm-page.pm-hist-page .pm-hist-tabs {
  gap: 7px !important;
}

.pm-page.pm-hist-page .pm-hist-tab {
  min-width: 112px !important;

  padding:
    0
    13px !important;
}

/* =========================================================
   TABLAS · USAR TODO EL ANCHO
   ========================================================= */

.pm-page.pm-hist-page .pm-table {
  width: 100% !important;
  min-width: 0 !important;

  table-layout: fixed !important;
}

.pm-page.pm-hist-page .pm-table th {
  height: 42px !important;

  padding:
    0
    9px !important;

  font-size: 8.8px !important;
  font-weight: 950 !important;
}

.pm-page.pm-hist-page .pm-table td {
  height: 52px !important;

  padding:
    8px
    9px !important;

  font-size: 10.5px !important;
  font-weight: 760 !important;
}

.pm-page.pm-hist-page .pm-table td strong,
.pm-page.pm-hist-page .pm-hist-main {
  font-size: 10.8px !important;
  font-weight: 950 !important;
}

.pm-page.pm-hist-page .pm-table td small {
  margin-top: 3px !important;

  font-size: 8.8px !important;
}

/* =========================================================
   COLUMNAS · PEDIDOS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-table th:nth-child(1),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(1) {
  width: 13% !important;
}

.pm-page.pm-hist-page .pm-hist-table th:nth-child(2),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(2) {
  width: 16% !important;
}

.pm-page.pm-hist-page .pm-hist-table th:nth-child(3),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(3) {
  width: 11% !important;
}

.pm-page.pm-hist-page .pm-hist-table th:nth-child(4),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(4) {
  width: 13% !important;
}

.pm-page.pm-hist-page .pm-hist-table th:nth-child(5),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(5),
.pm-page.pm-hist-page .pm-hist-table th:nth-child(6),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(6),
.pm-page.pm-hist-page .pm-hist-table th:nth-child(7),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(7),
.pm-page.pm-hist-page .pm-hist-table th:nth-child(8),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(8),
.pm-page.pm-hist-page .pm-hist-table th:nth-child(9),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(9),
.pm-page.pm-hist-page .pm-hist-table th:nth-child(10),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(10) {
  width: 7% !important;
}

.pm-page.pm-hist-page .pm-hist-table th:nth-child(11),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(11) {
  width: 7% !important;

  text-align: center !important;
}

/* =========================================================
   COLUMNAS · DIFERENCIAS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(1),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(1) {
  width: 12% !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(2),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(2) {
  width: 14% !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(3),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(3) {
  width: 22% !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(4),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(4) {
  width: 13% !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(5),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(5),
.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(6),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(6),
.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(7),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(7),
.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(8),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(8),
.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(9),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(9) {
  width: 7% !important;
}

.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(10),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(10) {
  width: 8% !important;

  text-align: center !important;
}

/* =========================================================
   ACCIONES
   ========================================================= */

.pm-page.pm-hist-page .pm-table-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
}

/* =========================================================
   BADGES
   ========================================================= */

.pm-page.pm-hist-page .pm-badge,
#pmHistorialModal .pm-badge {
  min-height: 24px !important;

  padding:
    4px
    9px !important;

  font-size: 8.8px !important;
  font-weight: 950 !important;
}

/* =========================================================
   EVENTOS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-events-panel {
  min-height: 420px !important;
}

.pm-page.pm-hist-page .pm-hist-timeline {
  gap: 9px !important;

  padding:
    12px !important;
}

.pm-page.pm-hist-page .pm-hist-event {
  grid-template-columns:
    38px
    minmax(0, 1fr) !important;

  gap: 10px !important;

  padding:
    11px !important;

  border-radius: 11px !important;
}

.pm-page.pm-hist-page .pm-hist-event__icon {
  display: grid !important;
  place-items: center !important;

  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;

  padding: 0 !important;

  border-radius: 10px !important;
}

.pm-page.pm-hist-page .pm-hist-event__icon .icon,
.pm-page.pm-hist-page .pm-hist-event__icon svg {
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  min-height: 17px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header span {
  font-size: 9px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header strong {
  font-size: 12px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body header small,
.pm-page.pm-hist-page .pm-hist-event__body time {
  font-size: 9.5px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body p {
  font-size: 10.5px !important;
}

/* =========================================================
   MODAL · CAPA GENERAL
   ========================================================= */

#pmHistorialModal.pm-modal {
  position: fixed !important;
  inset: 0 !important;

  z-index: 2147483646 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100vw !important;
  height: 100dvh !important;

  padding: 18px !important;

  background:
    rgba(
      0,
      0,
      0,
      0.74
    ) !important;

  backdrop-filter: blur(7px) !important;
  -webkit-backdrop-filter: blur(7px) !important;

  overflow: hidden !important;
}

/* =========================================================
   TARJETA DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-modal__card,
#pmHistorialModal .pm-hist-detail-modal {
  position: relative !important;
  z-index: 2147483647 !important;

  display: grid !important;

  grid-template-rows:
    auto
    minmax(0, 1fr) !important;

  width:
    min(
      1280px,
      calc(100vw - 36px)
    ) !important;

  height:
    min(
      860px,
      calc(100dvh - 36px)
    ) !important;

  max-height:
    calc(
      100dvh -
      36px
    ) !important;

  color: #111111 !important;

  background: #ffffff !important;

  border:
    1px solid
    rgba(
      0,
      0,
      0,
      0.18
    ) !important;

  border-radius: 16px !important;

  box-shadow:
    0 30px 90px
    rgba(
      0,
      0,
      0,
      0.36
    ) !important;

  overflow: hidden !important;
}

html[data-theme="dark"]
#pmHistorialModal
.pm-modal__card {
  color: #f5f5f5 !important;

  background: #0b0b0b !important;

  border-color:
    rgba(
      255,
      255,
      255,
      0.16
    ) !important;

  box-shadow:
    0 34px 100px
    rgba(
      0,
      0,
      0,
      0.86
    ) !important;
}

/* =========================================================
   HEADER DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-modal__head {
  min-height: 72px !important;

  padding:
    13px
    15px !important;

  background: #ffffff !important;
}

html[data-theme="dark"]
#pmHistorialModal
.pm-modal__head {
  background: #0b0b0b !important;
}

#pmHistorialModal .pm-modal__head span {
  font-size: 9px !important;
}

#pmHistorialModal .pm-modal__head strong {
  font-size: 19px !important;
  font-weight: 950 !important;
}

#pmHistorialModal .pm-modal__head small {
  font-size: 10.5px !important;
}

/* =========================================================
   CUERPO DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-modal__body {
  min-width: 0 !important;
  min-height: 0 !important;

  gap: 12px !important;

  padding:
    14px !important;

  background: #f5f6f8 !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html[data-theme="dark"]
#pmHistorialModal
.pm-modal__body {
  background: #080808 !important;
}

/* =========================================================
   RESUMEN DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-hist-detail-grid {
  grid-template-columns:
    repeat(
      5,
      minmax(0, 1fr)
    ) !important;

  gap: 9px !important;
}

#pmHistorialModal .pm-hist-detail-grid article {
  min-height: 68px !important;

  padding:
    10px
    11px !important;

  border-radius: 10px !important;
}

#pmHistorialModal .pm-hist-detail-grid span {
  font-size: 8.8px !important;
}

#pmHistorialModal .pm-hist-detail-grid strong {
  font-size: 11px !important;
}

/* =========================================================
   TABLAS DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-hist-mini-table-wrap,
#pmHistorialModal .pm-hist-detail-table-wrap {
  max-height: 300px !important;

  overflow: auto !important;
}

#pmHistorialModal .pm-hist-mini-table {
  min-width: 520px !important;
}

#pmHistorialModal .pm-hist-detail-table {
  min-width: 980px !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .pm-page.pm-hist-page .pm-metrics {
    grid-template-columns:
      repeat(
        3,
        minmax(0, 1fr)
      ) !important;
  }

  .pm-page.pm-hist-page .pm-toolbar {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;

    width: 100% !important;
  }

  .pm-page.pm-hist-page .pm-search {
    grid-column:
      1 /
      -1 !important;
  }

  .pm-page.pm-hist-page .pm-table {
    min-width: 1100px !important;
  }

  .pm-page.pm-hist-page .pm-table-wrap {
    overflow-x: auto !important;
  }
}

@media (max-width: 760px) {
  .pm-page.pm-hist-page {
    gap: 10px !important;
  }

  .pm-page.pm-hist-page .pm-head {
    min-height: 0 !important;

    padding:
      12px !important;
  }

  .pm-page.pm-hist-page .pm-brand h2 {
    font-size: 22px !important;
  }

  .pm-page.pm-hist-page .pm-brand p {
    font-size: 11px !important;
  }

  .pm-page.pm-hist-page .pm-metrics {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }

  .pm-page.pm-hist-page .pm-toolbar {
    grid-template-columns: 1fr !important;
  }

  .pm-page.pm-hist-page .pm-search {
    grid-column: auto !important;
  }

  #pmHistorialModal.pm-modal {
    padding: 8px !important;
  }

  #pmHistorialModal .pm-modal__card,
  #pmHistorialModal .pm-hist-detail-modal {
    width:
      calc(
        100vw -
        16px
      ) !important;

    height:
      calc(
        100dvh -
        16px
      ) !important;

    max-height:
      calc(
        100dvh -
        16px
      ) !important;

    border-radius: 13px !important;
  }

  #pmHistorialModal .pm-hist-detail-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }
}/* =========================================================
   HISTORIAL · CORREGIR MODAL ABIERTO PERMANENTEMENTE
   Agregar al FINAL de historial.css
   ========================================================= */

/* Cerrado por defecto */

#pmHistorialModal.pm-modal {
  display: none !important;

  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Visible únicamente cuando realmente está abierto */

#pmHistorialModal.pm-modal.is-open {
  display: flex !important;

  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Evitar que el contenedor vacío oscurezca la página */

#pmHistorialModal.pm-modal[aria-hidden="true"] {
  display: none !important;

  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;

  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Estado abierto */

#pmHistorialModal.pm-modal[aria-hidden="false"] {
  display: flex !important;

  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;

  background: rgba(0, 0, 0, 0.74) !important;

  backdrop-filter: blur(7px) !important;
  -webkit-backdrop-filter: blur(7px) !important;
}

/* Bloquear scroll solo con el modal abierto */

html:has(#pmHistorialModal.is-open),
body:has(#pmHistorialModal.is-open) {
  overflow: hidden !important;
}/* =========================================================
   HISTORIAL · MODAL POR ENCIMA DEL TOPBAR
   Agregar al FINAL de historial.css
   ========================================================= */

/* Quitar contextos que limitan el position fixed */

html:has(#pmHistorialModal.is-open),
body:has(#pmHistorialModal.is-open) {
  overflow: hidden !important;
}

body:has(#pmHistorialModal.is-open) .app-shell,
body:has(#pmHistorialModal.is-open) .app-main,
body:has(#pmHistorialModal.is-open) .app-content,
body:has(#pmHistorialModal.is-open) .pm-page,
body:has(#pmHistorialModal.is-open) .pm-hist-page {
  transform: none !important;
  translate: none !important;
  scale: none !important;
  rotate: none !important;

  filter: none !important;
  perspective: none !important;
  contain: none !important;

  overflow: visible !important;
}

/* Modal siempre por encima de toda la aplicación */

#pmHistorialModal.pm-modal.is-open {
  position: fixed !important;
  inset: 0 !important;

  z-index: 2147483646 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100vw !important;
  height: 100dvh !important;
  min-width: 100vw !important;
  min-height: 100dvh !important;

  margin: 0 !important;
  padding: 16px !important;

  background: rgba(0, 0, 0, 0.78) !important;

  backdrop-filter: blur(7px) !important;
  -webkit-backdrop-filter: blur(7px) !important;

  isolation: isolate !important;

  overflow: hidden !important;
}

/* Tarjeta por encima del fondo */

#pmHistorialModal.is-open .pm-modal__card,
#pmHistorialModal.is-open .pm-hist-detail-modal {
  position: relative !important;
  z-index: 2147483647 !important;

  width: min(1280px, calc(100vw - 32px)) !important;
  height: min(860px, calc(100dvh - 32px)) !important;
  max-height: calc(100dvh - 32px) !important;

  margin: 0 !important;
}

/* Topbar, sidebar, rightbar y footer siempre detrás */

body:has(#pmHistorialModal.is-open) .app-topbar,
body:has(#pmHistorialModal.is-open) .topbar,
body:has(#pmHistorialModal.is-open) .app-sidebar,
body:has(#pmHistorialModal.is-open) .sidebar,
body:has(#pmHistorialModal.is-open) .app-rightbar,
body:has(#pmHistorialModal.is-open) .rightbar,
body:has(#pmHistorialModal.is-open) .app-footer,
body:has(#pmHistorialModal.is-open) footer {
  z-index: 1 !important;
}

/* Respaldo para navegadores sin dvh */

@supports not (height: 100dvh) {
  #pmHistorialModal.pm-modal.is-open {
    height: 100vh !important;
    min-height: 100vh !important;
  }

  #pmHistorialModal.is-open .pm-modal__card,
  #pmHistorialModal.is-open .pm-hist-detail-modal {
    height: min(860px, calc(100vh - 32px)) !important;
    max-height: calc(100vh - 32px) !important;
  }
}/* =========================================================
   HISTORIAL · OCULTAR LAYOUT CUANDO EL MODAL ESTÁ ABIERTO
   Agregar al FINAL de historial.css
   ========================================================= */

/* Ocultar topbar para que no tape la ventana */

body:has(#pmHistorialModal.is-open) .app-topbar,
body:has(#pmHistorialModal.is-open) .topbar,
body:has(#pmHistorialModal.is-open) #topbarMount {
  display: none !important;
}

/* Ocultar también elementos laterales que puedan superponerse */

body:has(#pmHistorialModal.is-open) .app-sidebar,
body:has(#pmHistorialModal.is-open) .sidebar,
body:has(#pmHistorialModal.is-open) #sidebarMount,
body:has(#pmHistorialModal.is-open) .app-rightbar,
body:has(#pmHistorialModal.is-open) .rightbar,
body:has(#pmHistorialModal.is-open) #rightbarMount,
body:has(#pmHistorialModal.is-open) .app-footer,
body:has(#pmHistorialModal.is-open) #footerMount {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Eliminar márgenes y límites del contenido principal */

body:has(#pmHistorialModal.is-open) .app-main,
body:has(#pmHistorialModal.is-open) .app-content,
body:has(#pmHistorialModal.is-open) .pm-page.pm-hist-page {
  position: static !important;

  margin: 0 !important;
  padding: 0 !important;

  transform: none !important;
  filter: none !important;
  perspective: none !important;
  contain: none !important;

  overflow: visible !important;
}

/* Overlay desde el inicio real de la pantalla */

#pmHistorialModal.pm-modal.is-open {
  position: fixed !important;

  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;

  inset: 0 !important;

  z-index: 2147483647 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100vw !important;
  height: 100vh !important;

  margin: 0 !important;
  padding: 14px !important;

  background: rgba(0, 0, 0, 0.78) !important;

  overflow: hidden !important;
}

/* Ventana centrada sin quedar detrás de nada */

#pmHistorialModal.is-open .pm-modal__card,
#pmHistorialModal.is-open .pm-hist-detail-modal {
  position: relative !important;

  top: auto !important;
  left: auto !important;

  z-index: 1 !important;

  width: min(1280px, calc(100vw - 28px)) !important;
  height: min(860px, calc(100vh - 28px)) !important;
  max-height: calc(100vh - 28px) !important;

  margin: 0 !important;
}/* =========================================================
   PEDIDOS MAYORISTAS · HISTORIAL
   BORDES VISIBLES + TABLAS Y CARDS CUADRICULADAS
   Agregar al FINAL de historial.css
   ========================================================= */

/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */

.app-content:has(.pm-page.pm-hist-page) {
  display: block !important;

  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;

  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  padding: 10px !important;

  overflow: visible !important;
}

.pm-page.pm-hist-page {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;

  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  gap: 12px !important;

  overflow: visible !important;
}

/* =========================================================
   BORDES PRINCIPALES
   ========================================================= */

.pm-page.pm-hist-page .pm-head,
.pm-page.pm-hist-page .pm-metrics,
.pm-page.pm-hist-page .pm-panel,
#pmHistorialModal .pm-modal__card {
  border:
    1px solid
    rgba(15, 23, 42, 0.2) !important;

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82) inset,
    0 5px 16px rgba(15, 23, 42, 0.05) !important;
}

.pm-page.pm-hist-page .pm-head:hover,
.pm-page.pm-hist-page .pm-panel:hover {
  border-color:
    rgba(15, 23, 42, 0.3) !important;
}

/* =========================================================
   MÉTRICAS CUADRICULADAS
   ========================================================= */

.pm-page.pm-hist-page .pm-metrics {
  gap: 0 !important;

  background: var(--pm-surface, #ffffff) !important;

  overflow: hidden !important;
}

.pm-page.pm-hist-page .pm-card-metric {
  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.16) !important;

  border-radius: 0 !important;

  box-shadow: none !important;
}

.pm-page.pm-hist-page .pm-card-metric:last-child {
  border-right: 0 !important;
}

.pm-page.pm-hist-page .pm-card-metric:hover {
  background:
    rgba(15, 23, 42, 0.035) !important;
}

/* =========================================================
   PANEL DE FILTROS
   ========================================================= */

.pm-page.pm-hist-page .pm-panel__head {
  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.19) !important;
}

.pm-page.pm-hist-page .pm-search,
.pm-page.pm-hist-page .pm-toolbar select,
.pm-page.pm-hist-page .pm-toolbar input[type="date"],
.pm-page.pm-hist-page .pm-btn,
.pm-page.pm-hist-page .pm-icon-btn,
.pm-page.pm-hist-page .pm-hist-tab {
  border-color:
    rgba(15, 23, 42, 0.2) !important;
}

.pm-page.pm-hist-page .pm-search:hover,
.pm-page.pm-hist-page .pm-search:focus-within,
.pm-page.pm-hist-page .pm-toolbar select:hover,
.pm-page.pm-hist-page .pm-toolbar select:focus,
.pm-page.pm-hist-page .pm-toolbar input[type="date"]:hover,
.pm-page.pm-hist-page .pm-toolbar input[type="date"]:focus,
.pm-page.pm-hist-page .pm-btn:hover,
.pm-page.pm-hist-page .pm-icon-btn:hover,
.pm-page.pm-hist-page .pm-hist-tab:hover {
  border-color:
    rgba(15, 23, 42, 0.32) !important;
}

/* =========================================================
   PESTAÑAS CUADRICULADAS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-tabs-panel {
  padding: 0 !important;

  overflow: hidden !important;
}

.pm-page.pm-hist-page .pm-hist-tabs {
  gap: 0 !important;

  overflow-x: auto !important;
}

.pm-page.pm-hist-page .pm-hist-tab {
  min-height: 42px !important;

  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.15) !important;

  border-radius: 0 !important;
}

.pm-page.pm-hist-page .pm-hist-tab:last-child {
  border-right: 0 !important;
}

.pm-page.pm-hist-page .pm-hist-tab:hover {
  background:
    rgba(15, 23, 42, 0.04) !important;
}

.pm-page.pm-hist-page .pm-hist-tab.is-active {
  box-shadow:
    inset 0 -3px 0
    currentColor !important;
}

/* =========================================================
   SECCIONES
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-section {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.pm-page.pm-hist-page .pm-hist-table-panel,
.pm-page.pm-hist-page .pm-hist-diff-panel,
.pm-page.pm-hist-page .pm-hist-events-panel {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;

  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  overflow: visible !important;
}

/* =========================================================
   WRAPPERS DE TABLA
   ========================================================= */

.pm-page.pm-hist-page .pm-table-wrap,
.pm-page.pm-hist-page .pm-hist-table-wrap,
.pm-page.pm-hist-page .pm-hist-diff-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;

  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* =========================================================
   TABLAS COMPLETAMENTE CUADRICULADAS
   ========================================================= */

.pm-page.pm-hist-page .pm-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;

  border:
    1px solid
    rgba(15, 23, 42, 0.2) !important;
}

.pm-page.pm-hist-page .pm-table th,
.pm-page.pm-hist-page .pm-table td {
  border-right:
    1px solid
    rgba(15, 23, 42, 0.15) !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.15) !important;
}

.pm-page.pm-hist-page .pm-table th:last-child,
.pm-page.pm-hist-page .pm-table td:last-child {
  border-right: 0 !important;
}

.pm-page.pm-hist-page .pm-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

/* Encabezado más marcado */

.pm-page.pm-hist-page .pm-table thead th {
  background:
    color-mix(
      in srgb,
      #f9fafb 92%,
      #e5e7eb
    ) !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.24) !important;
}

/* Filas alternadas */

.pm-page.pm-hist-page .pm-table tbody tr:nth-child(even) td {
  background:
    rgba(15, 23, 42, 0.018) !important;
}

.pm-page.pm-hist-page .pm-table tbody tr:hover td {
  background:
    rgba(15, 23, 42, 0.05) !important;
}

/* =========================================================
   COLUMNAS DE ACCIONES INTEGRADAS
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-table th:nth-child(11),
.pm-page.pm-hist-page .pm-hist-table td:nth-child(11),
.pm-page.pm-hist-page .pm-hist-diff-table th:nth-child(10),
.pm-page.pm-hist-page .pm-hist-diff-table td:nth-child(10) {
  border-left:
    1px solid
    rgba(15, 23, 42, 0.2) !important;

  box-shadow:
    -1px 0 0
    rgba(15, 23, 42, 0.07) !important;
}

.pm-page.pm-hist-page .pm-table-actions {
  width: 100% !important;

  justify-content: center !important;
}

/* =========================================================
   BADGES
   ========================================================= */

.pm-page.pm-hist-page .pm-badge,
#pmHistorialModal .pm-badge {
  border-color:
    rgba(15, 23, 42, 0.2) !important;
}

/* =========================================================
   DIFERENCIAS MOBILE
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-diff-card,
.pm-page.pm-hist-page .pm-hist-diff-empty {
  border:
    1px solid
    rgba(15, 23, 42, 0.2) !important;

  box-shadow:
    0 4px 14px
    rgba(15, 23, 42, 0.045) !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card:hover {
  border-color:
    rgba(15, 23, 42, 0.3) !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__product {
  padding-bottom: 10px !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.15) !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid {
  gap: 0 !important;

  border:
    1px solid
    rgba(15, 23, 42, 0.18) !important;

  border-radius: 10px !important;

  overflow: hidden !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid div {
  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-radius: 0 !important;
}

.pm-page.pm-hist-page .pm-hist-diff-card__grid div:last-child {
  border-right: 0 !important;
}

/* =========================================================
   EVENTOS · LISTA CUADRICULADA
   ========================================================= */

.pm-page.pm-hist-page .pm-hist-timeline {
  gap: 0 !important;

  max-height: none !important;

  padding: 0 !important;

  overflow-y: visible !important;
}

.pm-page.pm-hist-page .pm-hist-event {
  grid-template-columns:
    52px
    minmax(0, 1fr) !important;

  gap: 0 !important;

  margin: 0 !important;
  padding: 0 !important;

  border: 0 !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.15) !important;

  border-radius: 0 !important;

  box-shadow: none !important;
}

.pm-page.pm-hist-page .pm-hist-event:last-child {
  border-bottom: 0 !important;
}

.pm-page.pm-hist-page .pm-hist-event:hover {
  background:
    rgba(15, 23, 42, 0.035) !important;
}

.pm-page.pm-hist-page .pm-hist-event__icon {
  align-self: stretch !important;

  width: 52px !important;
  height: auto !important;
  min-width: 52px !important;
  min-height: 62px !important;

  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.15) !important;

  border-radius: 0 !important;

  background:
    rgba(15, 23, 42, 0.025) !important;
}

.pm-page.pm-hist-page .pm-hist-event__body {
  padding:
    12px !important;
}

.pm-page.pm-hist-page .pm-hist-event__body footer span {
  border-color:
    rgba(15, 23, 42, 0.18) !important;
}

/* =========================================================
   MODAL · CAPA SEGURA
   ========================================================= */

#pmHistorialModal.pm-modal {
  position: fixed !important;
  inset: 0 !important;

  z-index: 2147483646 !important;

  display: none !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100vw !important;
  height: 100dvh !important;

  margin: 0 !important;
  padding: 16px !important;

  background:
    rgba(0, 0, 0, 0.78) !important;

  backdrop-filter: blur(7px) !important;
  -webkit-backdrop-filter: blur(7px) !important;

  isolation: isolate !important;

  overflow: hidden !important;
}

#pmHistorialModal.pm-modal.is-open,
#pmHistorialModal.pm-modal[aria-hidden="false"] {
  display: flex !important;

  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#pmHistorialModal.pm-modal[aria-hidden="true"] {
  display: none !important;

  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* =========================================================
   TARJETA DEL MODAL
   ========================================================= */

#pmHistorialModal .pm-modal__card,
#pmHistorialModal .pm-hist-detail-modal {
  position: relative !important;
  z-index: 2147483647 !important;

  display: grid !important;

  grid-template-rows:
    auto
    minmax(0, 1fr) !important;

  width:
    min(
      1280px,
      calc(100vw - 32px)
    ) !important;

  height:
    min(
      860px,
      calc(100dvh - 32px)
    ) !important;

  max-height:
    calc(
      100dvh -
      32px
    ) !important;

  overflow: hidden !important;
}

#pmHistorialModal .pm-modal__head {
  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.19) !important;
}

#pmHistorialModal .pm-modal__body {
  min-height: 0 !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* =========================================================
   RESUMEN DEL MODAL CUADRICULADO
   ========================================================= */

#pmHistorialModal .pm-hist-detail-grid {
  gap: 0 !important;

  border:
    1px solid
    rgba(15, 23, 42, 0.19) !important;

  border-radius: 11px !important;

  overflow: hidden !important;
}

#pmHistorialModal .pm-hist-detail-grid article {
  min-height: 68px !important;

  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-radius: 0 !important;
}

#pmHistorialModal .pm-hist-detail-grid article:nth-child(5n) {
  border-right: 0 !important;
}

#pmHistorialModal .pm-hist-detail-grid article:nth-last-child(-n + 5) {
  border-bottom: 0 !important;
}

#pmHistorialModal .pm-hist-detail-grid article:hover {
  background:
    rgba(15, 23, 42, 0.035) !important;
}

/* =========================================================
   COMPARACIÓN · PANELES
   ========================================================= */

#pmHistorialModal .pm-hist-compare-grid {
  gap: 12px !important;
}

#pmHistorialModal .pm-panel {
  border-color:
    rgba(15, 23, 42, 0.2) !important;
}

/* =========================================================
   TABLAS DEL MODAL CUADRICULADAS
   ========================================================= */

#pmHistorialModal .pm-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;

  border:
    1px solid
    rgba(15, 23, 42, 0.19) !important;
}

#pmHistorialModal .pm-table th,
#pmHistorialModal .pm-table td {
  border-right:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.14) !important;
}

#pmHistorialModal .pm-table th:last-child,
#pmHistorialModal .pm-table td:last-child {
  border-right: 0 !important;
}

#pmHistorialModal .pm-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

#pmHistorialModal .pm-table thead th {
  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.22) !important;
}

/* =========================================================
   EVENTOS DEL MODAL CUADRICULADOS
   ========================================================= */

#pmHistorialModal .pm-hist-detail-events {
  gap: 0 !important;

  padding: 0 !important;

  border:
    1px solid
    rgba(15, 23, 42, 0.18) !important;

  border-radius: 10px !important;

  overflow-y: auto !important;
}

#pmHistorialModal .pm-hist-detail-events article {
  grid-template-columns:
    42px
    minmax(0, 1fr) !important;

  gap: 0 !important;

  padding: 0 !important;

  border: 0 !important;

  border-bottom:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-radius: 0 !important;
}

#pmHistorialModal .pm-hist-detail-events article:last-child {
  border-bottom: 0 !important;
}

#pmHistorialModal .pm-hist-detail-events .pm-hist-event__icon {
  align-self: stretch !important;

  width: 42px !important;
  height: auto !important;
  min-width: 42px !important;
  min-height: 52px !important;

  border: 0 !important;

  border-right:
    1px solid
    rgba(15, 23, 42, 0.14) !important;

  border-radius: 0 !important;
}

#pmHistorialModal .pm-hist-detail-events article > div {
  padding:
    9px
    10px !important;
}

/* =========================================================
   SCROLL NORMAL Y FOOTER
   ========================================================= */

body:has(.pm-page.pm-hist-page) .app-shell,
body:has(.pm-page.pm-hist-page) .app-main {
  min-height: 100vh !important;
  height: auto !important;

  overflow: visible !important;
}

body:has(.pm-page.pm-hist-page) .app-footer,
body:has(.pm-page.pm-hist-page) #footerMount,
body:has(.pm-page.pm-hist-page) footer.app-footer {
  position: static !important;

  inset: auto !important;

  width: 100% !important;

  margin-top: 12px !important;

  transform: none !important;
}

/* =========================================================
   MODO OSCURO
   ========================================================= */

html[data-theme="dark"] .pm-page.pm-hist-page .pm-head,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-metrics,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-panel,
html[data-theme="dark"] #pmHistorialModal .pm-modal__card {
  border-color:
    rgba(255, 255, 255, 0.2) !important;

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 8px 20px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table,
html[data-theme="dark"] #pmHistorialModal .pm-table,
html[data-theme="dark"] #pmHistorialModal .pm-hist-detail-grid,
html[data-theme="dark"] #pmHistorialModal .pm-hist-detail-events {
  border-color:
    rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-card-metric,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-tab,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-table th,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-table td,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-event,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-event__icon,
html[data-theme="dark"] .pm-page.pm-hist-page .pm-hist-diff-card__grid div,
html[data-theme="dark"] #pmHistorialModal .pm-hist-detail-grid article,
html[data-theme="dark"] #pmHistorialModal .pm-table th,
html[data-theme="dark"] #pmHistorialModal .pm-table td,
html[data-theme="dark"] #pmHistorialModal .pm-hist-detail-events article,
html[data-theme="dark"] #pmHistorialModal .pm-hist-detail-events .pm-hist-event__icon {
  border-right-color:
    rgba(255, 255, 255, 0.13) !important;

  border-bottom-color:
    rgba(255, 255, 255, 0.13) !important;
}

html[data-theme="dark"] .pm-page.pm-hist-page .pm-table thead th,
html[data-theme="dark"] #pmHistorialModal .pm-table thead th {
  background: #161616 !important;

  border-bottom-color:
    rgba(255, 255, 255, 0.22) !important;
}

html[data-theme="dark"]
.pm-page.pm-hist-page
.pm-table
tbody
tr:nth-child(even)
td,
html[data-theme="dark"]
#pmHistorialModal
.pm-table
tbody
tr:nth-child(even)
td {
  background:
    rgba(255, 255, 255, 0.025) !important;
}

html[data-theme="dark"]
.pm-page.pm-hist-page
.pm-table
tbody
tr:hover
td,
html[data-theme="dark"]
#pmHistorialModal
.pm-table
tbody
tr:hover
td,
html[data-theme="dark"]
.pm-page.pm-hist-page
.pm-card-metric:hover,
html[data-theme="dark"]
.pm-page.pm-hist-page
.pm-hist-event:hover,
html[data-theme="dark"]
#pmHistorialModal
.pm-hist-detail-grid
article:hover {
  background:
    rgba(255, 255, 255, 0.055) !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .pm-page.pm-hist-page .pm-card-metric {
    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  .pm-page.pm-hist-page .pm-card-metric:nth-child(3n) {
    border-right: 0 !important;
  }

  .pm-page.pm-hist-page .pm-card-metric:nth-last-child(-n + 3) {
    border-bottom: 0 !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article:nth-child(5n) {
    border-right:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article:nth-child(3n) {
    border-right: 0 !important;
  }
}

@media (max-width: 760px) {
  .pm-page.pm-hist-page .pm-card-metric:nth-child(3n) {
    border-right:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  .pm-page.pm-hist-page .pm-card-metric:nth-child(2n) {
    border-right: 0 !important;
  }

  .pm-page.pm-hist-page .pm-card-metric:nth-last-child(-n + 2) {
    border-bottom: 0 !important;
  }

  .pm-page.pm-hist-page .pm-hist-tabs {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .pm-page.pm-hist-page .pm-hist-tab {
    width: 100% !important;

    border-right: 0 !important;

    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  .pm-page.pm-hist-page .pm-hist-tab:last-child {
    border-bottom: 0 !important;
  }

  .pm-page.pm-hist-page .pm-hist-diff-card__grid div {
    border-right:
      1px solid
      rgba(15, 23, 42, 0.14) !important;

    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  .pm-page.pm-hist-page .pm-hist-diff-card__grid div:nth-child(2n) {
    border-right: 0 !important;
  }

  .pm-page.pm-hist-page .pm-hist-diff-card__grid div:nth-last-child(-n + 2) {
    border-bottom: 0 !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article,
  #pmHistorialModal .pm-hist-detail-grid article:nth-child(3n),
  #pmHistorialModal .pm-hist-detail-grid article:nth-child(5n) {
    border-right:
      1px solid
      rgba(15, 23, 42, 0.14) !important;

    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article:nth-child(2n) {
    border-right: 0 !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article:nth-last-child(-n + 2) {
    border-bottom: 0 !important;
  }
}

@media (max-width: 520px) {
  .pm-page.pm-hist-page .pm-card-metric {
    border-right: 0 !important;

    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  .pm-page.pm-hist-page .pm-card-metric:last-child {
    border-bottom: 0 !important;
  }

  .pm-page.pm-hist-page .pm-hist-event {
    grid-template-columns:
      44px
      minmax(0, 1fr) !important;
  }

  .pm-page.pm-hist-page .pm-hist-event__icon {
    width: 44px !important;
    min-width: 44px !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article,
  #pmHistorialModal .pm-hist-detail-grid article:nth-child(2n),
  #pmHistorialModal .pm-hist-detail-grid article:nth-child(3n),
  #pmHistorialModal .pm-hist-detail-grid article:nth-child(5n) {
    border-right: 0 !important;

    border-bottom:
      1px solid
      rgba(15, 23, 42, 0.14) !important;
  }

  #pmHistorialModal .pm-hist-detail-grid article:last-child {
    border-bottom: 0 !important;
  }
}