/* Admin v3.10.76 — desktop/mobile overlap protection, rewards, and per-player cycles. */

:root {
  --admin-gap: clamp(12px, 1.35vw, 18px);
  --admin-panel-padding: clamp(15px, 1.7vw, 22px);
  --admin-control-height: 42px;
}

html,
body,
.screen,
.app-shell,
.main,
.content,
.view,
.panel,
.panel-grid,
.form-grid,
.stats-grid,
.page-heading,
.filter-bar,
.toolbar,
.action-group,
.inline-actions,
.topbar,
.topbar-copy,
.topbar-actions,
.modal-card,
.cs-modal-card {
  min-width: 0;
}

body { overflow-x: hidden; }
.main { width: 100%; min-width: 0; }
.content { width: min(1600px, 100%); padding: clamp(18px, 2vw, 30px); }
.view { width: 100%; max-width: 100%; }
.view > * { min-width: 0; max-width: 100%; }
.panel { padding: var(--admin-panel-padding); }
.panel-grid,
.stats-grid,
.form-grid { gap: var(--admin-gap); }

.page-heading,
.panel-header,
.toolbar,
.filter-bar,
.inline-actions,
.action-group,
.record-page-actions,
.gateway-wallet-dashboard-actions,
.cs-modal-actions,
.modal-header {
  flex-wrap: wrap;
}

.page-heading > *,
.panel-header > *,
.toolbar > *,
.filter-bar > *,
.inline-actions > *,
.action-group > *,
.record-page-actions > *,
.form-grid > *,
.panel-grid > *,
.stats-grid > *,
[class$="-grid"] > * {
  min-width: 0;
}

h1, h2, h3, h4, p, span, strong, small, label, td, th {
  overflow-wrap: anywhere;
}

.input,
.select,
.textarea,
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.button {
  max-width: 100%;
  min-height: var(--admin-control-height);
  white-space: normal;
  line-height: 1.2;
}

.button-small { min-height: 34px; }
.action-group .button,
.inline-actions .button,
.record-page-actions .button { flex: 0 1 auto; }

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table { width: max(100%, 780px); }
.table-wrap th,
.table-wrap td { vertical-align: top; }
.table-wrap .action-group { min-width: max-content; }

.support-admin-tabs,
.integration-page-tabs,
.ops-tabs,
.accounting-view-tabs,
.game-layout-preview-tabs,
.cs-case-main-tabs,
.cs-record-tabs,
.ops-period-buttons,
.ops-analytics-tabs,
.deposit-record-tabs,
.withdrawal-record-tabs {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap !important;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.support-admin-tabs > *,
.integration-page-tabs > *,
.ops-tabs > *,
.accounting-view-tabs > *,
.game-layout-preview-tabs > *,
.cs-case-main-tabs > *,
.cs-record-tabs > *,
.ops-period-buttons > *,
.ops-analytics-tabs > *,
.deposit-record-tabs > *,
.withdrawal-record-tabs > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

.modal,
.cs-modal,
.ui-dialog-overlay { padding: clamp(10px, 2vw, 24px); }
.modal-card,
.cs-modal-card,
.ui-dialog-card {
  width: min(960px, 100%);
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  overflow: auto;
  overscroll-behavior: contain;
}

.notification-panel {
  width: min(420px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 84px));
  overflow: auto;
}

