/* ============================================
   UI XỔ SỐ 9X MEDIA (ISOLATED, ALL REGIONS)
   Miền Nam / Trung: .xsm-container
   Miền Bắc: .xsm-card.xsm-mb
   ============================================ */

/* ========== Reset an toàn (chỉ MN/MT) ========== */
.xsm-container * {
  all: unset;
  display: revert;
  box-sizing: border-box;
}

/* ========== Layout chung ========== */
.xsm-container {
  font-family: Arial, sans-serif;
  background: #fff;
  padding: 16px;
  border: 4px solid #7e7e7e;
  margin: 20px auto;
  max-width: 720px;
  box-sizing: border-box;
}

/* ===============================
   HEADER CHUNG (CẢ 3 MIỀN)
   =============================== */
.xsm-header {
  text-align: center;
  border-bottom: 2px solid #a40000;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.xsm-header h2 {
  color: #a40000;
  font-size: 22px;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 4px;
}
.xsm-header span,
.xsm-sub {
  color: #333;
  font-size: 14px;
  margin-top: 2px;
}

/* ===============================
   MIỀN NAM / TRUNG
   =============================== */
.xsm-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #aaa;
  font-size: 15px;
}
.xsm-table th,
.xsm-table td {
  border: 1px solid #ccc;
  padding: 6px 4px;
  text-align: center;
}
.xsm-table thead {
  background: #f7f9fb;
}
.xsm-table tr:nth-child(even) {
  background: #fafafa;
}
.xsm-table td:first-child {
  color: #444;
  text-align: left;
  width: 110px;
  font-weight: 600;
  padding-left: 8px;
}
.xsm-num {
  display: inline-block;
  margin: 0 4px;
  font-weight: 600;
  color: #222;
  font-size: 16px;
}
.xsm-num.db {
  color: #e60000;
  font-size: 20px;
  font-weight: 700;
}
.xsm-province-header td {
  background: #d9edf7;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
}
.xsm-no-data {
  text-align: center;
  color: #666;
  padding: 20px 10px;
  font-style: italic;
  background: #fafafa;
  border-radius: 6px;
}

/* ===============================
   MIỀN BẮC (.xsm-table-mb)
   =============================== */
.xsm-table-mb {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #aaa;
  font-size: 16px;
  table-layout: fixed;
}
.xsm-table-mb td {
  border: 1px solid #aaa;
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}

/* --- Cột tên giải --- */
.xsm-label {
  background: #fff;
  color: #000;
  font-weight: 600;
  text-align: center;
  vertical-align: middle !important;
}
.xsm-label-db {
  color: #d10000;
  font-weight: 700;
}

/* --- Dãy số (Flex layout) --- */
.xsm-values {
  text-align: center;
  vertical-align: middle;
}
.xsm-flex {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
}
.xsm-number {
  flex: 1 1 0;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #000;
  padding: 4px 0;
  border-right: 1px solid #ccc;
}
.xsm-number:last-child {
  border-right: none;
}

/* --- Giải đặc biệt --- */
.xsm-number-db {
  color: #d10000;
  font-size: 26px;
  font-weight: 800;
  border-right: none !important;
}

/* --- Nền xen kẽ --- */
.xsm-table-mb tr:nth-child(even) td {
  background: #fafafa;
}

/* --- Căn giữa dòng khi rowspan --- */
.xsm-table-mb tr + tr td {
  border-top: 1px solid #ccc;
}

/* --- Fix label width desktop --- */
@media (min-width: 768px) {
  .xsm-label {
    width: 130px;
  }
}

/* ===============================
   Responsive tinh chỉnh
   =============================== */
