/* Brand tiles */
.brand-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.brand-tile {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow .12s ease, border-color .12s ease, transform .05s ease;
  padding: 0;
  font-family: inherit;
}

.brand-tile:hover {
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
  box-shadow: 0 10px 20px rgba(15, 23, 42, .06);
}

.brand-tile:active {
  transform: translateY(1px);
}

.brand-tile.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}

.brand-tile img {
  max-height: 24px;
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
}

/* Flag tiles */
.flag-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.flag-tile {
  width: 100%;
  height: 54px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .05s ease, box-shadow .12s ease, border-color .12s ease;
  position: relative;
  overflow: hidden;
  padding: 0;
  font-family: inherit;
}

.flag-tile:hover {
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
  box-shadow: 0 10px 20px rgba(15, 23, 42, .06);
}

.flag-tile:active {
  transform: translateY(1px);
}

.flag-tile.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}

.flag {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  border: 0;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  transform: translateZ(0);
}

/* Mobile/Tablet responsiveness */
@media (max-width: 980px) {
  .flag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .brand-tile {
    height: 60px;
  }

  .flag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .flag-tile {
    height: 48px;
  }
}
