/* Seletor idioma/moeda — bandeiras retangulares selecionáveis */
.cg-locale-picker {
  display: grid;
  gap: 10px;
}
.cg-locale-picker--flags {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.cg-locale-picker--currency.cg-locale-picker--flags {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 420px) {
  .cg-locale-picker--flags {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cg-locale-picker__opt {
  position: relative;
  margin: 0;
  cursor: pointer;
}
.cg-locale-picker__opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cg-locale-picker__flag-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 8px;
  border-radius: 10px;
  border: 2px solid rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  min-height: 72px;
  user-select: none;
}
.cg-locale-picker__opt:hover .cg-locale-picker__flag-tile {
  border-color: rgba(56, 189, 248, 0.55);
  transform: translateY(-1px);
}
.cg-locale-picker__opt input:checked + .cg-locale-picker__flag-tile,
.cg-locale-picker__flag-tile.is-selected {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}
.cg-locale-picker__opt input:focus-visible + .cg-locale-picker__flag-tile {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.cg-locale-picker__flag-img {
  display: block;
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.18),
    0 1px 2px rgba(15, 23, 42, 0.12);
}
.cg-locale-picker__flag-caption {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--sgae-text, #0f172a);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.cg-locale-picker__flag-tile--locked {
  opacity: 0.55;
  cursor: default;
}
.cg-locale-picker__flag-tile--locked.is-selected {
  opacity: 1;
}

/* Login: tiles compactos para caber sem rolagem */
.cg-locale-picker--compact {
  gap: 6px;
}
.cg-locale-picker--compact .cg-locale-picker__flag-tile {
  min-height: 0;
  padding: 5px 4px 4px;
  gap: 3px;
  border-radius: 8px;
  border-width: 1.5px;
}
.cg-locale-picker--compact .cg-locale-picker__flag-img {
  width: 32px;
  height: 21px;
}
.cg-locale-picker--compact .cg-locale-picker__flag-caption {
  font-size: 0.58rem;
  line-height: 1.15;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cg-locale-picker--compact .cg-locale-picker__opt:hover .cg-locale-picker__flag-tile {
  transform: none;
}

.empresa-auth-split__field--locale {
  margin-bottom: 0.65rem;
}
.empresa-auth-split__field--locale .cg-ui-mode-picker__label {
  margin-bottom: 0.35rem;
  display: block;
  font-size: 0.78rem;
}

/* Legado (cards horizontais) — mantido se usado em outro lugar */
.cg-locale-picker__card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.06);
  min-height: 52px;
}
.cg-locale-picker__text {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

/* Topbar: retângulos compactos */
.cg-flag-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--sgae-border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
}
.cg-flag-switch__btn {
  border: 2px solid transparent;
  background: transparent;
  padding: 3px;
  min-height: 0;
  cursor: pointer;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  transition: opacity 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.cg-flag-switch__btn .cg-locale-picker__flag-img {
  width: 28px;
  height: 18px;
  border-radius: 2px;
}
.cg-flag-switch__btn.is-active {
  opacity: 1;
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
}
.cg-flag-switch__btn:hover {
  opacity: 1;
}
.cg-flag-switch--readonly .cg-flag-switch__btn {
  cursor: default;
  pointer-events: none;
}
.cg-flag-switch--readonly .cg-flag-switch__btn:not(.is-active) {
  opacity: 0.4;
}
.cg-flag-switch--readonly .cg-flag-switch__btn.is-active {
  opacity: 1;
}
.cg-flag-switch__sym {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sgae-text-muted);
  padding-right: 4px;
}

@media (max-width: 991.98px) {
  .sgae-app .topbar-right .cg-flag-switch--currency {
    display: none;
  }
}
@media (max-width: 767.98px) {
  .sgae-app .topbar-right .cg-flag-switch {
    display: none;
  }
}
