/* tx-backtest — bổ sung nhẹ trên Tailwind (DESIGN.md: shadow rất nhẹ, content-first) */
[x-cloak] { display: none !important; }
.card {
  background: #fff;
  border: 1px solid #E4E7EC;
  border-radius: 16px;
  box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
}
.dark .card {
  background: #101828;
  border-color: rgba(255, 255, 255, 0.08);
}
.btn-primary {
  background: #465FFF; color: #fff; border-radius: 8px;
  padding: 10px 18px; font-weight: 500; font-size: 14px; transition: background .15s;
}
.btn-primary:hover { background: #3641F5; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary {
  background: #fff; border: 1px solid #D0D5DD; color: #344054;
  border-radius: 8px; padding: 8px 14px; font-weight: 500; font-size: 14px;
}
.dark .btn-secondary { background: #1D2939; border-color: rgba(255,255,255,.1); color: #E4E7EC; }
.field {
  width: 100%; background: #fff; border: 1px solid #D0D5DD; border-radius: 8px;
  padding: 10px 14px; font-size: 14px; color: #1D2939; outline: none;
}
.field:focus { border-color: #9CB9FF; box-shadow: 0 0 0 3px rgba(70,95,255,.12); }
.dark .field { background: #1D2939; border-color: rgba(255,255,255,.1); color: #F2F4F7; }
.lbl { font-size: 14px; font-weight: 500; color: #344054; margin-bottom: 6px; display: block; }
.dark .lbl { color: #D0D5DD; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { background: #F9FAFB; color: #667085; font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; padding: 12px 16px; text-align: left; font-weight: 500;
  position: sticky; top: 0; z-index: 10; box-shadow: inset 0 -1px 0 #EAECF0; }
.dark .tbl th { background: rgba(255,255,255,.03); color: #98A2B3; box-shadow: inset 0 -1px 0 rgba(255,255,255,.08); }
/* căn lề header khớp với cột số (ghi đè text-align:left mặc định của .tbl th) */
.tbl th.text-right { text-align: right; }
.tbl th.text-center { text-align: center; }
.tbl td { padding: 12px 16px; font-size: 14px; color: #344054; border-top: 1px solid #F2F4F7; }
.dark .tbl td { color: #D0D5DD; border-color: rgba(255,255,255,.06); }
.tbl tr:hover td { background: #F9FAFB; }
.dark .tbl tr:hover td { background: rgba(255,255,255,.03); }
.mono { font-family: ui-monospace, SFMono-Regular, monospace; }
.spinner { width: 18px; height: 18px; border: 2px solid #E4E7EC; border-top-color: #465FFF;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE: biến mỗi DÒNG bảng thành 1 CARD (không cần cuộn ngang bảng).
   Nhãn cột lấy tự động từ <thead> qua data-label (JS: labelizeTables()).
   Kích hoạt < 640px (tablet/desktop vẫn dùng bảng thường).
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
  /* nới bỏ khung cuộn dọc/ngang quanh bảng để trang cuộn tự nhiên thay vì cuộn trong ô */
  .overflow-auto:has(> table.tbl),
  .overflow-x-auto:has(> table.tbl),
  .overflow-y-auto:has(> table.tbl) {
    max-height: none !important;
    overflow: visible !important;
  }

  table.tbl, table.tbl > tbody { display: block; width: 100%; }
  table.tbl > thead { display: none; }

  table.tbl > tbody > tr {
    display: block;
    background: #fff;
    border: 1px solid #E4E7EC;
    border-radius: 14px;
    padding: 4px 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  }
  .dark table.tbl > tbody > tr { background: #101828; border-color: rgba(255,255,255,.08); }
  table.tbl > tbody > tr:hover td { background: transparent; }

  table.tbl > tbody > tr > td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
    border: 0;
    border-top: 1px solid #F2F4F7;
    text-align: right;
    min-height: 40px;
  }
  .dark table.tbl > tbody > tr > td { border-color: rgba(255,255,255,.06); }
  table.tbl > tbody > tr > td:first-child { border-top: 0; }

  /* nhãn cột bên trái mỗi ô */
  table.tbl > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dark table.tbl > tbody > tr > td[data-label]::before { color: #98A2B3; }

  /* ô không nhãn (vd ★, #, nút Chi tiết) hoặc ô gộp cột (loading/empty) → chiếm trọn dòng, canh giữa */
  table.tbl > tbody > tr > td:not([data-label]) { justify-content: center; text-align: center; }
}