@media (max-width: 768px) {
  .xsm-container {
    padding: 10px;
  }

  .xsm-table td,
  .xsm-table th,
  .xsm-table-mb td {
    padding: 5px 4px;
    font-size: 14px;
  }

  .xsm-label {
    width: auto; /* ✅ Auto width */
    font-size: 14px;
    white-space: normal;
  }

  .xsm-number {
    font-size: 16px;
    padding: 4px 0;
  }

  .xsm-number-db {
    font-size: 22px;
  }

  .xsm-header h2 {
    font-size: 18px;
  }

  .xsm-header span,
  .xsm-sub {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .xsm-container {
    padding: 6px;
  }

  .xsm-table td,
  .xsm-table-mb td {
    padding: 4px 3px;
    font-size: 13px;
  }

  .xsm-label {
    font-size: 13px;
    width: 30%;
  }

  .xsm-number {
    font-size: 15px;
  }

  .xsm-number-db {
    font-size: 20px;
  }
}

/* ==============================
   UI DỰ ĐOÁN LOTO 9X MEDIA (ISOLATED)
   ============================== */
.xsm-pred-wrap {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px;
  margin: 20px 0;
  font-family: "Inter", "Roboto", sans-serif;
}

.xsm-pred-header {
  text-align: center;
  margin-bottom: 16px;
}
.xsm-pred-header h3 {
  font-size: 20px;
  margin: 0;
  color: #d93025;
}
.xsm-pred-sub {
  color: #777;
  font-size: 13px;
  margin-top: 4px;
}

/* --- BẢNG MIỀN BẮC --- */
.xsm-pred-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  background: #fff;
  border: 1px dashed #d93025;
  border-radius: 8px;
  padding: 12px;
}
.xsm-pred-table div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid #f2f2f2;
}
.xsm-pred-table div:last-child {
  border-bottom: none;
}
.xsm-pred-label {
  color: #444;
  font-weight: 500;
}
.xsm-pred-num {
  color: #d93025;
  font-weight: 700;
  font-size: 15px;
}
.xsm-pred-special {
  background: #fff0e0;
  padding: 2px 8px;
  border-radius: 6px;
}
.xsm-pred-triple {
  background: #e8f0fe;
  padding: 2px 8px;
  border-radius: 6px;
}

/* --- CÁC ĐÀI MIỀN NAM / TRUNG --- */
.xsm-pred-region-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}
.xsm-pred-card {
  flex: 1 1 45%;
  background: #fff;
  border: 1px solid #f3c29b;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 3px rgba(0,0,0,0.05);
}
.xsm-pred-card h4 {
  color: #d93025;
  font-size: 16px;
  margin: 0 0 8px;
}
.xsm-pred-card p {
  margin: 4px 0;
  font-size: 14px;
}
.xsm-pred-card span {
  color: #444;
  font-weight: 500;
}
.xsm-pred-card strong {
  color: #d93025;
}

/* --- FOOTER --- */
.xsm-pred-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: #666;
}
.xsm-pred-note {
  font-style: italic;
  color: #999;
  margin-top: 4px;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
  .xsm-pred-table {
    grid-template-columns: 1fr;
  }
  .xsm-pred-card {
    flex: 1 1 100%;
  }
}

/* ============ UI SPIN MODULE - MIỀN BẮC (FINAL CLEAN, ISOLATED) ============ */
.xsm-spin-wrap {
  font-family: Arial, sans-serif!important;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Header riêng --- */
.xsm-spin-wrap .xsm-spin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: red;
  border: 1px solid #ccc;
  background: #ffeca0;
  padding: 10px 5px;
}
.xsm-spin-wrap .xsm-spin-title {
  font-weight: 700;
  font-size: 20px;
}
.xsm-spin-wrap .xsm-spin-sub {
  font-size: 13px;
  color: #666;
}
.xsm-spin-wrap .xsm-spin-header .xsm-spin-btn {
  background: #d93025;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.xsm-spin-wrap .xsm-spin-header .xsm-spin-btn:hover:not(:disabled) {
  background: #ff4a38;
}
.xsm-spin-wrap .xsm-spin-header .xsm-spin-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* --- Bảng quay thử --- */
.xsm-spin-wrap .xsm-spin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.xsm-spin-wrap .xsm-spin-table th,
.xsm-spin-wrap .xsm-spin-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}
.xsm-spin-wrap .xsm-spin-table th {
  background: #fffbe6;
  font-weight: bold;
}

