* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.app-page {
  display: none;
  min-height: 100vh;
}

.topbar {
  min-height: 68px;
  background: #111827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #4b5563;
  border-radius: 8px;
  background: #1f2937;
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.brand {
  font-size: 18px;
  font-weight: 800;
}

.admin-info {
  margin-top: 4px;
  font-size: 13px;
  color: #d1d5db;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.logout-button {
  background: #dc2626;
  height: 36px;
}

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 68px);
}

.side-menu {
  width: 220px;
  flex: 0 0 220px;
  background: #111827;
  border-top: 1px solid #1f2937;
  padding: 14px 10px;
  transform: translateX(0);
  transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
}

.side-menu.closed {
  width: 0;
  flex-basis: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
}

.side-menu-button {
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: transparent;
  color: #d1d5db;
  text-align: left;
  font-size: 14px;
}

.side-menu-button.active {
  background: #2563eb;
  color: #ffffff;
}

.side-menu-button.parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.side-menu-button.parent.active-parent {
  background: #1f2937;
  color: #ffffff;
}

.side-menu-arrow {
  font-size: 12px;
  color: #9ca3af;
}

.side-submenu {
  display: none;
  margin: 0 0 8px;
}

.side-submenu.open {
  display: block;
}

.side-menu-button.child {
  height: 34px;
  margin-bottom: 6px;
  padding-left: 24px;
  font-size: 13px;
  color: #cbd5e1;
}

.content-shell {
  flex: 1;
  min-width: 0;
}

.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 22px 24px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 24px;
  font-size: 14px;
  color: #6b7280;
}

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
}

input:focus,
select:focus {
  border-color: #111827;
}

button {
  height: 38px;
  border: none;
  border-radius: 9px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 12px;
  white-space: nowrap;
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.full-button {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  font-size: 14px;
}

.back-button {
  background: #374151;
  height: 38px;
  margin-bottom: 16px;
}

.save-button {
  background: #047857;
  width: 100%;
  height: 46px;
  font-size: 14px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.search-row input {
  flex: 1;
}

.bulk-limit-row {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  flex-wrap: wrap;
}

.bulk-limit-row .form-group {
  width: 220px;
  margin-bottom: 0;
}

.bulk-limit-row button {
  height: 42px;
  background: #2563eb;
}

.lock-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

.lock-box input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  font-size: 14px;
}

.error {
  color: #dc2626;
}

.success {
  color: #047857;
}

.muted {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: center;
}

th {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  background: #f9fafb;
  font-size: 12px;
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.balance-text {
  font-weight: 800;
}

.rolling-text {
  font-weight: 800;
  color: #2563eb;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: default;
  pointer-events: none;
}

.type-charge {
  background: #047857;
}

.type-withdraw {
  background: #b91c1c;
}

.type-point-add {
  background: #2563eb;
}

.type-point-subtract {
  background: #92400e;
}

.bet-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: default;
  pointer-events: none;
}

.bet-status-win {
  background: #2563eb;
}

.bet-status-lose {
  background: #dc2626;
}

.bet-status-void {
  background: #047857;
}

.bet-status-pending {
  background: #facc15;
  color: #422006;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
  cursor: default;
  pointer-events: none;
}

.result-player,
.result-odd,
.result-over {
  background: #dbeafe;
  color: #1d4ed8;
}

.result-banker,
.result-even,
.result-under {
  background: #fee2e2;
  color: #b91c1c;
}

.result-tie {
  background: #dcfce7;
  color: #047857;
}

.memo-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.memo-edit-button {
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  background: #4b5563;
  font-size: 12px;
}

.amount-input {
  width: 86px;
  height: 34px;
  text-align: center;
}

.rate-select {
  width: 128px;
  height: 34px;
  text-align: center;
}

.rate-select:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}

.rate-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.row-lock-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.row-rate-lock {
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
}

.user-link {
  border: none;
  background: transparent;
  color: #2563eb;
  padding: 0;
  height: auto;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
}

.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.small-button {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 8px;
}

.charge-button {
  background: #047857;
}

.withdraw-button {
  background: #b91c1c;
}

.point-add-button {
  background: #1d4ed8;
}

.point-subtract-button {
  background: #92400e;
}

.point-button {
  background: #2563eb;
}

.edit-button {
  background: #4b5563;
}

.delete-button {
  background: #dc2626;
}

.delete-button:hover {
  background: #b91c1c;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  margin-top: 6px;
}

.empty {
  padding: 30px;
  text-align: center;
  color: #6b7280;
}

.detail-page,
.rate-page {
  display: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.readonly-box {
  min-height: 42px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  color: #374151;
}

.rate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 120px;
  gap: 12px;
  align-items: end;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

.rate-table {
  margin-top: 18px;
}

.rate-table table {
  min-width: 820px;
}

.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-button {
  height: 36px;
  background: #e5e7eb;
  color: #374151;
}

.tab-button.active {
  background: #2563eb;
  color: #ffffff;
}

.transaction-tab-panel {
  display: none;
}

.transaction-tab-panel.active {
  display: block;
}

.filter-row {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-row .form-group {
  min-width: 180px;
  margin-bottom: 0;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  background: #f9fafb;
  text-align: center;
}

.summary-title {
  margin-bottom: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
}

.summary-value {
  font-size: 16px;
  font-weight: 800;
}

.summary-value.positive {
  color: #047857;
}

.summary-value.negative {
  color: #dc2626;
}

.summary-period {
  margin: -4px 0 14px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}

.placeholder-row {
  padding: 26px;
  color: #6b7280;
  text-align: center;
}

.transaction-table table {
  min-width: 820px;
}

.betting-table table {
  min-width: 920px;
}

.game-result-table table {
  min-width: 620px;
}

.powerball-result-table table {
  min-width: 980px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  color: #374151;
  font-size: 13px;
  font-weight: 800;
}

.pagination-row button {
  height: 32px;
  padding: 0 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.55);
  z-index: 50;
}

.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.modal-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
}

.modal-user-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calculated-box {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
}

textarea:focus {
  border-color: #111827;
}

.eligibility-message {
  min-height: 22px;
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.eligible {
  color: #047857;
}

.ineligible {
  color: #dc2626;
}

.game-state-card {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.game-state-title {
  margin-bottom: 12px;
  color: #111827;
  font-size: 15px;
  font-weight: 900;
}

.game-state-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.game-state-item {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.game-state-label {
  margin-bottom: 5px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
}

.game-state-value {
  color: #111827;
  font-size: 14px;
  font-weight: 900;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.state-waiting {
  background: #6b7280;
}

.state-open {
  background: #047857;
}

.state-closed {
  background: #dc2626;
}

.state-result {
  background: #2563eb;
}

.state-error {
  background: #991b1b;
}

.state-connected {
  background: #047857;
}

.state-disconnected {
  background: #dc2626;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.modal-add-button {
  background: #047857;
}

.modal-close-button {
  background: #6b7280;
}

@media (max-width: 960px) {
  .grid,
  .detail-grid,
  .rate-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }

  .modal-user-grid,
  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row .form-group {
    width: 100%;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .game-state-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .side-menu {
    position: fixed;
    top: 68px;
    bottom: 0;
    left: 0;
    z-index: 40;
    box-shadow: 16px 0 32px rgba(0, 0, 0, 0.18);
  }

  .side-menu.closed {
    transform: translateX(-100%);
    width: 0;
    flex-basis: 0;
    padding: 14px 10px;
  }

  .container {
    padding: 18px 14px;
  }
}
