/* Modal único das abas internas (Apostas, Transações, Afiliados, Perfil,
   Entrar, Criar conta). O CSS próprio de cada aba está em tabs.css. */
html.cm-tab-open,
html.cm-tab-open body { overflow: hidden !important; }

.cm-tab-modal {
  position: fixed;
  inset: 0;
  z-index: 1100; /* acima do topo (1040); abaixo de depósito/saque (1200+) e suporte */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vw, 32px);
}
.cm-tab-modal[hidden] { display: none; }

.cm-tab-backdrop {
  position: absolute;
  inset: 0;
  background: #020817cc;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .2s ease;
}

.cm-tab-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  height: min(880px, 100%);
  background: #0b1120;
  border: 1px solid #24354e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 90px #000b, inset 0 1px 0 #ffffff12;
  opacity: 0;
  transform: translateY(18px) scale(.985);
  transition: opacity .22s ease, transform .22s ease;
}
.cm-tab-modal[data-size="narrow"] .cm-tab-card { width: min(500px, 100%); height: auto; max-height: 100%; }
.cm-tab-modal.is-open .cm-tab-backdrop { opacity: 1; }
.cm-tab-modal.is-open .cm-tab-card { opacity: 1; transform: none; }

.cm-tab-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px 10px 20px;
  background: #0d1729;
  border-bottom: 1px solid #24354e;
}
.cm-tab-head h2 {
  margin: 0;
  font: 800 1.05rem/1.2 CountBody, Inter, system-ui, sans-serif;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-tab-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #526b8c;
  border-radius: 50%;
  background: #263e5c;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.cm-tab-close:hover { background: #31507a; }
.cm-tab-close:active { transform: scale(.94); }
.cm-tab-close:focus-visible { outline: 2px solid #7cc4ff; outline-offset: 2px; }

.cm-tab-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #33496b transparent;
  transition: opacity .15s ease;
}
.cm-tab-modal.is-loading .cm-tab-body { opacity: .35; pointer-events: none; }
.cm-tab-modal.is-loading .cm-tab-body:empty { min-height: 240px; }

.cm-tab-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: none;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid #ffffff26;
  border-top-color: #4fb4ff;
  border-radius: 50%;
  animation: cm-tab-spin .8s linear infinite;
}
.cm-tab-modal.is-loading .cm-tab-loader { display: block; }
@keyframes cm-tab-spin { to { transform: rotate(360deg); } }

.cm-tab-error { padding: 60px 24px; text-align: center; color: #c9d7ea; font: 600 15px/1.5 CountBody, sans-serif; }
.cm-tab-retry { margin-top: 16px; padding: 10px 18px; border: 1px solid #365674; border-radius: 12px; background: #1a304a; color: #aedff5; font-weight: 800; cursor: pointer; }

/* ---- Ajustes de encaixe: as páginas eram de tela cheia, agora vivem no modal ---- */
.cm-tab .cm-tab-root { min-height: 100%; }
.cm-tab .count-dashboard { background: #0b1120; color: var(--text); font-family: CountBody, Inter, sans-serif; }
.cm-tab .count-dashboard :is(.apostas-section, .transactions-section, .perfil-section) { margin-top: 0; min-height: 0; padding-top: 26px; padding-bottom: 32px; }
.cm-tab .count-dashboard .container { margin-top: 0; margin-bottom: 0; min-height: 0; padding-top: 26px; padding-bottom: 32px; }
.cm-tab .count-auth { position: relative; isolation: isolate; min-height: 0; }
.cm-tab .cm-tab-root.count-auth::before { position: absolute; }
.cm-tab .count-auth .auth-wrap { min-height: 0; padding: 22px 16px 26px; }
.cm-tab .count-auth .panel { box-shadow: none; }
/* Herdados do CSS antigo da home que não devem valer dentro das abas */
.cm-tab form { display: block; gap: normal; }
.cm-tab .count-auth form { display: block; }

@media (max-width: 640px) {
  .cm-tab-modal { padding: 0; align-items: stretch; }
  .cm-tab-card,
  .cm-tab-modal[data-size="narrow"] .cm-tab-card {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    transform: translateY(24px);
  }
  .cm-tab-modal.is-open .cm-tab-card,
  .cm-tab-modal.is-open[data-size="narrow"] .cm-tab-card { transform: none; }
  .cm-tab-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .cm-tab-body { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

@media (prefers-reduced-motion: reduce) {
  .cm-tab-backdrop, .cm-tab-card, .cm-tab-body { transition: none; }
}