/* Giải và giá trị */
.xsm-spin-wrap .xsm-giai {
  font-weight: bold;
  width: 45px;
}
.xsm-spin-wrap .xsm-values {
  min-height: 28px;
}

/* Các số */
.xsm-spin-wrap .xsm-values .xsm-num {
  display: inline-block;
  width: 28px;
  text-align: center;
  margin: 0 2px;
  font-weight: 700;
  font-size: 17px;
  color: #000;
  line-height: 1.6;
  transition: background 0.15s, color 0.15s;
  border-radius: 4px;
  vertical-align: middle;
}

/* Giải đặc biệt */
.xsm-spin-wrap [data-giai="giaidb"] .xsm-num {
  color: #d93025;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

/* --- Loading vòng tròn vàng --- */
.xsm-spin-wrap .xsm-num.loading {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
}
.xsm-spin-wrap .xsm-num.loading::before,
.xsm-spin-wrap .xsm-num.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid #ffc107;
  border-color: #ffc107 transparent #ffc107 transparent;
  animation: xsm-spinner 1.2s linear infinite;
}
.xsm-spin-wrap .xsm-num.loading::after {
  animation-delay: -0.6s;
}
@keyframes xsm-spinner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Options: Đầy đủ + 0-9 --- */
.xsm-spin-wrap .xsm-spin-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.xsm-spin-wrap .xsm-spin-options input[type="radio"] {
  appearance: auto !important;
  margin-right: 4px;
  vertical-align: middle;
}
.xsm-spin-wrap .xsm-spin-options label {
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.xsm-spin-wrap .xsm-num-filters {
  display: flex;
  align-items: center;
  gap: 4px;
}
.xsm-spin-wrap .xsm-num-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}
.xsm-spin-wrap .xsm-num-filter:hover {
  background: #d93025;
  color: #fff;
  border-color: #d93025;
}

/* --- Viewmodes --- */
.xsm-spin-wrap .xsm-viewmodes {
  display: flex;
  align-items: center;
  gap: 14px;
}
.xsm-spin-wrap .xsm-viewmodes label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.xsm-spin-wrap .xsm-viewmodes input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
}

/* --- Hover logic 0–9 --- */
.xsm-spin-wrap .xsm-highlight {
  font-weight: 700;
  background: #fb9b34;
  color: #fff;
  border-radius: 4px;
  padding: 0 1px;
  transition: background-color 0.15s, transform 0.1s;
  transform: translateY(-1px);
}

/* --- Bảng Lô tô --- */
.xsm-spin-wrap .xsm-loto-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.xsm-spin-wrap .xsm-loto-table th,
.xsm-spin-wrap .xsm-loto-table td {
  border: 1px solid #ccc;
  padding: 5px 6px;
  text-align: center;
  height: 24px;
}
.xsm-spin-wrap .xsm-loto-table th {
  background: #f5f5f5;
  font-weight: 600;
}

/* --- Căn đều các số --- */
.xsm-spin-wrap[data-region="mb"] .xsm-values {
  display: flex;
  width: 100%;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
}

.xsm-spin-wrap .xsm-values.xsm-3col {
  justify-content: space-evenly;
}
.xsm-spin-wrap .xsm-num.loading {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.xsm-spin-wrap .xsm-num {
  text-align: center;
  min-width: 32px;
}
.xsm-spin-wrap .xsm-last2.hover-match {
  background: #ffeb99;
  border-radius: 4px;
  padding: 2px 3px;
  font-weight: 700;
  box-shadow: 0 0 3px rgba(255,193,7,0.5);
}
/* ==========================
   MIỀN NAM / TRUNG - LAYOUT
   ========================== */
.xsm-spin-wrap[data-region="mn"] .xsm-spin-table td.xsm-values,
.xsm-spin-wrap[data-region="mt"] .xsm-spin-table td.xsm-values {
  vertical-align: top;
  text-align: center;
  padding: 4px 2px;
}

.xsm-spin-wrap[data-region="mn"] .xsm-cell,
.xsm-spin-wrap[data-region="mt"] .xsm-cell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  justify-items: center;
}

