/* ===================================================================
   Hội Đam Mê Số Học DK - Kết Quả Xổ Số Miền Bắc (XSMB)
   Phong cách thiết kế: Đơn giản, rõ ràng, truyền thống chuẩn mực,
   tối ưu tra cứu nhanh, không lạm dụng hiệu ứng đồ họa hay neon AI.
   =================================================================== */

:root {
  /* Bảng màu chính (Theme Sáng - Mặc định cho trang xổ số Việt Nam) */
  --brand-red: #c8102e;          /* Đỏ truyền thống xổ số kiến thiết */
  --brand-red-hover: #a50b24;
  --brand-navy: #1e3a8a;         /* Xanh navy trang trọng */
  --brand-navy-light: #2563eb;

  /* Nền & Thẻ */
  --bg-primary: #f1f5f9;         /* Slate 100 - nền dịu mắt */
  --bg-secondary: #ffffff;       /* Trắng tinh khôi */
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-tertiary: #f8fafc;        /* Slate 50 */
  --bg-muted: #e2e8f0;

  /* Đường kẻ & Viền */
  --border-subtle: #e2e8f0;       /* Viền thanh lịch */
  --border-highlight: #cbd5e1;
  --border-strong: #94a3b8;

  /* Màu chữ */
  --text-primary: #0f172a;        /* Đen than Slate 900 - nét, rõ */
  --text-secondary: #334155;      /* Slate 700 */
  --text-muted: #64748b;          /* Slate 500 */
  --text-inverse: #ffffff;

  /* Màu giải thưởng */
  --prize-special: #dc2626;       /* Đỏ nổi bật giải đặc biệt */
  --prize-special-bg: #fef2f2;    /* Nền đỏ nhạt giải đặc biệt */
  --prize-special-border: #fecaca;
  --prize-first: #1e3a8a;         /* Xanh navy giải nhất */
  --prize-seventh: #b91c1c;       /* Đỏ sẫm giải 7 */
  --highlight-bg: #fef08a;        /* Vàng highlight khi tra cứu */
  --highlight-text: #854d0e;
  --highlight-border: #eab308;

  /* Trạng thái */
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;

  /* Aliases tương thích ngược */
  --gold-400: #d97706;
  --gold-500: #b45309;
  --gold-gradient: #fef08a;
  --ruby-400: #dc2626;
  --ruby-500: #b91c1c;
  --ruby-gradient: #dc2626;
  --cyan-400: #2563eb;
  --emerald-400: #16a34a;

  /* Kiểu chữ */
  --font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Roboto Mono', 'SF Pro Display', Consolas, Menlo, monospace;

  /* Bo góc & Đổ bóng nhẹ nhàng, thực tế */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --max-width: 1320px;
  --transition-fast: 0.15s ease-in-out;
}

/* ===================================================================
   Chế độ tối (Dark Mode - Slate Tối Giản, Dịu Mắt, Không Neon)
   =================================================================== */
[data-theme="dark"] {
  --brand-red: #ef4444;
  --brand-red-hover: #dc2626;
  --brand-navy: #3b82f6;
  --brand-navy-light: #60a5fa;

  --bg-primary: #0f172a;         /* Slate 900 */
  --bg-secondary: #1e293b;       /* Slate 800 */
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-tertiary: #162032;
  --bg-muted: #334155;

  --border-subtle: #334155;       /* Slate 700 */
  --border-highlight: #475569;
  --border-strong: #64748b;

  --text-primary: #f8fafc;        /* Slate 50 */
  --text-secondary: #cbd5e1;      /* Slate 300 */
  --text-muted: #94a3b8;          /* Slate 400 */
  --text-inverse: #0f172a;

  --prize-special: #f87171;
  --prize-special-bg: #450a0a;
  --prize-special-border: #991b1b;
  --prize-first: #93c5fd;
  --prize-seventh: #fca5a5;
  --highlight-bg: #854d0e;
  --highlight-text: #fef08a;
  --highlight-border: #ca8a04;

  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-gradient: #854d0e;
  --ruby-400: #f87171;
  --ruby-500: #ef4444;
  --ruby-gradient: #dc2626;
  --cyan-400: #60a5fa;
  --emerald-400: #34d399;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ===================================================================
   Reset & Thiết lập nền tảng
   =================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: light;
}

