/* Rong Bach Kim - Pure Go CSS replicating Tailwind layout & palette */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #111827;
  line-height: 1.5;
}

body.rbk-shell {
  background-color: #36415f;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Container */
.rbk-container {
  max-width: 78rem; /* expanded from 64rem (1024px) to 78rem (1248px) */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.rbk-main {
  max-width: 78rem; /* expanded from 64rem (1024px) to 78rem (1248px) */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: #ffffff;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
  min-height: 60vh;
}

/* Header & Navigation */
.rbk-header-top {
  background: linear-gradient(to top, #61729F, #36415f);
  height: 92px;
}

.rbk-header-inner {
  max-width: 78rem;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rbk-logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rbk-logo-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}

.rbk-user-badge {
  color: #e5e7eb;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rbk-desktop-only {
  display: flex;
}

.rbk-header-right-mobile {
  display: none;
}

.rbk-nav-bar {
  background: linear-gradient(to top, #487BC6, #5D9EFF);
  min-height: 50px;
  padding-top: 0.5rem;
}

.rbk-nav-desktop {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.rbk-nav-item {
  position: relative;
}

.rbk-nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.65rem;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.rbk-nav-link:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.rbk-nav-link.active {
  background-color: #ffffff;
  color: #000000;
}

.rbk-nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  color: #000000;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  border: 1px solid #e5e7eb;
  min-width: 200px;
  z-index: 50;
  padding: 0.5rem 0;
}

.rbk-nav-item:hover .rbk-nav-dropdown {
  display: block;
}

.rbk-nav-dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 14px;
  font-weight: 600;
}

.rbk-nav-dropdown a:hover,
.rbk-nav-dropdown a.active {
  background-color: #5D9EFF;
  color: #ffffff;
}

/* Header Brand Text & Tagline */
.rbk-brand-text-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  user-select: none;
}

.rbk-brand-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2px;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.rbk-brand-sub {
  font-size: 0.72rem;
  color: #ffd166;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Mobile Drawer Overlay & Sidebar */
.rbk-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.rbk-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.rbk-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: #1e293b;
  color: #f8fafc;
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.rbk-drawer.open {
  transform: translateX(0);
}

.rbk-drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.5);
}

.rbk-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rbk-drawer-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.rbk-drawer-brand-text {
  display: flex;
  flex-direction: column;
}

.rbk-drawer-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.rbk-drawer-brand-sub {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.2;
}

.rbk-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rbk-drawer-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.rbk-drawer-user {
  margin: 12px 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.drawer-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-role {
  font-size: 11px;
  color: #34d399;
  font-weight: 500;
}

.drawer-user-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-btn-admin {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 1px solid rgba(239, 68, 68, 0.4);
  display: block;
}

.drawer-btn-logout {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f87171;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.drawer-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.drawer-btn-login {
  background: #3b82f6;
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.drawer-btn-register {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fde68a;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.rbk-drawer-nav {
  flex: 1;
  padding: 6px 10px 24px;
}

.drawer-nav-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 10px 8px 6px;
}

.drawer-nav-group {
  margin-bottom: 2px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.drawer-nav-link {
  flex: 1;
  padding: 9px 12px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.drawer-nav-link:hover {
  color: #ffffff;
}

.drawer-nav-link.active {
  background: #3b82f6;
  color: #ffffff;
  border-radius: 6px;
}

.drawer-accordion-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 15px;
  padding: 8px 12px;
  cursor: pointer;
}

.drawer-sub-menu {
  display: none;
  padding: 4px 0 6px 14px;
  border-left: 2px solid rgba(59, 130, 246, 0.35);
  margin-left: 14px;
}

.drawer-sub-menu.open {
  display: block;
}

.drawer-sub-link {
  display: block;
  padding: 7px 10px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 4px;
}

.drawer-sub-link:hover {
  color: #ffffff;
}

.drawer-sub-link.active {
  color: #60a5fa;
  font-weight: 700;
}

/* Mobile Responsive Breakpoints */
@media (max-width: 767px) {
  .rbk-desktop-only {
    display: none !important;
  }
  .rbk-header-top {
    height: 58px;
  }
  .rbk-header-inner {
    padding: 0 0.85rem;
  }
  .rbk-logo-link {
    gap: 0.6rem;
  }
  .rbk-logo-img {
    height: 40px;
    width: 40px;
    max-width: 40px;
    object-fit: contain;
  }
  .rbk-brand-title {
    font-size: 1.05rem;
  }
  .rbk-brand-sub {
    font-size: 0.65rem;
  }
  .rbk-header-right-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mobile-user-chip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: transform 0.15s ease;
  }
  .mobile-user-chip:active {
    transform: scale(0.95);
  }
  .mobile-login-link {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    white-space: nowrap;
  }
  .rbk-hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
  }
  .rbk-hamburger-btn:hover,
  .rbk-hamburger-btn:active {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(0.96);
  }
  .rbk-hamburger-btn span {
    width: 18px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.2s ease;
  }
  .rbk-nav-bar {
    display: none !important;
  }
}

/* Footer */
.rbk-footer {
  background-color: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  margin-top: 3rem;
}

.rbk-footer-inner {
  max-width: 78rem; /* expanded from 64rem to 78rem */
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .rbk-footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rbk-footer p {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #374151;
}

.rbk-footer a {
  color: #2563eb;
  font-size: 0.875rem;
}

.rbk-footer a:hover {
  text-decoration: underline;
}

.rbk-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Home layout */
.page-pad {
  padding: 1.5rem 1.25rem;
}

@media (max-width: 767px) {
  .page-pad {
    padding: 0.85rem 0.65rem;
  }
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .home-grid {
    grid-template-columns: 2.15fr 1fr;
    gap: 1.5rem;
  }
  .home-left {
    grid-column: span 1;
    min-width: 0;
  }
  .home-right {
    grid-column: span 1;
    min-width: 0;
  }
}

.page-h1 {
  font-weight: 700;
  font-size: 1.5rem;
  color: #000000;
  margin: 0 0 0.35rem 0;
}

.page-h1-blue {
  font-weight: 700;
  font-size: 1.5rem;
  color: #5D9EFF;
  margin: 0 0 1.25rem 0;
}

.current-datetime {
  font-size: 13px;
  font-weight: 700;
  color: #0D58A4;
  margin-bottom: 10px;
}

.live-notice {
  margin-bottom: 0.5rem;
  background-color: #f0fdf4;
  border: 1px solid #4ade80;
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  display: inline-block;
}

/* Result + Head/Tail Grid */
.result-block-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem 0;
}

@media (min-width: 768px) {
  .result-block-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .result-table-col {
    grid-column: span 4 / span 4;
  }
  .headtail-group {
    grid-column: span 4 / span 4;
  }
}

.headtail-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.kqxs-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #60a5fa;
  table-layout: auto;
}

.kqxs-table th, .kqxs-table td {
  border: 1px solid #60a5fa;
  padding: 0.45rem 0.35rem;
  font-size: 0.875rem;
  text-align: center;
}

@media (max-width: 480px) {
  .kqxs-table th, .kqxs-table td {
    padding: 0.32rem 0.15rem;
    font-size: 0.82rem;
  }
  .kqxs-table td.kqxs-label {
    width: 2.85rem !important;
    font-size: 0.8rem;
  }
  .kqxs-table td.kqxs-db {
    font-size: 0.95rem;
  }
}

.kqxs-table th {
  background-color: #99C0FB;
  color: #1e3a8a;
  font-weight: 700;
}

.kqxs-table td {
  background-color: #f3f5f8;
  font-weight: 700;
  color: #000000;
}

.kqxs-table td:hover {
  background-color: #dbeafe;
}

.kqxs-table td.kqxs-label {
  color: #1e3a8a;
  width: 3.75rem;
  background-color: #f3f5f8;
}

.kqxs-table td.kqxs-db {
  color: #dc2626;
  font-weight: 700;
  font-size: 1rem;
}

/* Head & Tail tables */
.head-table, .tail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.head-table th, .tail-table th {
  padding: 0.45rem 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.head-table td, .tail-table td {
  padding: 0.42rem 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: break-word;
}

.head-table th {
  background-color: #FAC99C;
  border: 1px solid #fbbf24;
}

.head-table td {
  background-color: #FDEEE1;
  border: 1px solid #fbbf24;
}

.head-table td.digit-col {
  color: #78350f;
  width: 2.2rem;
  text-align: center;
}

.tail-table th {
  background-color: #E4ADE9;
  border: 1px solid #E688DC;
}

.tail-table td {
  background-color: #FDF2FC;
  border: 1px solid #E688DC;
}

.tail-table td.digit-col {
  color: #581c87;
  width: 2.2rem;
  text-align: center;
}

@media (max-width: 480px) {
  .headtail-group {
    gap: 0.35rem;
  }
  .head-table th, .tail-table th {
    padding: 0.35rem 0.18rem;
    font-size: 0.8rem;
  }
  .head-table td, .tail-table td {
    padding: 0.35rem 0.18rem;
    font-size: 0.76rem;
    line-height: 1.35;
  }
  .head-table td.digit-col, .tail-table td.digit-col {
    width: 1.75rem;
    padding: 0.35rem 0.1rem;
  }
}

/* Quick Stats Box */
.stat-box {
  border: 1px solid #60a5fa;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  overflow-x: hidden;
  max-width: 100%;
}

.stat-header {
  background-color: #60a5fa;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
}

.stat-subhead-blue {
  background-color: #dbeafe;
  padding: 0.3rem 0.5rem;
  color: #1e3a8a;
  font-weight: 600;
}

.stat-subhead-orange {
  background-color: #FDECD5;
  padding: 0.3rem 0.5rem;
  color: #b91c1c;
  font-weight: 600;
}

.stat-subhead-plain {
  padding: 0.35rem 0.5rem;
  font-weight: 600;
}

.gan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
}

@media (min-width: 480px) {
  .gan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .gan-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .gan-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.45rem;
  }
}

.gan-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gan-cell {
  display: flex;
  border-left: 1px solid #60a5fa;
  border-right: 1px solid #60a5fa;
  border-top: 1px solid #60a5fa;
  font-size: 11.5px;
  font-weight: 700;
  min-width: 0;
}

.gan-cell:last-child {
  border-bottom: 1px solid #60a5fa;
}

.gan-num {
  background-color: #dbeafe;
  border-right: 1px solid #60a5fa;
  padding: 0.25rem 0.3rem;
  color: #b91c1c;
  text-align: center;
  white-space: nowrap;
}

.gan-val {
  background-color: #FFF4E1;
  padding: 0.25rem 0.25rem;
  color: #15803d;
  text-align: center;
  flex: 1;
  white-space: nowrap;
}

.top-gan-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.75rem 0.5rem 0.75rem;
  font-size: 13px;
}

