/* v3.10.74: runtime themes, readable contrast, responsive containment, fast long views */
:root {
  --theme-bg: #090507;
  --theme-surface: #190b10;
  --theme-text: #fff7e6;
  --theme-muted: #d8c9a6;
  --theme-primary: #a7192d;
  --theme-accent: #f2ca4d;
}

html, body, .screen, .app-screen, .admin-shell, .main-content, .content-area {
  background-color: var(--theme-bg) !important;
  color: var(--theme-text) !important;
}

.sidebar, .topbar, .panel, .card, .modal-card, .login-card,
.table-wrap, .form-card, .stat-card, .settings-card, .view-context-bar {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 26%, transparent) !important;
}

h1, h2, h3, h4, h5, strong, label, th, td, .page-heading, .sidebar-system-name {
  color: var(--theme-text) !important;
}

p, small, .muted, .helper, .page-heading p, .field small, .stat-helper {
  color: var(--theme-muted) !important;
}

a { color: var(--theme-accent); }
.button-primary, button.primary, .nav-item.active, .sidebar-nav button.active {
  background: var(--theme-primary) !important;
  color: var(--theme-button-text, #fff) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 42%, transparent) !important;
}

.input, .select, .textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea {
  background: color-mix(in srgb, var(--theme-bg) 72%, var(--theme-surface)) !important;
  color: var(--theme-text) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 25%, transparent) !important;
}

.input::placeholder, .textarea::placeholder, input::placeholder, textarea::placeholder {
  color: color-mix(in srgb, var(--theme-muted) 72%, transparent) !important;
  opacity: 1;
}

*, *::before, *::after { box-sizing: border-box; }
main, .main-content, .view, .panel, .card, .form-grid, .field, .table-wrap { min-width: 0; }
.page-heading, .toolbar, .action-group, .form-actions, .modal-header, .record-table-heading {
  flex-wrap: wrap !important;
}
.page-heading > *, .toolbar > *, .modal-header > * { min-width: 0; }
.button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.table-wrap, .table-container, [class*="table-wrap"] { max-width: 100%; overflow: auto !important; overscroll-behavior-inline: contain; }
table { width: 100%; }
td, th { overflow-wrap: anywhere; }
.modal-card, .cs-modal-card { max-width: min(100% - 24px, 980px) !important; max-height: calc(100dvh - 24px); overflow: auto; }
.toast, .message, .alert { overflow-wrap: anywhere; }

#view-lottoLive .panel, #view-players .panel, #view-dashboard .panel,
#view-deposits .panel, #view-withdrawals .panel {
  content-visibility: auto;
  contain-intrinsic-size: 520px;
}

.theme-manager-section { display: grid; gap: 12px; }
.theme-manager-heading strong { display: block; font-size: 17px; }
.theme-manager-heading small { display: block; margin-top: 4px; }
.theme-manager-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theme-editor-card { min-width: 0; padding: 16px; border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, transparent); border-radius: 16px; background: color-mix(in srgb, var(--theme-surface) 88%, #fff 2%); }
.theme-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.theme-editor-head h3 { margin: 0; font-size: 16px; }
.theme-editor-head p { margin: 4px 0 0; font-size: 11px; }
.theme-preset-label { display: block; margin-bottom: 6px; }
.theme-color-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 12px 0; }
.theme-color-grid label { display: grid; grid-template-columns: 1fr 38px; align-items: center; gap: 7px; min-width: 0; padding: 7px 8px; border: 1px solid color-mix(in srgb, var(--theme-accent) 16%, transparent); border-radius: 9px; font-size: 10px; }
.theme-color-grid input[type="color"] { width: 38px; height: 30px; padding: 2px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.theme-preview { display: grid; gap: 5px; padding: 14px; border: 1px solid color-mix(in srgb, var(--preview-accent) 40%, transparent); border-radius: 13px; background: var(--preview-bg); color: var(--preview-text); }
.theme-preview strong { color: var(--preview-text) !important; }
.theme-preview span { color: var(--preview-muted); font-size: 11px; }
.theme-preview button { justify-self: start; margin-top: 5px; padding: 7px 12px; border: 1px solid var(--preview-accent); border-radius: 8px; background: var(--preview-primary); color: var(--preview-button-text); font: inherit; font-weight: 800; }
.theme-contrast-status { min-height: 18px; margin: 8px 0 0; color: #ffd2d2 !important; font-size: 11px; }
.theme-contrast-status.theme-contrast-pass { color: #9ff0be !important; }

@media (max-width: 980px) {
  .theme-manager-grid { grid-template-columns: minmax(0, 1fr); }
  .main-content, .content-area { width: 100%; }
}

@media (max-width: 620px) {
  .page-heading, .toolbar, .modal-header { align-items: stretch !important; flex-direction: column; }
  .page-heading .button, .toolbar .button { width: 100%; }
  .theme-color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-editor-head { flex-wrap: wrap; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-span-2 { grid-column: 1 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
