.kbwxs {
    --kx-bg: #111214;
    --kx-cell: #151618;
    --kx-line: #2b2d31;
    --kx-text: #f2f2f3;
    --kx-muted: #9a9ca3;
    --kx-red: #ff3b30;
    --kx-tab: #e3262b;
    --kx-blue: #2563eb;
    background: var(--kx-bg);
    color: var(--kx-text);
    border: 1px solid var(--kx-line);
    border-radius: 14px;
    padding: 20px;
    margin: 0 0 24px;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}
.kbwxs *, .kbwxs *::before, .kbwxs *::after { box-sizing: border-box; }
.kbwxs [hidden] { display: none !important; }

/* Thanh tab + ngày */
.kbwxs-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.kbwxs-tabs, .kbwxs-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kbwxs button.kbwxs-tab,
.kbwxs button.kbwxs-stbtn,
.kbwxs .kbwxs-date {
    margin: 0;
    min-height: 0;
    line-height: 1.2;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid var(--kx-line);
    background: transparent;
    color: var(--kx-text);
    font-size: 16px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: none;
}
.kbwxs .kbwxs-date { cursor: default; padding: 12px 18px; }
.kbwxs button.kbwxs-tab:hover { border-color: #55575d; }
.kbwxs button.kbwxs-tab.on { background: var(--kx-tab); border-color: var(--kx-tab); color: #fff; }
.kbwxs button.kbwxs-stbtn { background: var(--kx-blue); border-color: var(--kx-blue); color: #fff; }
.kbwxs .kbwxs-off, .kbwxs.kbwxs-st .kbwxs-on { display: none; }
.kbwxs.kbwxs-st .kbwxs-off { display: inline; }

/* Kết quả / thống kê */
.kbwxs .kbwxs-stat, .kbwxs.kbwxs-st .kbwxs-res { display: none; }
.kbwxs.kbwxs-st .kbwxs-stat { display: block; }

.kbwxs-main { display: grid; grid-template-columns: minmax(0, 66%) minmax(0, 1fr); gap: 18px; align-items: start; }
.kbwxs-multi { grid-template-columns: minmax(0, 58%) minmax(0, 1fr); }
.kbwxs-scroll { overflow-x: auto; }

.kbwxs table.kbwxs-tb { width: 100%; margin: 0; border-collapse: collapse; background: var(--kx-cell); }
.kbwxs table.kbwxs-tb th,
.kbwxs table.kbwxs-tb td {
    border: 1px solid var(--kx-line);
    padding: 12px 10px;
    color: var(--kx-text);
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
    vertical-align: middle;
}
.kbwxs table.kbwxs-tb th { color: var(--kx-muted); font-size: 15px; font-weight: 700; text-align: center; width: 80px; }
.kbwxs table.kbwxs-tb thead th { color: var(--kx-text); font-size: 17px; width: auto; }
.kbwxs-kq td { text-align: center; font-size: 19px; font-weight: 700; }
.kbwxs-tb td span { display: inline-block; margin: 2px 10px; }
.kbwxs .kbwxs-kq tr.kbwxs-gdb td { color: var(--kx-red); font-size: 34px; font-weight: 800; padding: 16px 10px; }
.kbwxs .kbwxs-kq tr.kbwxs-g7 td { color: var(--kx-red); font-size: 24px; font-weight: 800; }
.kbwxs .kbwxs-multi .kbwxs-kq tr.kbwxs-gdb td { font-size: 22px; }
.kbwxs .kbwxs-multi .kbwxs-kq tr.kbwxs-g7 td { color: var(--kx-text); font-size: 19px; }
.kbwxs .kbwxs-multi .kbwxs-kq tr.kbwxs-g8 td { color: var(--kx-red); font-size: 24px; font-weight: 800; }
.kbwxs .kbwxs-multi .kbwxs-kq td span { display: block; margin: 2px 0; }
.kbwxs-loto td { font-size: 19px; font-weight: 700; }
.kbwxs-loto td span { margin: 2px 8px 2px 0; }
.kbwxs .kbwxs-loto th { width: 80px; }

/* Thống kê */
.kbwxs-sthead { font-size: 17px; font-weight: 700; margin: 4px 0 12px; }
.kbwxs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.kbwxs-card { background: var(--kx-cell); border: 1px solid var(--kx-line); border-radius: 10px; padding: 14px; }
.kbwxs .kbwxs-card h4 { color: var(--kx-text); font-size: 16px; margin: 0 0 10px; }
.kbwxs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kbwxs-chips span { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--kx-line); border-radius: 8px; font-size: 13px; color: var(--kx-muted); }
.kbwxs-chips b { color: var(--kx-red); font-size: 18px; }
.kbwxs .kbwxs-freq { margin-bottom: 18px; }
.kbwxs .kbwxs-freq td { text-align: center; font-weight: 700; }
.kbwxs .kbwxs-dbh td span { margin: 2px 16px 2px 0; font-weight: 700; font-size: 17px; }
.kbwxs .kbwxs-dbh small { color: var(--kx-muted); font-weight: 400; font-size: 12px; }
.kbwxs .kbwxs-dbh b { color: var(--kx-red); }
.kbwxs-dbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kbwxs-dbgrid span { display: flex; gap: 10px; align-items: baseline; background: var(--kx-cell); border: 1px solid var(--kx-line); border-radius: 8px; padding: 8px 12px; font-size: 18px; font-weight: 700; }
.kbwxs-dbgrid small { color: var(--kx-muted); font-size: 12px; font-weight: 400; margin-right: auto; }
.kbwxs-dbgrid b { color: var(--kx-red); margin-left: -10px; }

.kbwxs-empty { padding: 30px; text-align: center; color: var(--kx-muted); }
.kbwxs-note { margin-top: 16px; font-size: 14px; color: var(--kx-muted); }

@media (max-width: 849px) {
    .kbwxs { padding: 14px 12px; }
    .kbwxs-main, .kbwxs-multi, .kbwxs-grid { grid-template-columns: 1fr; }
    .kbwxs-top { flex-direction: column; align-items: stretch; }
    .kbwxs-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
    .kbwxs-act { display: grid; grid-template-columns: 1fr 1fr; }
    .kbwxs button.kbwxs-tab, .kbwxs button.kbwxs-stbtn, .kbwxs .kbwxs-date { padding: 10px 6px; font-size: 13px; text-align: center; white-space: nowrap; }
    .kbwxs table.kbwxs-tb th { width: 54px; font-size: 13px; }
    .kbwxs table.kbwxs-tb th, .kbwxs table.kbwxs-tb td { padding: 9px 6px; }
    .kbwxs-kq td, .kbwxs-loto td { font-size: 16px; }
    .kbwxs-tb td span { margin: 2px 6px; }
    .kbwxs .kbwxs-kq tr.kbwxs-gdb td { font-size: 28px; }
    .kbwxs .kbwxs-kq tr.kbwxs-g7 td { font-size: 20px; }
}