.top-gan-list li {
  margin-bottom: 0.25rem;
}

/* Bar charts */
.pair-chart-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  padding: 0.5rem 0.75rem 0.75rem 0.75rem;
  flex-wrap: wrap;
}

.pair-group {
  display: flex;
  gap: 0.25rem;
  align-items: flex-end;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bar-days-lbl {
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.bar-left {
  background-color: #8C8CFF;
  width: 2.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  padding-bottom: 2px;
}

.bar-right {
  background-color: #5776F1;
  width: 2.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  padding-bottom: 2px;
}

.total-chart-wrap {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 0.35rem 0.5rem;
  overflow-x: auto;
}

.total-bar {
  background-color: #8C8CFF;
  width: 1.75rem;
}

.total-bar-lbl {
  text-align: center;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.2rem 0;
  color: #000000;
}

/* Calendar Card & Modal */
.cal-card {
  max-width: 28rem;
  margin: 0 auto;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
}

.cal-head-time {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background-color: #6b7280;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
}

.cal-head-time > div {
  padding: 0.3rem;
  text-align: center;
  border: 1px solid #ffffff;
}

.cal-solar-bar {
  text-align: center;
  padding: 0.35rem;
  border-bottom: 1px solid #d1d5db;
  background-color: #bfdbfe;
  color: #1e40af;
  font-size: 1.25rem;
  font-weight: 700;
}

.cal-lunar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.cal-lunar-left {
  background-color: #FFF4E1;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.cal-lunar-day {
  font-size: 1.25rem;
  color: #ef4444;
  font-weight: 700;
  margin: 0.15rem 0;
}

.cal-lunar-right {
  background-color: #F4E4FC;
  color: #7e22ce;
  font-size: 12px;
  font-weight: 700;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.cal-hoangdao {
  font-size: 12px;
  padding: 0.4rem 0.5rem;
  background-color: #fef3c7;
}

.cal-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cal-modal-backdrop.open {
  display: flex;
}

.cal-modal-box {
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  max-width: 42rem;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.cal-modal-head {
  background-color: #2563eb;
  color: #ffffff;
  padding: 0.5rem 0.75rem;
}

.cal-grid-7 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-cell-btn {
  padding: 0.3rem;
  border: 1px solid #e5e7eb;
  min-height: 46px;
  text-align: left;
  background: #ffffff;
  cursor: pointer;
}

.cal-cell-btn:hover { background-color: #eff6ff; }
.cal-cell-btn.other-month { background-color: #f9fafb; color: #9ca3af; }
.cal-cell-btn.sat { background-color: #f0fdf4; }
.cal-cell-btn.sun { background-color: #fef2f2; }
.cal-cell-btn.selected { box-shadow: inset 0 0 0 2px #3b82f6; background-color: #dbeafe; }

/* Prediction Sidebar Boxes */
.side-box {
  margin-top: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #ffffff;
}

.side-box-head {
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: linear-gradient(to top, #d1d5db, #ffffff);
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
}

.side-box-body {
  padding: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-num {
  border: 1px solid #d1d5db;
  border-radius: 0.125rem;
  padding: 0.2rem 0.35rem;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

.chip-num:hover {
  color: #d97706;
  border-color: #d97706;
}

.lotop-num {
  font-weight: 600;
  color: #1d4ed8;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
}

.lotop-num:hover { color: #d97706; }
.lotop-0 { font-size: 30px; line-height: 1; }
.lotop-1 { font-size: 25px; line-height: 1.1; }
.lotop-2 { font-size: 20px; line-height: 1.2; }

/* Tabs & Filters (/ket-qua) */
.region-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #d1d5db;
  margin-bottom: 1rem;
}

.region-tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #4b5563;
  border-bottom: 2px solid transparent;
}

.region-tab-btn.active {
  color: #5D9EFF;
  border-bottom-color: #5D9EFF;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.filter-input {
  padding: 0.3rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  background-color: #ffffff;
}

.btn-primary {
  padding: 0.35rem 1rem;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  border: 1px solid #9ca3af;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 0.375rem;
  background-color: #f3f4f6;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

/* Posts & Prose */
.post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.post-card {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 640px) {
  .post-card {
    grid-template-columns: auto 1fr;
  }
}

.post-thumb {
  width: 240px;
  height: 160px;
  overflow: hidden;
  border-radius: 0.5rem;
  background: #e5e7eb;
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #5D9EFF;
  display: block;
  margin-bottom: 0.3rem;
}

.post-title:hover {
  color: #3b82f6;
}

.prose {
  color: #374151;
  line-height: 1.7;
  max-width: 100%;
  overflow-x: auto;
}

.prose h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.prose h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.prose th, .prose td {
  border: 1px solid #d1d5db;
  padding: 0.45rem 0.65rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
}

/* Tools grid */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tool-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tool-tile img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
}

.tool-tile p {
  font-weight: 700;
  margin-top: 0.5rem;
  color: #000000;
}

/* Chot so board */
.chot-header-bar {
  background-color: #3b82f6;
  color: #ffffff;
  border: 1px solid #93c5fd;
}

.chot-scroll {
  background-color: #ffffff;
  max-height: 440px;
  overflow-y: auto;
  color: #000000;
}

.chot-row {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

.chot-row.even { background-color: #ffffff; }
.chot-row.odd { background-color: #eff6ff; }
.chot-row.vip { background-color: #f3e8ff; }

.chot-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 1rem;
  z-index: 40;
  background-color: #1f2937;
  color: #ffffff;
  padding: 0.45rem 0.7rem;
  border-radius: 0.25rem;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.chot-member-wrap:hover .chot-tooltip {
  display: block;
}

/* Auth forms */
.auth-card {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  max-width: 28rem;
  margin: 1.5rem auto;
}

.auth-card.wide {
  max-width: 42rem;
}

.auth-head {
  background-color: #374151;
  color: #ffffff;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.auth-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.auth-field input, .auth-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.9rem;
}

.alert-ok {
  background-color: #dcfce7;
  border: 1px solid #22c55e;
  color: #166534;
  padding: 0.6rem 0.85rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.alert-err {
  background-color: #fee2e2;
  border: 1px solid #ef4444;
  color: #991b1b;
  padding: 0.6rem 0.85rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

/* Dark /thong-ke page */
body.tk-body {
  background-color: #141414;
  color: #ffffff;
  min-height: 100vh;
}

.tk-toolbar {
  background-color: #1f2937;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #000000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 12px;
}

.tk-input {
  background-color: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.25rem;
  color: #ffffff;
  padding: 0.25rem 0.45rem;
  font-size: 12px;
}

.tk-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.stats-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
  background-color: #35363C;
  border: 0.5px solid #000000;
}

.stats-table th, .stats-table td {
  border-right: 1px solid #000000;
  border-bottom: 1px solid #000000;
  text-align: center;
  font-size: 12px;
  width: 22px;
  min-width: 22px;
  height: 21px;
  padding: 0;
}

.stats-table th.tk-sticky-col, .stats-table td.tk-sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 86px;
  min-width: 86px;
  background-color: #2D2D2D;
  color: #9ca3af;
  padding: 2px 4px;
}

.tk-bar-th {
  background-color: #1D2332;
  vertical-align: bottom;
  cursor: pointer;
  height: 46px;
}

.tk-bar-fill {
  width: 100%;
  background-color: #3b82f6;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tk-pair-th {
  background-color: #2D2D2D;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.tk-pair-th.marked { background-color: #018383; }
.tk-pair-th.hovered, .tk-bar-th.hovered { background-color: #2ad4d4; color: #000; }

.tk-cell-gan { background-color: #77A3E3; }
.tk-cell-first { background-color: #614032; color: #ffffff; }
.tk-cell-1 { background-color: #6b7280; color: #ffffff; }
.tk-cell-2 { background-color: #7658CF; color: #ffffff; }
.tk-cell-3 { background-color: #C515DD; color: #ffffff; }
.tk-cell-db { background-color: #ef4444; color: #ffffff; }
.tk-marked-col { border-right: 2px solid #4ade80 !important; border-left: 2px solid #4ade80 !important; }

/* ==========================================================================
   Comprehensive Mobile & Touch Optimization (mobi responsive)
   ========================================================================== */

@media (max-width: 767px) {
  /* Page pad */
  .page-pad {
    padding: 0.75rem 0.5rem;
  }

  /* Header & Branding */
  .rbk-header-inner {
    padding: 0 0.75rem;
    height: 100%;
  }
  .rbk-logo-img {
    height: 38px;
    width: 38px;
    object-fit: contain;
  }
  .rbk-user-badge {
    font-size: 12px;
    gap: 0.4rem;
    max-width: 65%;
    justify-content: flex-end;
  }
  .rbk-user-badge span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Headings */
  .page-h1, .page-h1-blue {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.35;
  }

  /* Result Block & Table */
  .result-block-grid {
    gap: 0.4rem;
    margin: 0.4rem 0 0.85rem 0;
  }
  .kqxs-table th {
    padding: 0.4rem 0.2rem;
    font-size: 0.8rem;
  }
  .kqxs-table td {
    padding: 0.35rem 0.15rem;
    font-size: 0.8rem;
    letter-spacing: -0.2px;
  }
  .kqxs-table td.kqxs-label {
    width: 2.75rem;
    font-size: 0.75rem;
    padding: 0.35rem 0.1rem;
  }
  .kqxs-table td.kqxs-db {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
  }

  /* Head/Tail tables */
  .headtail-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .head-table th, .tail-table th {
    padding: 0.35rem 0.2rem;
    font-size: 0.8rem;
  }
  .head-table td, .tail-table td {
    padding: 0.3rem 0.2rem;
    font-size: 0.78rem;
  }
  .head-table td.digit-col, .tail-table td.digit-col {
    width: 1.75rem;
    font-size: 0.8rem;
    font-weight: 700;
  }

  /* Quick Stats Gan Grid */
  .gan-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 0.25rem;
    padding: 0.25rem;
    font-size: 0.75rem;
  }
  .gan-cell {
    padding: 0.15rem 0.1rem;
    font-size: 0.75rem;
  }

  /* Filter bar (/ket-qua) */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.65rem 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 1rem;
  }
  .filter-input {
    font-size: 14px;
    padding: 0.35rem 0.45rem;
    min-height: 36px;
  }
  .btn-primary, .btn-secondary {
    padding: 0.45rem 0.85rem;
    min-height: 38px;
    font-size: 13px;
  }
  .region-tabs {
    gap: 0.25rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 0.75rem;
  }
  .region-tabs::-webkit-scrollbar {
    display: none;
  }
  .region-tab-btn {
    padding: 0.45rem 0.75rem;
    font-size: 13px;
    flex-shrink: 0;
  }

  /* Chot So Mobile */
  .chot-header-bar {
    border-radius: 6px;
    overflow: hidden;
  }
  .chot-scroll {
    max-height: 520px;
  }
  .chot-row {
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
  }
  .chot-tooltip {
    left: 0;
    right: 0;
    max-width: 260px;
  }

  /* Thong Ke Toolbar Mobile */
  .tk-toolbar {
    padding: 0.5rem 0.4rem;
    gap: 0.4rem;
    font-size: 13px;
  }
  .tk-input {
    font-size: 13px;
    padding: 0.35rem 0.45rem;
    min-height: 34px;
  }
  .tk-table-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Sidebar card / Tools grid */
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .post-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .post-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
  }

  /* Calendar modal on mobile */
  .cal-modal-box {
    max-width: 95vw;
    margin: 0 auto;
    border-radius: 8px;
  }
  .cal-cell-btn {
    min-height: 40px;
    padding: 2px;
    font-size: 11px;
  }
  .cal-cell-btn div:first-child {
    font-size: 12px;
  }
  .cal-cell-btn div:last-child {
    font-size: 9px;
  }

  /* Footer */
  .rbk-footer {
    margin-top: 1.5rem;
  }
  .rbk-footer-inner {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .gan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