[data-theme="dark"] html {
  color-scheme: dark;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Thanh cuộn tối giản */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-highlight);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 3rem 1rem;
}

/* ===================================================================
   Header & Điều hướng Đầu Trang (Site Header)
   =================================================================== */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo-ball {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--brand-red);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-sync {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sync:hover {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
}

/* ===================================================================
   Thanh Tabs Điều Hướng (Main Navigation Tabs)
   =================================================================== */
.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  gap: 1rem;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  flex-wrap: nowrap;
}

.nav-tab-item {
  flex-shrink: 0;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-tab-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .nav-tab-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
}

.quick-search-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.quick-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  width: 85px;
}

.quick-search-box input::placeholder {
  color: var(--text-muted);
  font-weight: normal;
}

.search-alert-bar {
  margin: 0 0 1rem 0;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.85rem;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: space-between;
}

[data-theme="dark"] .search-alert-bar {
  background: #064e3b;
  border-color: #047857;
  color: #6ee7b7;
}

/* ===================================================================
   Thanh Chọn Ngày & Tiện Ích (Date Navigation Bar)
   =================================================================== */
.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.date-selector-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-nav-btn {
  padding: 0.45rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.date-nav-btn:hover:not(:disabled) {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
}

.date-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.date-picker-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.42rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.date-picker-input:focus {
  border-color: var(--brand-navy);
}

.date-shortcuts {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.date-chip:hover, .date-chip.active {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #ffffff;
}

.board-action-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.board-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.board-action-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
}

/* ===================================================================
   Bố Cục Kết Quả (Bảng Giải Thưởng + Bảng Đầu Đuôi Lô Tô)
   =================================================================== */
.lottery-grid-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .lottery-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   Bảng Kết Quả Xổ Số Miền Bắc (Main Prize Table Card)
   =================================================================== */
.prize-board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.board-header {
  padding: 0.85rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-title-group h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand-red);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.board-date-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
}

.board-row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.board-row:hover {
  background-color: var(--bg-tertiary);
}

.board-row:last-child {
  border-bottom: none;
}

.prize-name-col {
  width: 110px;
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-subtle);
  text-align: center;
  vertical-align: middle;
  background: var(--bg-tertiary);
  user-select: none;
}

.prize-numbers-col {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

/* Giải Đặc Biệt (Hero Row) */
.board-row.special-row {
  background: var(--prize-special-bg);
  border-bottom: 2px solid var(--prize-special-border);
}

.board-row.special-row:hover {
  background: var(--prize-special-bg);
}

.board-row.special-row .prize-name-col {
  color: var(--prize-special);
  font-weight: 800;
  font-size: 0.95rem;
  background: rgba(220, 38, 38, 0.06);
  border-right-color: var(--prize-special-border);
}

.special-number-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.35rem 0;
}

.special-digit-ball {
  width: 46px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--prize-special);
  box-shadow: var(--shadow-sm);
  user-select: all;
}

[data-theme="dark"] .special-digit-ball {
  background: #1e293b;
  border-color: #475569;
}

.special-digit-ball.last-two {
  background: var(--prize-special);
  color: #ffffff;
  border-color: var(--prize-special);
}

[data-theme="dark"] .special-digit-ball.last-two {
  background: #dc2626;
  color: #ffffff;
  border-color: #ef4444;
}

.special-digit-ball.pending-digit {
  color: var(--text-muted);
  opacity: 0.4;
  background: var(--bg-tertiary);
}

.lottery-num.pending-num {
  color: var(--text-muted);
  opacity: 0.35;
  cursor: default;
}

.live-pulse-badge {
  color: #dc2626;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .live-pulse-badge {
  color: #f87171;
}

.special-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.special-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-xs);
  background: #ffffff;
  border: 1px solid var(--prize-special-border);
  color: var(--prize-special);
  font-weight: 700;
  font-size: 0.82rem;
}

[data-theme="dark"] .special-tag {
  background: #1e293b;
  border-color: #991b1b;
}