.xsm-spin-wrap[data-region="mn"] .xsm-num,
.xsm-spin-wrap[data-region="mt"] .xsm-num {
  display: inline-block;
  font-family: "Roboto Mono", monospace;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  letter-spacing: 1px;
  line-height: 1.4;
}
/* ============================================================
   UI THỐNG KÊ XSMB (SCOPED - FINAL)
   ============================================================ */
.xsm-stats-wrap {
    font-family: Arial, sans-serif;
    margin: 20px auto;
    max-width: 720px;
    background: #fff;
}

/* Tiêu đề tổng */
.xsm-stats-wrap .xsm-title {
    background: #c84b00;
    color: #fff;
    font-weight: bold;
    text-align: center;
    padding: 8px 0;
    font-size: 16px;
    border-radius: 4px 4px 0 0;
}

/* Mỗi ngày là một khối độc lập */
.xsm-stats-wrap .xsm-stats-day {
    border: 1px solid #c84b00;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Header từng bảng */
.xsm-stats-wrap .xsm-subtitle {
    background: #f9f3dc;
    color: #c84b00;
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid #e5d7a7;
    text-align: center;
    text-transform: capitalize;
}

/* Layout hai bảng */
.xsm-stats-wrap .xsm-table-wrap {
    display: flex;
    flex-wrap: wrap;
}

.xsm-stats-wrap .xsm-table-main,
.xsm-stats-wrap .xsm-table-headtail {
    border-collapse: collapse;
    width: 100%;
}

@media (min-width: 768px) {
    .xsm-stats-wrap .xsm-table-main { width: 70%; }
    .xsm-stats-wrap .xsm-table-headtail { width: 30%; }
}

/* Ô bảng */
.xsm-stats-wrap td,
.xsm-stats-wrap th {
    border: 1px solid #ccc;
    padding: 4px 6px;
    text-align: center;
}

/* Cột giải */
.xsm-stats-wrap .giai {
    width: 60px;
    background: #f6f6f6;
    font-weight: bold;
    color: #b33;
}

/* Số */
.xsm-stats-wrap .num {
    display: inline-block;
    margin: 3px;
    padding: 2px 6px;
    background: #fff;
    border-radius: 3px;
    font-size: 14px;
}

.xsm-stats-wrap .num.db {
    color: #c84b00;
    font-weight: bold;
    font-size: 18px;
}

/* Bảng đầu - đuôi */
.xsm-stats-wrap .xsm-table-headtail th {
    background: #f9f3dc;
    color: #333;
    font-weight: 600;
}

.xsm-stats-wrap .xsm-table-headtail td:first-child {
    font-weight: bold;
    color: #b33;
}

.xsm-stats-wrap .xsm-table-main tr:hover td,
.xsm-stats-wrap .xsm-table-headtail tr:hover td {
    background: #fff7e6;
}

/* ===========================
   XSM Stats Weekday (MN/MT) — Final UI
   =========================== */
.xsm-stats-weekday {
  font-family: Arial, sans-serif;
  background: #fff;
  margin: 20px auto;
  max-width: 860px;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
}

/* ----- Title ----- */
.xsm-stats-weekday .xsm-sw-title {
  text-align: center;
  background: #c84b00;
  color: #fff;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

/* ----- Tabs ----- */
.xsm-stats-weekday .xsm-sw-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
}

.xsm-stats-weekday .xsm-sw-tab-region {
  background: #fff;
  color: #444;
  border: 1px solid #ddd;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: default;
}

.xsm-stats-weekday .xsm-sw-tab {
  border: 1px solid #ddd;
  background: #fff;
  color: #0044cc;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.xsm-stats-weekday .xsm-sw-tab:hover {
  background: #f3f3f3;
}

.xsm-stats-weekday .xsm-sw-tab.active {
  background: #d9230f;
  color: #fff;
  border-color: #d9230f;
  font-weight: 600;
}

/* ----- Each Day ----- */
.xsm-stats-weekday .xsm-sw-day {
  border: 1px solid #c84b00;
  border-radius: 6px;
  padding: 8px;
  margin: 14px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.xsm-stats-weekday .xsm-sw-subtitle {
  text-align: center;
  background: #fff7e6;
  color: #b33;
  font-weight: 600;
  padding: 6px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* ----- Tables ----- */
.xsm-stats-weekday .xsm-sw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 8px 0;
}

.xsm-stats-weekday .xsm-sw-table th,
.xsm-stats-weekday .xsm-sw-table td {
  border: 1px solid #ccc;
  padding: 4px 6px;
  text-align: center;
}

.xsm-stats-weekday .xsm-sw-main th {
  background: #fff7e6;
  color: #b33;
}

.xsm-stats-weekday .xsm-sw-col-giai {
  width: 60px;
  background: #f6f6f6;
  font-weight: 700;
  color: #b33;
}

.xsm-stats-weekday .xsm-sw-col-nums {
  vertical-align: top;
  text-wrap: pretty;
}

.xsm-stats-weekday .xsm-sw-num {
  display: block;
  margin: 3px 0;
  padding: 2px 6px;
  background: #fff;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  transition: background 0.15s, color 0.15s;
}

.xsm-stats-weekday .xsm-sw-num.db {
  color: #d9230f;
  font-weight: 800;
  font-size: 16px;
}

/* ----- Bảng đầu - đuôi ----- */
.xsm-stats-weekday .xsm-sw-headtail th {
  background: #fff7e6;
  font-weight: 700;
}

.xsm-stats-weekday .xsm-sw-col-head {
  font-weight: 700;
  color: #b33;
}

/* ----- Viewmode + Hoverbar (Chuẩn layout quay thử) ----- */
.xsm-stats-weekday .xsm-sw-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 8px;
  align-items: center;
  margin: 10px 0;
}

/* Radio nhóm chế độ hiển thị */
.xsm-stats-weekday .xsm-sw-viewmodes {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.xsm-stats-weekday .xsm-sw-viewmodes label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  color: #222;
}

.xsm-stats-weekday .xsm-sw-viewmodes input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #d93025;
  vertical-align: middle;
}

