/* =====================================================================
   HISTORIAL — Tabla Obsidian Codex (PC / tablet / mobile)
   2026-06-01 v3: tabla real, ancho normal de la sección.
   ===================================================================== */

#hist-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

/* ---- Cards de resumen por moneda ---- */
.hx-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.hx-sum {
  position: relative;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.025), rgba(0,0,0,0.55));
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}
.hx-sum::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--hx-glow, rgba(233,185,99,0.10)), transparent 60%);
  opacity: 0.55;
  pointer-events: none;
}
.hx-sum::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hx-strip, rgba(233,185,99,0.5)), transparent);
}
.hx-sum.is-gold   { --hx-glow: rgba(233,185,99,0.18);  --hx-strip: rgba(233,185,99,0.6);  border-color: rgba(233,185,99,0.30); }
.hx-sum.is-gems   { --hx-glow: rgba(184,132,255,0.18); --hx-strip: rgba(184,132,255,0.6); border-color: rgba(184,132,255,0.34); }
.hx-sum.is-usdt   { --hx-glow: rgba(95,214,132,0.18);  --hx-strip: rgba(95,214,132,0.6);  border-color: rgba(95,214,132,0.32); }
.hx-sum.is-eldor  { --hx-glow: rgba(255,200,80,0.20);  --hx-strip: rgba(255,200,80,0.6);  border-color: rgba(255,200,80,0.34); }
.hx-sum.is-xp     { --hx-glow: rgba(108,212,255,0.18); --hx-strip: rgba(108,212,255,0.6); border-color: rgba(108,212,255,0.32); }
.hx-sum-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-cinzel, serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.10em;
  color: var(--gold, #e9b963);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.hx-sum-head i { font-size: 16px; }
.hx-sum-head span:first-of-type { flex: 1; }
.hx-sum-count {
  font-family: var(--font-mono);
  font-size: 10px !important;
  font-weight: 700;
  color: var(--text-muted, #9b8f7a) !important;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0;
}
.hx-sum-rows {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hx-sum-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.hx-sum-row i { font-size: 12px; }
.hx-sum-lbl { flex: 1; color: var(--text-muted, #9b8f7a); font-size: 11px; }
.hx-sum-val { font-weight: 800; }
.hx-sum-row.is-in i,
.hx-sum-row.is-in .hx-sum-val { color: #5fd684; }
.hx-sum-row.is-out i,
.hx-sum-row.is-out .hx-sum-val { color: #e85a6a; }

.hx-sum-empty {
  grid-column: 1 / -1;
  padding: 22px;
  text-align: center;
  color: var(--text-muted, #9b8f7a);
  background: rgba(0,0,0,0.3);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 10px;
  font-size: 13px;
}

/* ---- Toolbar de filtros ---- */
.hx-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.hx-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-soft, #d7c7a8);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  font-family: var(--font-sans, sans-serif);
}
.hx-chip i { font-size: 13px; }
.hx-chip:hover {
  border-color: rgba(233,185,99,0.45);
  background: rgba(233,185,99,0.08);
  color: #fff;
}
.hx-chip.is-active {
  background: linear-gradient(135deg, rgba(233,185,99,0.28), rgba(184,132,255,0.16));
  border-color: rgba(233,185,99,0.7);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(233,185,99,0.25) inset, 0 0 12px rgba(233,185,99,0.18);
}
.hx-chip.is-gold.is-active   { background: linear-gradient(135deg, rgba(233,185,99,0.34), rgba(0,0,0,0.4)); border-color: rgba(233,185,99,0.8); box-shadow: 0 0 12px rgba(233,185,99,0.25); }
.hx-chip.is-gems.is-active   { background: linear-gradient(135deg, rgba(184,132,255,0.34), rgba(0,0,0,0.4)); border-color: rgba(184,132,255,0.8); box-shadow: 0 0 12px rgba(184,132,255,0.25); }
.hx-chip.is-usdt.is-active   { background: linear-gradient(135deg, rgba(95,214,132,0.34), rgba(0,0,0,0.4)); border-color: rgba(95,214,132,0.8); box-shadow: 0 0 12px rgba(95,214,132,0.25); }
.hx-chip.is-eldor.is-active  { background: linear-gradient(135deg, rgba(255,200,80,0.34), rgba(0,0,0,0.4)); border-color: rgba(255,200,80,0.8); box-shadow: 0 0 12px rgba(255,200,80,0.25); }
.hx-chip.is-xp.is-active     { background: linear-gradient(135deg, rgba(108,212,255,0.34), rgba(0,0,0,0.4)); border-color: rgba(108,212,255,0.8); box-shadow: 0 0 12px rgba(108,212,255,0.25); }

.hx-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hx-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.hx-select-wrap > i {
  position: absolute;
  left: 10px;
  color: var(--gold, #e9b963);
  font-size: 14px;
  pointer-events: none;
}
.hx-select {
  height: 36px;
  padding: 0 32px 0 32px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(233,185,99,0.25);
  border-radius: 8px;
  color: var(--text-soft, #d7c7a8);
  font-family: var(--font-sans, sans-serif);
  font-size: 12.5px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23e9b963' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 180px;
}
.hx-select:focus,
.hx-select:hover { outline: none; border-color: rgba(233,185,99,0.55); }

.hx-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(233,185,99,0.22), rgba(184,132,255,0.12));
  border: 1px solid rgba(233,185,99,0.42);
  color: var(--gold, #e9b963);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  font-family: var(--font-sans, sans-serif);
}
.hx-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(233,185,99,0.32), rgba(184,132,255,0.20));
  border-color: rgba(233,185,99,0.7);
}
.hx-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hx-btn-ghost {
  background: rgba(0,0,0,0.45);
  border-color: rgba(255,255,255,0.10);
  color: var(--text-soft, #d7c7a8);
}
.hx-btn-ghost:hover:not(:disabled) {
  border-color: rgba(233,185,99,0.45);
  color: var(--gold, #e9b963);
  background: rgba(233,185,99,0.06);
}

/* ---- Card de tabla con corners ornados ---- */
.hx-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.012), rgba(0,0,0,0.5)),
    radial-gradient(120% 100% at 0% 0%, rgba(233,185,99,0.05), transparent 50%);
  border: 1px solid rgba(233,185,99,0.18);
  border-radius: 10px;
  overflow: hidden;
}
.hx-corner {
  position: absolute;
  width: 12px; height: 12px;
  pointer-events: none;
  z-index: 1;
}
.hx-corner-tl { top: -1px;   left: -1px;   border-top: 2px solid var(--gold, #e9b963); border-left: 2px solid var(--gold, #e9b963); border-top-left-radius: 10px; }
.hx-corner-tr { top: -1px;   right: -1px;  border-top: 2px solid var(--gold, #e9b963); border-right: 2px solid var(--gold, #e9b963); border-top-right-radius: 10px; }
.hx-corner-bl { bottom: -1px; left: -1px;  border-bottom: 2px solid var(--gold, #e9b963); border-left: 2px solid var(--gold, #e9b963); border-bottom-left-radius: 10px; }
.hx-corner-br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--gold, #e9b963); border-right: 2px solid var(--gold, #e9b963); border-bottom-right-radius: 10px; }

/* ---- Tabla ---- */
.hx-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.hx-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans, sans-serif);
  font-size: 13px;
  table-layout: auto;
}
/* Anchos: solo Origen flexea, el resto tight a su contenido */
.hx-table th,
.hx-table td {
  width: 1%;
  white-space: nowrap;
}
.hx-table th.hx-th-src,
.hx-table td.hx-td-src {
  width: auto;
  white-space: nowrap;
}
.hx-table thead th {
  background: linear-gradient(180deg, rgba(233,185,99,0.10), rgba(0,0,0,0.4));
  color: var(--gold, #e9b963);
  font-family: var(--font-cinzel, serif);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.10em;
  font-weight: 800;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(233,185,99,0.30);
  position: sticky;
  top: 0;
  z-index: 1;
}
.hx-table thead th.hx-th-amt,
.hx-table thead th.hx-th-bal { text-align: right; }
.hx-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-soft, #d7c7a8);
  vertical-align: middle;
}
.hx-table tbody tr:last-child td { border-bottom: none; }
.hx-table tbody tr {
  transition: background .15s ease;
}
.hx-table tbody tr:hover td {
  background: rgba(233,185,99,0.04);
}
/* Strip lateral en la PRIMERA celda (border-left). 2026-06-01: antes usábamos
   tr::before con position:absolute, pero Chrome no soporta position:relative
   en <tr> y la pseudo-element flotaba fuera de su lugar, desfasando visualmente
   las columnas. Border-left en td es 100% compatible. */
.hx-table tbody tr.hx-row.is-in  > td:first-child { box-shadow: inset 3px 0 0 #5fd684; }
.hx-table tbody tr.hx-row.is-out > td:first-child { box-shadow: inset 3px 0 0 #e85a6a; }

/* Date column */
.hx-td-date { font-family: var(--font-mono); padding-left: 18px !important; }
.hx-date-main { font-size: 12.5px; color: #fff; font-weight: 700; }
.hx-date-sub { font-size: 10.5px; color: var(--text-muted, #9b8f7a); margin-top: 1px; }

/* Type column */
.hx-td-type { min-width: 0; }
.hx-type-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hx-type-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(233,185,99,0.20);
  border-radius: 7px;
  color: var(--gold, #e9b963);
  font-size: 14px;
  flex-shrink: 0;
}
.hx-row.is-in .hx-type-icon {
  border-color: rgba(95,214,132,0.30);
  color: #5fd684;
  background: linear-gradient(135deg, rgba(95,214,132,0.10), rgba(0,0,0,0.55));
}
.hx-row.is-out .hx-type-icon {
  border-color: rgba(232,90,106,0.30);
  color: #e85a6a;
  background: linear-gradient(135deg, rgba(232,90,106,0.10), rgba(0,0,0,0.55));
}
.hx-type-lbl {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

/* Source column */
.hx-td-src {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted, #9b8f7a);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hx-td-src i { font-size: 11px; opacity: 0.6; margin: 0 2px; }
.hx-dim { color: rgba(255,255,255,0.20); }

/* Amount column */
.hx-td-amt {
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.hx-amt-val {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.hx-amt-cur {
  margin-left: 4px;
}
.hx-amt-cur i {
  font-size: 14px;
  color: var(--gold, #e9b963);
  vertical-align: -2px;
}
.hx-row.is-in .hx-amt-val { color: #5fd684; }
.hx-row.is-out .hx-amt-val { color: #e85a6a; }
.hx-row.is-cur-gems  .hx-amt-cur i { color: #b884ff; }
.hx-row.is-cur-usdt  .hx-amt-cur i { color: #5fd684; }
.hx-row.is-cur-eldor .hx-amt-cur i { color: #ffc850; }
.hx-row.is-cur-xp    .hx-amt-cur i { color: #6cd4ff; }

/* Balance column */
.hx-td-bal {
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted, #9b8f7a);
}

/* ---- Loading row ---- */
.hx-loading {
  padding: 30px !important;
  text-align: center;
  color: var(--text-muted, #9b8f7a);
}
.hx-loading i { color: var(--gold, #e9b963); }

/* ---- Empty / Error ---- */
.hx-empty,
.hx-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.012), rgba(0,0,0,0.5));
  border: 1px dashed rgba(255,255,255,0.10);
  border-radius: 10px;
  text-align: center;
}
.hx-empty i,
.hx-error i {
  font-size: 42px;
  color: var(--text-muted, #9b8f7a);
  opacity: 0.6;
  margin-bottom: 4px;
}
.hx-error i { color: #e85a6a; opacity: 1; }
.hx-empty-title {
  font-family: var(--font-cinzel, serif);
  font-size: 18px;
  color: var(--gold, #e9b963);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hx-empty-sub {
  font-size: 13px;
  color: var(--text-muted, #9b8f7a);
}
.hx-error div { color: var(--text-soft, #d7c7a8); font-size: 13px; }
.hx-error .hx-btn { margin-top: 8px; }

/* ---- Paginación ---- */
.hx-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}
.hx-pager-info {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.hx-pager-range {
  color: var(--gold, #e9b963);
  font-weight: 800;
  font-size: 13px;
}
.hx-pager-total {
  font-size: 11px;
  color: var(--text-muted, #9b8f7a);
}

/* ---- Skeleton ---- */
@keyframes hx-shimmer {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
.hx-skel-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.hx-skel-card {
  height: 86px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 400px 100%;
  border-radius: 10px;
  animation: hx-shimmer 1.4s linear infinite;
}
.hx-skel-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  overflow: hidden;
}
.hx-skel-row {
  height: 48px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  background-size: 400px 100%;
  animation: hx-shimmer 1.4s linear infinite;
}

/* =====================================================================
   RESPONSIVE — Tablet (≤900px): keep table, shrink padding
   ===================================================================== */
@media (max-width: 900px) {
  .hx-table { font-size: 12.5px; }
  .hx-table thead th { padding: 10px 10px; font-size: 10.5px; }
  .hx-table tbody td { padding: 9px 10px; }
  .hx-type-icon { width: 26px; height: 26px; font-size: 13px; }
  .hx-td-src { max-width: 200px; }
}

/* =====================================================================
   RESPONSIVE — Mobile (≤640px): collapse to compact 2-row layout per row
   ===================================================================== */
@media (max-width: 640px) {
  .hx-toolbar { gap: 8px; }
  .hx-toolbar-right { width: 100%; }
  .hx-select-wrap { flex: 1; }
  .hx-select { width: 100%; min-width: 0; }

  .hx-table thead { display: none; }
  .hx-table, .hx-table tbody, .hx-table tr, .hx-table td { display: block; width: 100%; }
  .hx-table tbody tr.hx-row {
    padding: 10px 12px 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "type    amount"
      "src     amount"
      "date    balance";
    gap: 2px 10px;
    align-items: center;
  }
  .hx-table tbody tr.hx-row::before {
    width: 3px;
    height: auto;
  }
  .hx-table tbody tr:hover td { background: transparent; }
  .hx-table tbody td {
    padding: 0;
    border-bottom: none;
  }
  .hx-td-type {
    grid-area: type;
    overflow: hidden;
  }
  .hx-type-wrap { width: 100%; min-width: 0; }
  .hx-type-lbl {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hx-td-src {
    grid-area: src;
    max-width: 100%;
    font-size: 10.5px;
    padding-left: 36px !important;
  }
  .hx-td-src:empty { display: none; }
  .hx-td-date {
    grid-area: date;
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding-left: 36px !important;
    font-size: 10.5px;
  }
  .hx-date-main { font-size: 10.5px; font-weight: 600; color: var(--text-muted, #9b8f7a); }
  .hx-date-sub { font-size: 10.5px; margin: 0; }
  .hx-td-amt {
    grid-area: amount;
    text-align: right;
    align-self: center;
  }
  .hx-amt-val { font-size: 15px; }
  .hx-amt-cur i { font-size: 15px; }
  .hx-td-bal {
    grid-area: balance;
    font-size: 10px;
  }
}

/* =====================================================================
   RESPONSIVE — Mobile chico (≤420px)
   ===================================================================== */
@media (max-width: 420px) {
  .hx-summary { grid-template-columns: 1fr; }
  .hx-chips { gap: 4px; }
  .hx-chip { padding: 5px 9px; font-size: 11px; }
  .hx-chip i { font-size: 12px; }

  .hx-table tbody tr.hx-row { padding: 9px 10px; }
  .hx-amt-val { font-size: 14px; }

  .hx-pager { flex-direction: column; gap: 8px; }
  .hx-pager-info { order: -1; }
  .hx-pager > .hx-btn { width: 100%; justify-content: center; }
}