/* Dãy Số Các Giải Còn Lại (Chuẩn Bản In, Sạch Sẽ) */
.numbers-flex-wrap {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.lottery-num {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  cursor: pointer;
  user-select: all;
}

.lottery-num:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
  color: var(--brand-navy-light);
}

/* Tô sáng khi bấm tìm kiếm hoặc bấm lô tô */
.lottery-num.highlighted {
  background: var(--highlight-bg) !important;
  color: var(--highlight-text) !important;
  border-color: var(--highlight-border) !important;
  font-weight: 900 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.prize-1-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--prize-first);
}

.prize-2-num,
.prize-3-num,
.prize-4-num,
.prize-5-num,
.prize-6-num,
.prize-7-num {
  font-size: 1.6rem;
  font-weight: 700;
}

.prize-7-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--prize-seventh);
}

#sim-p1-container .sim-slot {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--prize-first);
}

#sim-board-table .sim-slot {
  font-size: 1.6rem;
  font-weight: 700;
}

/* ===================================================================
   Bảng Đầu - Đuôi Lô Tô (Loto 2-Digits Card)
   =================================================================== */
.loto-board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.loto-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 2px solid var(--brand-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.loto-header h2, .loto-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.loto-mode-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.mode-toggle-btn {
  padding: 0.3rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--brand-navy);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .mode-toggle-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
}

.loto-table-wrapper {
  padding: 0.5rem;
}

.loto-table {
  width: 100%;
  border-collapse: collapse;
}

.loto-row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.loto-row:hover {
  background-color: var(--bg-tertiary);
}

.loto-row:last-child {
  border-bottom: none;
}

.loto-head-col, .loto-head-cell {
  width: 60px;
  padding: 0.55rem 0.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-navy);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
}

.loto-head-col.cam {
  color: var(--brand-red);
  background: rgba(220, 38, 38, 0.05);
}

.loto-tail-col, .loto-tail-cell {
  padding: 0.5rem 0.85rem;
  vertical-align: middle;
}

.loto-tags-flex {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.loto-pill {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.loto-pill:hover {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
  color: var(--brand-navy-light);
}

.loto-pill.is-special {
  background: var(--prize-special);
  color: #ffffff;
  border-color: var(--prize-special);
  font-weight: 900;
}

.loto-pill.multi-hit::after {
  content: 'x' attr(data-count);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-warning);
  margin-left: 0.2rem;
}

.loto-pill.is-special.multi-hit::after {
  color: #fef08a;
}

.cam-badge {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

/* ===================================================================
   Tab Quay Mô Phỏng (Draw Simulator - G1 -> G7 -> GĐB)
   =================================================================== */
.simulator-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.sim-header-flex {
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sim-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.sim-stage-badge {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-navy);
}

.sim-speed-selector {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.sim-speed-btn {
  padding: 0.3rem 0.65rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sim-speed-btn:hover {
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

.sim-speed-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
  border-color: var(--brand-navy);
}

.sim-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: var(--brand-red);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--brand-red-hover);
}

/* Tiến độ quay */
.sim-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.sim-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sim-progress-bar-fill {
  height: 100%;
  background: var(--brand-navy);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

.sim-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Khung hiển thị bóng số mô phỏng */
.rolling-cage {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.sim-cage-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.sim-balls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.sim-ball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.sim-ball.rolling {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-2px);
}

.sim-ball.special {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
}

.sim-slot {
  transition: background-color var(--transition-fast);
}

.sim-slot.rolling-now {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #3b82f6 !important;
}

.sim-slot.newly-revealed {
  background: var(--highlight-bg) !important;
  color: var(--highlight-text) !important;
  border-color: var(--highlight-border) !important;
  font-weight: 900 !important;
}

.sim-slot.revealed-special {
  background: var(--prize-special-bg) !important;
  color: var(--prize-special) !important;
  border-color: var(--prize-special-border) !important;
}

.loto-tail-badge {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  display: inline-block;
  margin: 2px;
}

/* ===================================================================
   Tab Thống Kê & Lô Gan (Analytics)
   =================================================================== */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stats-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .stats-grid-2col {
    grid-template-columns: 1fr;
  }
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-box-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
}

.stat-table th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.stat-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.fill-ruby {
  background: var(--brand-red);
}

.fill-gold {
  background: var(--brand-navy);
}

/* Ma trận 100 số (00 - 99 Heatmap) */
.matrix-grid-100 {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-top: 1rem;
}

.matrix-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-mono);
}