/* Hàng số 0–9 */
.xsm-stats-weekday .xsm-sw-hoverbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.xsm-stats-weekday .xsm-sw-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  line-height: 26px;
  border: 1px solid #ccc;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.2s;
}

.xsm-stats-weekday .xsm-sw-digit:hover {
  background: #d93025;
  color: #fff;
  border-color: #d93025;
}

/* Highlight 2 số cuối khi hover */
.xsm-stats-weekday .xsm-highlight {
  font-weight: 700;
  background: #fb9b34;
  color: #fff;
  border-radius: 4px;
  padding: 0 1px;
  transition: background-color 0.15s, transform 0.1s;
  transform: translateY(-1px);
}

/* ----- Trạng thái loading / rỗng ----- */
.xsm-stats-weekday .xsm-sw-loading,
.xsm-stats-weekday .xsm-sw-empty {
  text-align: center;
  padding: 10px;
  color: #666;
  font-style: italic;
}

/* ----- Responsive Fix ----- */
@media (max-width: 680px) {
  .xsm-stats-weekday .xsm-sw-controls {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .xsm-stats-weekday .xsm-sw-viewmodes {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .xsm-stats-weekday .xsm-sw-hoverbar {
    justify-content: center;
    gap: 6px;
  }
  .xsm-stats-weekday .xsm-sw-digit {
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .xsm-stats-weekday .xsm-sw-digit {
    width: 22px;
    height: 22px;
    line-height: 22px;
    font-size: 11px;
  }
}

/* ----- Reset an toàn chống xung đột ----- */
.xsm-stats-weekday table,
.xsm-stats-weekday th,
.xsm-stats-weekday td {
  all: revert;
  box-sizing: border-box;
}
/* ==== UI MODULE: GENERATOR ==== */
/* ===== SCOPE: chỉ áp dụng bên trong .xsm-gen-wrap ===== */
.xsm-gen-wrap,
.xsm-gen-wrap * {
  box-sizing: border-box;
  font-family: "Inter", "Roboto", Arial, sans-serif;
}
.xsm-gen-wrap {
  max-width: 920px;
  margin: 24px auto;
  padding: 0 12px;
  color: #1f2937;
}
.xsm-gen-header {
  display: inline-block;
  background: linear-gradient(90deg, #0b74e5, #0b98e5);
  color: #fff;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 17px;
}
.xsm-gen-card {
  background: #f9fcff;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.xsm-gen-row {
  width: 100%;
}

/* ===== HÀNG NGẪU NHIÊN: 1 hàng ngang ===== */
.xsm-gen-rand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.xsm-gen-input,
.xsm-gen-select {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 15px;
  background: #fff;
  color: #111827;
}
.xsm-gen-input {
  width: 90px !important;
}
.xsm-gen-select {
  max-width: 170px !important;
}
.xsm-gen-input:focus,
.xsm-gen-select:focus {
  border-color: #0b74e5;
  outline: 0;
  box-shadow: 0 0 0 2px rgba(11, 116, 229, 0.2);
}
.xsm-gen-label {
  font-size: 14.5px;
  font-weight: 500;
  color: #374151;
  line-height: 38px;
  white-space: nowrap;
  position: relative;
  bottom: 6px;
}

button#xsm_btn_rand {
    position: relative;
    /* right: 0px; */
    left: 50px;
}

/* ===== HÀNG NHẬP & KẾT QUẢ ===== */
.xsm-gen-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}
.xsm-gen-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.xsm-gen-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
}
.xsm-gen-ta-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.xsm-gen-ta-wrap textarea {
  flex: 1;
  min-height: 200px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  background: #fff;
  color: #111827;
}
.xsm-gen-ta-wrap textarea:focus {
  border-color: #0b74e5;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(11, 116, 229, 0.15);
}

/* ===== BUTTONS ===== */
.xsm-gen-btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.xsm-gen-primary {
  background: linear-gradient(90deg, #0b74e5, #0b98e5);
  color: #fff;
}
.xsm-gen-gray {
  background: #6b7280;
  color: #fff;
}
.xsm-gen-copy {
  background: #9aa0a6;
  color: #fff;
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 5px;
  line-height: 1;
}
.xsm-gen-btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

/* ===== ACTIONS ===== */
.xsm-gen-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* ===== NOTE ===== */
.xsm-gen-note {
  margin: 0;
  padding: 8px 10px;
  background: #f5f9ff;
  color: #556070;
  border-radius: 6px;
}
.xsm-gen-note.is-hidden {
  display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .xsm-gen-two-cols {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .xsm-gen-rand-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .xsm-gen-btn.xsm-gen-primary {
    width: 100%;
  }
}
/* ==== RESPONSIVE */

/* Từ 700px trở xuống: chuyển layout mobile */
@media (max-width: 700px) {

  /* Ẩn input, select, label span */
  .xsm-gen-rand-inline .xsm-gen-label {
    display: none !important;
  }
  .xsm-gen-rand-inline .xsm-gen-input,
  .xsm-gen-rand-inline .xsm-gen-select {
    max-width: 100%!important;
    width:100%!important;
  }
	button#xsm_btn_rand {
		left: auto !important;
	}
  /* Canh giữa hàng và gộp các nút */
  .xsm-gen-rand-inline {
    justify-content: center;
    flex-wrap: nowrap;
  }

  /* Nút hiển thị dạng nhỏ gọn */
  .xsm-gen-btn.xsm-gen-primary {
    width: auto !important;
    min-width: unset;
    padding: 0 12px !important;
    font-size: 14px;
    height: 38px;
    border-radius: 5px;
  }

  /* Giữ chiều cao ổn định */
  .xsm-gen-btn::before {
    font-size: 14px;
    font-weight: 600;
  }
    /* Thay đổi text của nút chính khi thu nhỏ */
  #xsm_btn_lv2::before {
    content: "Mức 2D";
    font-size: 12px;
  }

  /* Nếu có thêm nút thứ hai — ví dụ Mức 3D/4D */
  #xsm_btn_lv2 + .xsm-gen-btn.xsm-gen-primary::before {
    content: "Mức 3D/4D";
  }

  /* Ẩn text cũ trong nút */
  #xsm_btn_lv2,
  #xsm_btn_lv2 + .xsm-gen-btn.xsm-gen-primary {
    font-size: 0 !important;
  }
  
}
/* ==== KHỐI DÀN ĐỀ DẠNG BẢNG ==== */
.gen-dande-wrap {
  max-width: 920px;
  margin: 24px auto;
  font-family: "Roboto", Arial, sans-serif;
  color: #111;
}