/* Sidebar structure: the brand and search occupy separate non-overlapping rows. */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.sidebar-header {
  position: relative !important;
  z-index: 7 !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  padding: 8px 8px 12px !important;
}
.admin-brand-home {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 11px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 62px !important;
  padding: 6px !important;
}
.admin-brand-home .brand-mark {
  grid-column: 1 !important;
  width: 52px !important;
  height: 52px !important;
}
.admin-brand-home .sidebar-brand-copy {
  grid-column: 2 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.admin-brand-home .sidebar-brand-copy strong,
.admin-brand-home .sidebar-brand-copy span {
  display: block !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.sidebar-nav {
  position: relative !important;
  z-index: 4 !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding-top: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
.admin-nav-search-wrap {
  position: sticky !important;
  top: 0 !important;
  z-index: 8 !important;
  margin: 0 !important;
  padding: 8px 2px 11px !important;
}
.app-shell.sidebar-collapsed .sidebar-header { padding: 4px 0 10px !important; }
.app-shell.sidebar-collapsed .admin-brand-home {
  display: grid !important;
  grid-template-columns: 1fr !important;
  min-height: 52px !important;
  padding: 0 !important;
}
.app-shell.sidebar-collapsed .admin-brand-home .brand-mark { grid-column: 1 !important; margin: auto !important; }

/* Account levels and rebate configuration */
.rewards-config-panel { display: grid; gap: 16px; margin-bottom: 20px; }
.rewards-config-heading,
.rewards-table-heading,
.rewards-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.rewards-config-heading > div,
.rewards-table-heading > div,
.rewards-config-footer > * { min-width: 0; }
.rewards-config-heading h3 { margin: 5px 0 4px; }
.rewards-enable-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  white-space: nowrap;
}
.rewards-enable-control input { width: 18px; height: 18px; }
.rewards-config-form { display: grid; gap: 14px; }
.rewards-rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.rewards-rule-grid .field { display: grid; gap: 6px; margin: 0; }
.rewards-rule-grid .field > span,
.rewards-table-heading span {
  color: var(--muted);
  font-size: 11px;
}
.rewards-table-heading > div { display: grid; gap: 3px; }
.rewards-level-table { min-width: 760px; }
.rewards-level-table .input { min-width: 112px; }
.rewards-level-table [data-reward-level-name] { min-width: 130px; }
.rewards-level-active { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 38px; }
.rewards-level-active input { width: 18px; height: 18px; }
.rewards-config-footer #rewardsConfigMessage { flex: 1 1 360px; margin: 0; }
.rewards-config-footer .button { flex: 0 0 auto; }

/* Per-player cycle controls stay readable inside the horizontally scrollable table. */
.player-commission-cycle {
  display: grid;
  gap: 4px;
  min-width: 154px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.player-commission-cycle > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.player-commission-cycle .select { min-height: 34px !important; }
.player-cycle-meta { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }

/* Commission cycle */
.commission-cycle-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, .8fr);
  gap: var(--admin-gap);
  align-items: start;
  margin-bottom: 20px;
}

.commission-cycle-overview,
.commission-cycle-form,
.commission-cycle-recovery {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 84%, var(--accent, #d4af37));
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-solid, #111) 88%, transparent);
}

.commission-cycle-overview { padding: clamp(15px, 1.8vw, 22px); }
.commission-cycle-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.commission-cycle-title-row > div { min-width: 0; }
.commission-cycle-title-row h3 { margin: 5px 0 0; font-size: clamp(18px, 2vw, 24px); }
.commission-cycle-title-row p { margin: 8px 0 0; }
.commission-cycle-title-row .status { flex: 0 0 auto; }

.commission-cycle-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0;
}
.commission-cycle-stats > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.commission-cycle-stats span,
.commission-cycle-form-head span,
.commission-cycle-recovery span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.commission-cycle-stats strong { display: block; margin-top: 5px; font-size: 13px; }
.commission-cycle-overview .notice { margin: 0; }

.commission-cycle-form {
  display: grid;
  gap: 13px;
  padding: clamp(15px, 1.7vw, 20px);
}
.commission-cycle-form-head { display: grid; gap: 4px; }
.commission-cycle-form .field { display: grid; gap: 6px; margin: 0; }
.commission-cycle-form .field > span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.commission-cycle-form .field small { color: var(--muted); }
.commission-schedule-preview {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: rgba(255,255,255,.025);
  font-size: 12px;
  line-height: 1.5;
}
.commission-schedule-preview span { display: block; margin-top: 4px; color: var(--muted); }
.commission-cycle-form .button { width: 100%; }
.commission-cycle-recovery {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}
.commission-cycle-recovery > div { min-width: 0; }
.commission-cycle-recovery .button { flex: 0 0 auto; }
.commission-cycle-message { grid-column: 1 / -1; min-height: 20px; }

.commission-tree-row {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.commission-tree-row > * { min-width: 0; }

@media (max-width: 1180px) {
  .commission-cycle-panel { grid-template-columns: 1fr; }
  .commission-cycle-recovery,
  .commission-cycle-message { grid-column: auto; }
  .stats-grid,
  .accounting-kpi-grid,
  .admin-data-health-grid,
  .gateway-wallet-router-summary { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .rewards-rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .content { padding: 18px; }
  .topbar { gap: 10px; padding: 10px 14px; }
  .topbar-copy { flex: 1 1 auto; }
  .topbar-actions { flex: 0 0 auto; gap: 7px; }
  .topbar-actions > .button { min-height: 38px; padding-inline: 11px; }
  .page-heading { gap: 12px; margin-bottom: 17px; }
  .page-heading > div:first-child { flex: 1 1 260px; }
  .record-page-actions { width: 100%; }
  .record-page-actions .button { flex: 1 1 150px; }
  .support-layout,
  .support-workspace,
  .cs-workspace,
  .lotto-live-layout,
  .theme-manager-grid,
  .payment-channel-admin-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 700px) {
  :root { --admin-control-height: 40px; }
  .content { padding: 14px 12px 24px; }
  .panel { border-radius: 14px; }
  .page-heading { flex-direction: column; align-items: stretch; }
  .page-heading h2 { font-size: clamp(22px, 7vw, 28px); }
  .page-heading > .button,
  .page-heading > .inline-actions { width: 100%; }
  .page-heading > .button { justify-content: center; }
  .inline-actions .button,
  .action-group .button { flex: 1 1 120px; }
  .filter-bar { align-items: stretch; padding: 12px; }
  .filter-field { flex: 1 1 100%; width: 100%; min-width: 0; }
  .stats-grid,
  .form-grid,
  .panel-grid,
  .accounting-kpi-grid,
  .admin-data-health-grid,
  .gateway-wallet-router-summary,
  .gateway-wallet-grid,
  .permission-grid,
  .theme-color-grid,
  .core-schedule-grid,
  .core-game-control-grid,
  .ops-health-grid,
  .ops-threshold-grid,
  .cs-metrics-grid,
  .handbook-grid,
  .handbook-reference-grid { grid-template-columns: 1fr !important; }
  .form-span-2 { grid-column: auto !important; }
  .commission-cycle-stats { grid-template-columns: 1fr; }
  .commission-cycle-title-row,
  .commission-cycle-recovery { align-items: stretch; flex-direction: column; }
  .commission-cycle-recovery .button { width: 100%; }
  .commission-tree { overflow-x: auto; }
  .commission-tree-row { min-width: 430px; }
  .sidebar-header { padding: 7px 8px 10px !important; }
  .admin-brand-home { grid-template-columns: 46px minmax(0, 1fr) !important; min-height: 56px !important; }
  .admin-brand-home .brand-mark { width: 46px !important; height: 46px !important; }
  .rewards-rule-grid { grid-template-columns: 1fr; }
  .rewards-config-heading,
  .rewards-config-footer { align-items: stretch; flex-direction: column; }
  .rewards-enable-control,
  .rewards-config-footer .button { width: 100%; }
  .notification-panel { position: fixed !important; inset: 64px 12px auto 12px !important; width: auto; }
  .modal-header { align-items: flex-start; }
  .logo-upload-card { grid-template-columns: 1fr !important; }
  .toast { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}

@media (max-width: 460px) {
  .topbar { min-height: 62px; }
  .topbar-copy span { display: none; }
  .topbar-actions > #logoutButton { font-size: 0; width: 40px; padding: 0; }
  .topbar-actions > #logoutButton::after { content: "Exit"; font-size: 11px; }
  .mobile-menu-button,
  .notification-button { width: 40px; height: 40px; flex: 0 0 40px; }
  .panel { padding: 14px; }
  .button { width: 100%; justify-content: center; }
  .topbar .button,
  .topbar button,
  .support-admin-tabs .button,
  .integration-page-tabs .button,
  .ops-tabs .button,
  .accounting-view-tabs .button,
  .game-layout-preview-tabs .button,
  .cs-case-main-tabs button,
  .cs-record-tabs button,
  .ops-period-buttons button,
  .ops-analytics-tabs button { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .view.active { animation: none !important; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}