.matrix-cell:hover {
  background: var(--bg-muted);
  border-color: var(--border-highlight);
}

.matrix-cell .cell-num {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.matrix-cell .cell-hits {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.matrix-cell.hit-today {
  background: #fef08a;
  border-color: #facc15;
}

.matrix-cell.hit-today .cell-num {
  color: #854d0e;
}

.matrix-cell.special-today {
  background: var(--brand-red);
  border-color: var(--brand-red);
}

.matrix-cell.special-today .cell-num,
.matrix-cell.special-today .cell-hits {
  color: #ffffff;
}

/* ===================================================================
   Tab Lịch Sử Kỳ Quay (Historical Browser)
   =================================================================== */
.history-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.history-controls-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.history-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
}

.history-search-input-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.88rem;
  width: 180px;
}

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.history-view-mode-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

/* Thẻ Lịch Sử */
.history-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition-fast);
}

.history-card:hover {
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.history-card-date {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.history-card-day {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.history-card-date-str {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.history-card-action-btn {
  padding: 0.3rem 0.65rem;
  background: var(--bg-tertiary);
  color: var(--brand-navy);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.history-card-action-btn:hover {
  background: var(--brand-navy);
  color: #ffffff;
}

.history-card-prizes {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.history-prize-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.history-prize-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.history-prize-value {
  font-family: var(--font-mono);
  font-weight: 800;
}

.history-prize-item.special .history-prize-value {
  font-size: 1.25rem;
  color: var(--brand-red);
}

.history-prize-item.p1 .history-prize-value {
  font-size: 1.1rem;
  color: var(--brand-navy);
}

.history-prize-item.head-tail .history-prize-value {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.history-loto-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.history-table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th {
  padding: 0.65rem 0.85rem;
  background: var(--bg-tertiary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.history-table td {
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pagination-btns {
  display: flex;
  gap: 0.35rem;
}

/* ===================================================================
   Chân Trang (Site Footer)
   =================================================================== */
.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.45rem;
}

.footer-links a {
  color: var(--brand-navy);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ===================================================================
   Mobile Bottom Navigation
   =================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .app-container {
    padding: 0 0.5rem calc(4.5rem + env(safe-area-inset-bottom)) 0.5rem;
  }

  .header-inner {
    padding: 0.65rem 0.75rem;
  }

  .brand-logo-ball {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .brand-subtext {
    display: none;
  }

  .nav-tabs-wrapper {
    flex-direction: column;
    align-items: stretch;
    padding: 0.35rem;
    gap: 0.5rem;
  }

  .nav-tabs {
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .quick-search-box {
    width: 100%;
  }
  .quick-search-box input {
    flex: 1;
    width: auto;
  }

  .date-bar {
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
  }

  .date-selector-group {
    width: 100%;
  }

  .date-nav-btn {
    flex: 1;
    text-align: center;
  }

  .date-picker-input {
    flex: 2;
    min-width: 0;
    text-align: center;
  }

  .date-shortcuts {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .date-shortcuts::-webkit-scrollbar {
    display: none;
  }

  .board-action-group {
    width: 100%;
  }

  .board-action-btn {
    flex: 1;
    justify-content: center;
  }

  #btn-print-result, #btn-quick-sim {
    display: none;
  }

  .prize-name-col {
    width: 75px;
    padding: 0.5rem 0.25rem;
    font-size: 0.78rem;
  }

  .prize-numbers-col {
    padding: 0.5rem 0.4rem;
  }

  .special-digit-ball {
    width: 36px;
    height: 44px;
    font-size: 1.6rem;
  }

  .prize-1-num,
  #sim-p1-container .sim-slot {
    font-size: 1.45rem;
  }

  .prize-2-num,
  .prize-3-num,
  .prize-4-num,
  .prize-5-num,
  .prize-6-num,
  .prize-7-num,
  #sim-board-table .sim-slot {
    font-size: 1.3rem;
  }

  .loto-head-col {
    width: 48px;
    font-size: 1rem;
    padding: 0.4rem 0.2rem;
  }

  .loto-tail-col {
    padding: 0.4rem 0.5rem;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom)) 0.25rem;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
    flex: 1;
  }

  .mobile-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
  }

  .mobile-nav-item.active {
    color: var(--brand-red);
  }
}

/* ===================================================================
   In Ấn (Print Optimization)
   =================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .site-header, .date-bar, .nav-tabs-wrapper, .site-footer,
  .board-action-group, .card-section:not(#section-board),
  .loto-board-card, .mobile-bottom-nav {
    display: none !important;
  }
  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .lottery-grid-layout {
    grid-template-columns: 1fr !important;
  }
  .prize-board-card {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
}

.rotating {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===================================================================
   TAB: SỔ GHI SỐ & TIỀN THEO NGÀY (BET NOTES & EXPENSE NOTEBOOK)
   =================================================================== */
.notes-page-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.notes-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.notes-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.notes-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.notes-badge {
  background: rgba(22, 163, 74, 0.12);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.notes-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0 0;
  max-width: 650px;
  line-height: 1.45;
}

.notes-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notes-btn {
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
}

.btn-primary-gradient {
  background: linear-gradient(135deg, var(--brand-red) 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 2px 4px rgba(200, 16, 46, 0.25);
}

.btn-primary-gradient:hover {
  background: linear-gradient(135deg, var(--brand-red-hover) 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

.btn-secondary-outline {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-highlight);
}

.btn-secondary-outline:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Dropdown actions */
.notes-dropdown-wrapper {
  position: relative;
}

.notes-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  z-index: 100;
  padding: 0.4rem;
}

.notes-dropdown-menu.show {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item.text-danger {
  color: var(--color-danger);
}

.dropdown-item.text-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0;
}

/* Odds Settings Panel */
.notes-settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.settings-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.settings-header-flex h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-input {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.settings-input:focus {
  outline: none;
  border-color: var(--brand-red);
  background: var(--bg-card);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Main 2-column Grid */
.notes-main-grid {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .notes-main-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Form Card */
.notes-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 1rem;
}

.card-header-styled {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.card-header-styled h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.header-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-highlight);
}

.header-badge.badge-warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--color-warning);
  border-color: rgba(217, 119, 6, 0.3);
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.form-label-row .form-label {
  margin-bottom: 0;
}

.required {
  color: var(--brand-red);
}

.form-hint {
  font-weight: 400;
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-red);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

/* Quick chips */
.quick-chip-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.quick-chip {
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.quick-chip.active {
  background: var(--brand-navy);
  color: #fff;
  border-color: var(--brand-navy);
}

/* Bet Type Pills Selector Grid */
.type-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.type-pill {
  position: relative;
  cursor: pointer;
  display: block;
  margin: 0;
}

.type-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill-content {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.65rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.type-code {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
}

.type-pill:hover .pill-content {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.type-pill input[type="radio"]:checked + .pill-content {
  background: rgba(200, 16, 46, 0.08);
  border-color: var(--brand-red);
}

.type-pill input[type="radio"]:checked + .pill-content .type-code {
  color: var(--brand-red);
}

/* Numbers input & preview */
.number-input-box {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

.number-helpers-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.helper-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mini-chip {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mini-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.numbers-tags-preview {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.preview-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.number-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.35rem;
  background: var(--brand-navy);
  color: #fff;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Amount & Unit toggle */
.unit-toggle-group {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.unit-btn {
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.unit-btn.active {
  background: var(--brand-red);
  color: #fff;
}

.amount-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-input-box {
  padding-right: 4rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.amount-unit-suffix {
  position: absolute;
  right: 0.85rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
}

.amount-verbal-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-style: italic;
  min-height: 1rem;
}

/* Form Action Buttons */
.form-actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn-submit-note {
  flex: 1;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--brand-red) 0%, #dc2626 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(200, 16, 46, 0.3);
}

.btn-submit-note:hover {
  background: linear-gradient(135deg, var(--brand-red-hover) 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

.btn-cancel-edit {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-highlight);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-cancel-edit:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Right Column: Dashboard & Table */
.notes-content-area {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 4 Metric Cards */
.notes-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .notes-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .notes-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.metric-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  margin: 0.15rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Toolbar Card */
.notes-toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.toolbar-select {
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--brand-red);
}

.toolbar-date-input {
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.82rem;
}

.notes-search-box input {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-highlight);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.82rem;
  min-width: 200px;
}

.notes-search-box input:focus {
  outline: none;
  border-color: var(--brand-red);
  background: var(--bg-card);
}

/* Notes Table Card */
.notes-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.notes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.notes-table thead th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.notes-table tbody td {
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.note-table-row:hover {
  background: var(--bg-card-hover);
}

.note-table-row.status-win {
  background: rgba(22, 163, 74, 0.03);
}

.note-table-row.status-win:hover {
  background: rgba(22, 163, 74, 0.07);
}

.date-link {
  color: var(--brand-navy);
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  transition: color var(--transition-fast);
}

.date-link:hover {
  color: var(--brand-red);
  text-decoration: underline;
}

/* Type Badges */
.type-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  text-align: center;
  white-space: nowrap;
}

.type-badge-lo {
  background: rgba(30, 58, 138, 0.12);
  color: var(--brand-navy);
  border: 1px solid rgba(30, 58, 138, 0.25);
}

.type-badge-de {
  background: rgba(200, 16, 46, 0.12);
  color: var(--brand-red);
  border: 1px solid rgba(200, 16, 46, 0.25);
}

.type-badge-xien {
  background: rgba(217, 119, 6, 0.12);
  color: var(--color-warning);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.type-badge-cang {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
  border: 1px solid rgba(147, 51, 234, 0.25);
}

.type-badge-khac {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* Numbers balls in table */
.note-numbers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.note-num-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 0.3rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.num-ball-winner {
  background: #fef08a !important;
  color: #854d0e !important;
  border-color: #eab308 !important;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.4);
  font-weight: 900;
}

/* Amount in table */
.amount-val {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text-primary);
}

.potential-win-val {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--brand-navy);
}

[data-theme="dark"] .potential-win-val {
  color: #60a5fa;
}

.unit-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sub-cost {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Result cell */
.result-cell-flex {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  width: fit-content;
}

.badge-win {
  background: rgba(22, 163, 74, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.badge-win-special {
  background: rgba(220, 38, 38, 0.15);
  color: var(--brand-red);
  border: 1px solid rgba(220, 38, 38, 0.35);
  font-weight: 900;
}

.badge-lose {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

.badge-pending {
  background: rgba(217, 119, 6, 0.15);
  color: var(--color-warning);
}

.badge-live {
  background: rgba(220, 38, 38, 0.18);
  color: var(--brand-red);
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.result-detail-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* PnL formatting */
.pnl-win {
  color: var(--color-success);
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.pnl-lose {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.pnl-pending {
  color: var(--color-warning);
  font-size: 0.78rem;
  font-weight: 600;
}

.pnl-net {
  font-size: 0.72rem;
  font-weight: 700;
}

.note-desc-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: 160px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Actions in row */
.action-btn-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-action-icon {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.btn-action-icon:hover {
  background: var(--bg-tertiary);
  transform: scale(1.15);
}

.btn-action-delete:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* Empty State */
.notes-empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}

.notes-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.notes-empty-state h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.notes-empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto;
}

/* Toast Message */
.notes-toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.notes-toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

.notes-toast-msg.toast-success {
  border-left: 4px solid var(--color-success);
}

.notes-toast-msg.toast-info {
  border-left: 4px solid var(--brand-navy);
}

/* Dark mode adjustments for Bet Notes */
[data-theme="dark"] .notes-badge {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
  border-color: rgba(22, 163, 74, 0.4);
}

[data-theme="dark"] .num-ball-winner {
  background: #ca8a04 !important;
  color: #fff !important;
  border-color: #facc15 !important;
}

[data-theme="dark"] .type-pill input[type="radio"]:checked + .pill-content {
  background: rgba(220, 38, 38, 0.15);
}

[data-theme="dark"] .note-table-row.status-win {
  background: rgba(22, 163, 74, 0.08);
}