.gen-dande-header {
  background: linear-gradient(90deg, #0b74e5, #0b98e5);
  color: #fff;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 17px;
  display: inline-block;
  border-radius: 8px;
  margin-bottom: 14px;
}

.gen-dande-card {
  background: #ccffcc;
  border: 1px solid #b3b2b2;
  border-radius: 8px;
  padding: 14px;
}

.gen-dande-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.gen-dande-table td {
  padding: 6px 8px;
  vertical-align: middle;
}

.gen-label {
  font-size: 14px;
  font-weight: 500;
  color: #222;
  white-space: nowrap;
}

.gen-center {
  text-align: center;
  font-weight: bold;
  color: #444;
}

/* Input fields */
.gen-input,
.gen-input-full {
  height: 32px;
  border: 1px solid #579a57;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.gen-input-full {
  width: 95%;
}

/* Textarea */
.gen-textarea {
  width: 100%;
  height: 130px;
  border: 1px solid #579a57;
  border-radius: 5px;
  padding: 10px;
  font-size: 15px;
  resize: none;
  background: #fff;
  color: #111;
  box-sizing: border-box;
}

/* Buttons */
.gen-btn {
  display: inline-block;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  padding: 7px 16px;
  font-size: 14px;
  margin-right: 6px;
  transition: 0.15s ease;
}

.gen-blue {
  background: #0b74e5;
}

.gen-gray {
  background: #6b7280;
}

.gen-copy-btn {
  background: #9d9e9e;
  font-size: 13px;
  padding: 7px 12px;
}

.gen-btn:hover {
  filter: brightness(1.08);
}

/* ===== Layout Fix ===== */
.gen-row-top td {
  border-bottom: 1px solid #b3b2b2;
}

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

.gen-right-top {
  text-align: right;
  width: 60%;
}

.gen-left-top {
  width: 40%;
}

/* ===== Responsive (mobile) ===== */
@media (max-width: 768px) {
  .gen-dande-table,
  .gen-dande-table tr,
  .gen-dande-table td {
    display: block;
    width: 100%;
  }

  .gen-actions {
    justify-content: center;
  }

  .gen-btn {
    width: 100%;
    margin: 4px 0;
  }

  .gen-textarea {
    height: 110px;
    margin-top: 6px;
  }
}











